Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-trialdrive-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f0481eb9
authored
Mar 26, 2022
by
levphon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
车型bug修复、工单图片优化
1 parent
297f45b2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
40 deletions
src/main/java/cn/com/glsx/admin/modules/controller/WorkOrderController.java
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
src/main/java/cn/com/glsx/admin/modules/service/WorkOrderService.java
src/main/java/cn/com/glsx/admin/modules/utils/fileupload/FileConstants.java
src/main/java/cn/com/glsx/admin/modules/utils/fileupload/FileUploadUtil.java
src/main/resources/mapper/TenantVehicleTypeMapper.xml
src/main/java/cn/com/glsx/admin/modules/controller/WorkOrderController.java
View file @
f0481eb
...
@@ -33,7 +33,6 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -33,7 +33,6 @@ import org.springframework.web.multipart.MultipartFile;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -65,14 +64,6 @@ public class WorkOrderController {
...
@@ -65,14 +64,6 @@ public class WorkOrderController {
@ApiOperation
(
value
=
"工单照片导出"
)
@ApiOperation
(
value
=
"工单照片导出"
)
@GetMapping
(
value
=
"/batchExportPics"
)
@GetMapping
(
value
=
"/batchExportPics"
)
public
void
batchExportPics
(
HttpServletResponse
response
,
WorkOrderSearch
search
)
throws
IOException
{
public
void
batchExportPics
(
HttpServletResponse
response
,
WorkOrderSearch
search
)
throws
IOException
{
String
filename
=
new
String
(
DateUtils
.
formatSerial
(
new
Date
()).
getBytes
(
StandardCharsets
.
UTF_8
),
StandardCharsets
.
ISO_8859_1
)
+
".zip"
;
response
.
reset
();
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
filename
);
response
.
setContentType
(
"application/octet-stream; charset=utf-8"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
if
(
CollectionUtils
.
isEmpty
(
search
.
getOrderIds
()))
{
if
(
CollectionUtils
.
isEmpty
(
search
.
getOrderIds
()))
{
throw
new
AdminException
(
"参数为空"
);
throw
new
AdminException
(
"参数为空"
);
}
}
...
@@ -126,7 +117,6 @@ public class WorkOrderController {
...
@@ -126,7 +117,6 @@ public class WorkOrderController {
* 编辑工单
* 编辑工单
*
*
* @param workOrderBO
* @param workOrderBO
*
* @return
* @return
*/
*/
@SysLog
(
module
=
MODULE
,
value
=
"编辑工单"
,
action
=
OperateType
.
EDIT
)
@SysLog
(
module
=
MODULE
,
value
=
"编辑工单"
,
action
=
OperateType
.
EDIT
)
...
...
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
View file @
f0481eb
...
@@ -943,13 +943,17 @@ public class VehicleService {
...
@@ -943,13 +943,17 @@ public class VehicleService {
Map
<
Integer
,
List
<
VehicleTypeModel
>>
typesMap
=
typesList
.
stream
().
collect
(
Collectors
.
groupingBy
(
VehicleTypeModel:
:
getPid
));
Map
<
Integer
,
List
<
VehicleTypeModel
>>
typesMap
=
typesList
.
stream
().
collect
(
Collectors
.
groupingBy
(
VehicleTypeModel:
:
getPid
));
brandList
.
forEach
(
brand
->
{
brandList
.
forEach
(
brand
->
{
brand
.
setChilds
(
transCarTypeChild
(
subBrandMap
.
get
(
brand
.
getPid
())));
brand
.
setChilds
(
transCarTypeChild
(
subBrandMap
.
get
(
brand
.
getId
())));
subBrandList
.
forEach
(
subBrand
->
{
if
(
CollectionUtils
.
isNotEmpty
(
brand
.
getChilds
()))
{
subBrand
.
setChilds
(
transCarTypeChild
(
seriesMap
.
get
(
subBrand
.
getPid
())));
brand
.
getChilds
().
forEach
(
subBrand
->
{
seriesList
.
forEach
(
series
->
{
subBrand
.
setChilds
(
transCarTypeChild
(
seriesMap
.
get
(
subBrand
.
getId
())));
series
.
setChilds
(
transCarTypeChild
(
typesMap
.
get
(
series
.
getPid
())));
if
(
CollectionUtils
.
isNotEmpty
(
subBrand
.
getChilds
()))
{
subBrand
.
getChilds
().
forEach
(
series
->
{
series
.
setChilds
(
transCarTypeChild
(
typesMap
.
get
(
series
.
getId
())));
});
}
});
});
}
);
}
});
});
return
brandList
;
return
brandList
;
}
}
...
@@ -964,7 +968,12 @@ public class VehicleService {
...
@@ -964,7 +968,12 @@ public class VehicleService {
private
List
<
CarInfoSelected
>
transCarTypeChild
(
List
<
VehicleTypeModel
>
modelList
)
{
private
List
<
CarInfoSelected
>
transCarTypeChild
(
List
<
VehicleTypeModel
>
modelList
)
{
List
<
CarInfoSelected
>
list
=
Lists
.
newArrayList
();
List
<
CarInfoSelected
>
list
=
Lists
.
newArrayList
();
if
(
CollectionUtils
.
isNotEmpty
(
modelList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
modelList
))
{
modelList
.
forEach
(
vtm
->
{
CarInfoSelected
selected
=
new
CarInfoSelected
();
selected
.
setId
(
vtm
.
getId
());
selected
.
setName
(
vtm
.
getName
());
list
.
add
(
selected
);
});
}
}
return
list
;
return
list
;
}
}
...
...
src/main/java/cn/com/glsx/admin/modules/service/WorkOrderService.java
View file @
f0481eb
...
@@ -29,6 +29,7 @@ import com.alibaba.fastjson.JSON;
...
@@ -29,6 +29,7 @@ import com.alibaba.fastjson.JSON;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.plat.common.utils.DateUtils
;
import
com.glsx.plat.common.utils.HttpUtils
;
import
com.glsx.plat.common.utils.HttpUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.context.utils.PropertiesUtils
;
import
com.glsx.plat.context.utils.PropertiesUtils
;
...
@@ -46,9 +47,12 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -46,9 +47,12 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.function.Function
;
...
@@ -143,10 +147,11 @@ public class WorkOrderService {
...
@@ -143,10 +147,11 @@ public class WorkOrderService {
List
<
WorkOrderVehicle
>
wvList
=
workOrderVehicleMapper
.
selectByOrderIds
(
search
.
getOrderIds
());
List
<
WorkOrderVehicle
>
wvList
=
workOrderVehicleMapper
.
selectByOrderIds
(
search
.
getOrderIds
());
ZipOutputStream
zos
=
new
ZipOutputStream
(
response
.
getOutputStream
()
);
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
(
);
f
or
(
WorkOrderVehicle
wv
:
wvList
)
{
f
inal
ZipOutputStream
out
=
new
ZipOutputStream
(
baos
);
for
(
WorkOrderVehicle
wv
:
wvList
)
{
List
<
WorkOrderDocs
>
woDocs
=
docsMap
.
get
(
wv
.
getWorkOrderId
());
List
<
WorkOrderDocs
>
woDocs
=
docsMap
.
get
(
wv
.
getWorkOrderId
());
String
vinPath
=
wv
.
getVin
()
+
File
.
separator
;
String
vinPath
=
wv
.
getVin
()
+
File
.
separator
;
...
@@ -154,27 +159,32 @@ public class WorkOrderService {
...
@@ -154,27 +159,32 @@ public class WorkOrderService {
ZipEntry
vinDir
=
new
ZipEntry
(
vinPath
);
ZipEntry
vinDir
=
new
ZipEntry
(
vinPath
);
if
(
CollectionUtils
.
isNotEmpty
(
woDocs
))
{
if
(
CollectionUtils
.
isNotEmpty
(
woDocs
))
{
//车架号目录
zos
.
putNextEntry
(
vinDir
);
out
.
putNextEntry
(
vinDir
);
for
(
WorkOrderDocs
doc
:
woDocs
)
{
for
(
WorkOrderDocs
doc
:
woDocs
)
{
byte
[]
bytes
=
HttpUtils
.
downloadBytes
(
doc
.
getPath
());
byte
[]
bytes
=
HttpUtils
.
downloadBytes
(
doc
.
getPath
());
String
filename
=
doc
.
getName
();
String
filename
=
doc
.
getName
();
if
(!
filename
.
contains
(
"."
))
{
if
(
StringUtils
.
isNullOrEmpty
(
filename
))
{
String
suffix
=
doc
.
getPath
().
substring
(
doc
.
getPath
().
lastIndexOf
(
"."
));
filename
=
doc
.
getPath
().
substring
(
doc
.
getPath
().
lastIndexOf
(
"/"
));
filename
=
filename
+
suffix
;
}
else
{
if
(!
filename
.
contains
(
"."
))
{
String
suffix
=
doc
.
getPath
().
substring
(
doc
.
getPath
().
lastIndexOf
(
"."
));
filename
=
filename
+
suffix
;
}
}
}
out
.
putNextEntry
(
new
ZipEntry
(
vinPath
+
filename
));
zos
.
putNextEntry
(
new
ZipEntry
(
vinPath
+
filename
));
out
.
write
(
bytes
,
0
,
bytes
.
length
);
zos
.
write
(
bytes
,
0
,
bytes
.
length
);
}
}
}
}
}
}
zos
.
flush
();
out
.
close
();
zos
.
close
();
String
filename
=
new
String
(
DateUtils
.
formatSerial
(
new
Date
()).
getBytes
(
StandardCharsets
.
UTF_8
),
StandardCharsets
.
ISO_8859_1
)
+
".zip"
;
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename=\""
+
filename
+
"\""
);
response
.
setHeader
(
"Content-Type"
,
"application/zip"
);
response
.
getOutputStream
().
write
(
baos
.
toByteArray
());
response
.
flushBuffer
();
baos
.
close
();
}
}
public
List
<
WorkOrderImport
>
batchImport
(
List
<
WorkOrderImport
>
importList
)
{
public
List
<
WorkOrderImport
>
batchImport
(
List
<
WorkOrderImport
>
importList
)
{
...
@@ -580,7 +590,7 @@ public class WorkOrderService {
...
@@ -580,7 +590,7 @@ public class WorkOrderService {
}
}
public
WorkOrder
getSingleWorkOrderInfoById
(
Long
workOrderId
)
{
public
WorkOrder
getSingleWorkOrderInfoById
(
Long
workOrderId
)
{
if
(
workOrderId
==
null
)
{
if
(
workOrderId
==
null
)
{
return
null
;
return
null
;
}
}
WorkOrder
workOrder
=
workOrderMapper
.
selectById
(
workOrderId
);
WorkOrder
workOrder
=
workOrderMapper
.
selectById
(
workOrderId
);
...
...
src/main/java/cn/com/glsx/admin/modules/utils/fileupload/FileConstants.java
View file @
f0481eb
...
@@ -16,6 +16,7 @@ public class FileConstants {
...
@@ -16,6 +16,7 @@ public class FileConstants {
public
static
final
String
PDF_TYPE
=
"pdf"
;
public
static
final
String
PDF_TYPE
=
"pdf"
;
public
static
final
String
PNG_TYPE
=
"png"
;
public
static
final
String
PNG_TYPE
=
"png"
;
public
static
final
String
JPG_TYPE
=
"jpg"
;
public
static
final
String
JPG_TYPE
=
"jpg"
;
public
static
final
String
ZIP_TYPE
=
"zip"
;
/**
/**
* 文件服务器地址
* 文件服务器地址
...
...
src/main/java/cn/com/glsx/admin/modules/utils/fileupload/FileUploadUtil.java
View file @
f0481eb
...
@@ -49,7 +49,7 @@ public class FileUploadUtil {
...
@@ -49,7 +49,7 @@ public class FileUploadUtil {
*/
*/
public
static
FileUploadServerData
uploadToFileSystem
(
String
fileName
,
byte
[]
uploadData
,
String
fileType
)
{
public
static
FileUploadServerData
uploadToFileSystem
(
String
fileName
,
byte
[]
uploadData
,
String
fileType
)
{
RestTemplate
restTemplate
=
new
RestTemplate
();
RestTemplate
restTemplate
=
new
RestTemplate
();
MultiValueMap
<
String
,
String
>
form
=
new
LinkedMultiValueMap
<
String
,
String
>();
MultiValueMap
<
String
,
String
>
form
=
new
LinkedMultiValueMap
<>();
form
.
add
(
"systemSign"
,
"salesexcel"
);
form
.
add
(
"systemSign"
,
"salesexcel"
);
form
.
add
(
"filePath"
,
""
);
form
.
add
(
"filePath"
,
""
);
form
.
add
(
"param1"
,
fileName
);
form
.
add
(
"param1"
,
fileName
);
...
@@ -67,7 +67,7 @@ public class FileUploadUtil {
...
@@ -67,7 +67,7 @@ public class FileUploadUtil {
*/
*/
public
static
FileUploadServerData
zipToFileSystem
(
List
filePathList
)
{
public
static
FileUploadServerData
zipToFileSystem
(
List
filePathList
)
{
RestTemplate
restTemplate
=
new
RestTemplate
();
RestTemplate
restTemplate
=
new
RestTemplate
();
MultiValueMap
<
String
,
String
>
form
=
new
LinkedMultiValueMap
<
String
,
String
>();
MultiValueMap
<
String
,
String
>
form
=
new
LinkedMultiValueMap
<>();
form
.
add
(
"systemSign"
,
"salesexcelzip"
);
form
.
add
(
"systemSign"
,
"salesexcelzip"
);
form
.
add
(
"filePath"
,
""
);
form
.
add
(
"filePath"
,
""
);
form
.
add
(
"param1"
,
""
);
form
.
add
(
"param1"
,
""
);
...
...
src/main/resources/mapper/TenantVehicleTypeMapper.xml
View file @
f0481eb
...
@@ -88,7 +88,7 @@
...
@@ -88,7 +88,7 @@
</select>
</select>
<select
id=
"selectBrandByTenantIds"
resultType=
"cn.com.glsx.admin.modules.model.VehicleTypeModel"
>
<select
id=
"selectBrandByTenantIds"
resultType=
"cn.com.glsx.admin.modules.model.VehicleTypeModel"
>
select brand_id id,brand_name name
select
distinct
brand_id id,brand_name name
from t_tenant_vehicle_type
from t_tenant_vehicle_type
where del_flag = 0
where del_flag = 0
and enable_status = 1
and enable_status = 1
...
@@ -100,7 +100,7 @@
...
@@ -100,7 +100,7 @@
</select>
</select>
<select
id=
"selectSubBrandByTenantIds"
resultType=
"cn.com.glsx.admin.modules.model.VehicleTypeModel"
>
<select
id=
"selectSubBrandByTenantIds"
resultType=
"cn.com.glsx.admin.modules.model.VehicleTypeModel"
>
select sub_brand_id id,sub_brand_name name, brand_id pid
select
distinct
sub_brand_id id,sub_brand_name name, brand_id pid
from t_tenant_vehicle_type
from t_tenant_vehicle_type
where del_flag = 0
where del_flag = 0
and enable_status = 1
and enable_status = 1
...
@@ -115,7 +115,7 @@
...
@@ -115,7 +115,7 @@
</select>
</select>
<select
id=
"selectSeriesByTenantIds"
resultType=
"cn.com.glsx.admin.modules.model.VehicleTypeModel"
>
<select
id=
"selectSeriesByTenantIds"
resultType=
"cn.com.glsx.admin.modules.model.VehicleTypeModel"
>
select series_id id,series_name name, sub_brand_id pid
select
distinct
series_id id,series_name name, sub_brand_id pid
from t_tenant_vehicle_type
from t_tenant_vehicle_type
where del_flag = 0
where del_flag = 0
and enable_status = 1
and enable_status = 1
...
@@ -130,7 +130,7 @@
...
@@ -130,7 +130,7 @@
</select>
</select>
<select
id=
"selectTypesByTenantIds"
resultType=
"cn.com.glsx.admin.modules.model.VehicleTypeModel"
>
<select
id=
"selectTypesByTenantIds"
resultType=
"cn.com.glsx.admin.modules.model.VehicleTypeModel"
>
select type_id id,type_name name, series_id pid
select
distinct
type_id id,type_name name, series_id pid
from t_tenant_vehicle_type
from t_tenant_vehicle_type
where del_flag = 0
where del_flag = 0
and enable_status = 1
and enable_status = 1
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment