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 2320292f
authored
May 28, 2021
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
http://192.168.3.233:8090/eshiled-new/ne-shield-trialdrive-admin
2 parents
07efc26d
71c25396
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
29 deletions
src/main/java/cn/com/glsx/admin/modules/entity/Vehicle.java
src/main/java/cn/com/glsx/admin/modules/model/imports/TrialDriveVehicleImportListener.java
src/main/java/cn/com/glsx/admin/modules/utils/FileIOUtil.java
src/main/resources/mapper/ApprovalMapper.xml
src/main/resources/mapper/TrialDriveShopMapper.xml
src/main/resources/mapper/VehicleDocMapper.xml
src/main/resources/mapper/VehicleMapper.xml
src/main/java/cn/com/glsx/admin/modules/entity/Vehicle.java
View file @
2320292
...
...
@@ -76,6 +76,11 @@ public class Vehicle extends BaseEntity {
*/
@Column
(
name
=
"model_name"
)
private
String
modelName
;
/**
* 车辆配置id
*/
@Column
(
name
=
"config_id"
)
private
Integer
configId
;
/**
* 车辆配置
...
...
src/main/java/cn/com/glsx/admin/modules/model/imports/TrialDriveVehicleImportListener.java
View file @
2320292
...
...
@@ -10,7 +10,6 @@ import cn.com.glsx.usercenter.api.dto.response.User;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.event.AnalysisEventListener
;
import
com.alibaba.excel.read.metadata.holder.ReadWorkbookHolder
;
import
com.alibaba.fastjson.JSON
;
import
com.glsx.plat.common.utils.StringUtils
;
import
lombok.AllArgsConstructor
;
...
...
@@ -19,7 +18,7 @@ import lombok.SneakyThrows;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.lang.reflect.
Metho
d
;
import
java.lang.reflect.
Fiel
d
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -65,18 +64,20 @@ public class TrialDriveVehicleImportListener extends AnalysisEventListener<Trial
@Override
public
void
invokeHeadMap
(
Map
<
Integer
,
String
>
headMap
,
AnalysisContext
context
)
{
// 通过反射获取 ExcelProperty 内容比较headMap
ReadWorkbookHolder
workbookHolder
=
context
.
readWorkbookHolder
();
log
.
info
(
" 解析到一条头数据:{}"
,
JSON
.
toJSONString
(
headMap
));
// 获取方法上的注解
Method
[]
methods
=
TrialDriveVehicleImport
.
class
.
getDeclaredMetho
ds
();
for
(
Method
method
:
metho
ds
)
{
ExcelProperty
property
=
metho
d
.
getAnnotation
(
ExcelProperty
.
class
);
Field
[]
fields
=
TrialDriveVehicleImport
.
class
.
getDeclaredFiel
ds
();
for
(
Field
field
:
fiel
ds
)
{
ExcelProperty
property
=
fiel
d
.
getAnnotation
(
ExcelProperty
.
class
);
if
(
property
==
null
)
{
continue
;
}
String
excelPropertyName
=
property
.
value
()[
0
];
if
(
excelPropertyName
.
equals
(
"原因"
))
{
continue
;
}
String
excelColumnName
=
headMap
.
get
(
property
.
index
());
if
(!
excelPropertyName
.
equals
(
excelColumnName
)
&&
!
excelPropertyName
.
equals
(
"reason"
)
)
{
if
(!
excelPropertyName
.
equals
(
excelColumnName
))
{
log
.
info
(
"存在表头ExcelProperty.{},ExcelColumn.{}不一致情况!"
,
excelPropertyName
,
excelColumnName
);
throw
new
AdminException
(
ResultEnum
.
IMPORT_FAIL_FILE
);
}
...
...
@@ -110,7 +111,7 @@ public class TrialDriveVehicleImportListener extends AnalysisEventListener<Trial
baseImportInfo
.
setFailSeqNoFile
(
seqNo
);
baseImportInfo
.
setFailNum
(
baseImportInfo
.
getFailNum
()
+
failList
.
size
());
}
log
.
info
(
"所有数据解析完成!"
);
log
.
info
(
"所有数据解析
存储
完成!"
);
}
/**
...
...
@@ -140,7 +141,7 @@ public class TrialDriveVehicleImportListener extends AnalysisEventListener<Trial
});
baseImportInfo
.
setTotal
(
total
);
baseImportInfo
.
setSuccNum
(
succNum
.
get
());
log
.
info
(
"
存储数据库成功!"
);
log
.
info
(
"
本次存储数据:"
+
succNum
.
get
()
);
}
/**
...
...
@@ -163,7 +164,7 @@ public class TrialDriveVehicleImportListener extends AnalysisEventListener<Trial
}
String
vin
=
vehicleImport
.
getVin
();
if
(
vehicleService
.
checkVehicleByVin
(
vin
))
{
reason
.
append
(
"该车辆已存在
vin:"
+
vin
);
reason
.
append
(
"该车辆已存在
"
+
vin
+
";"
);
}
//如果存在设备号 校验设备号
String
sn
=
vehicleImport
.
getSn
();
...
...
@@ -172,11 +173,11 @@ public class TrialDriveVehicleImportListener extends AnalysisEventListener<Trial
}
boolean
snExist
=
deviceService
.
checkSnExist
(
sn
);
if
(!
snExist
)
{
reason
.
append
(
"设备号不存在"
);
reason
.
append
(
"设备号不存在
;
"
);
return
reason
.
toString
();
}
if
(
vehicleService
.
checkSnIsBind
(
sn
))
{
reason
.
append
(
"该设备号已绑定车辆"
);
reason
.
append
(
"该设备号已绑定车辆
;
"
);
}
return
reason
.
toString
();
}
...
...
src/main/java/cn/com/glsx/admin/modules/utils/FileIOUtil.java
View file @
2320292
...
...
@@ -138,7 +138,6 @@ public class FileIOUtil {
//清除30天之前的缓存文件
cleanExpiredFiles
(
file
,
60
);
OutputStream
outputStream
=
null
;
InputStream
inputStream
=
null
;
try
{
outputStream
=
new
FileOutputStream
(
path
+
"/"
+
seqNo
+
".xlsx"
);
WriteWorkbook
writeWorkbook
=
new
WriteWorkbook
();
...
...
@@ -149,12 +148,9 @@ public class FileIOUtil {
writeSheet
.
setSheetName
(
"sheet"
);
excelWriter
.
write
(
tList
,
writeSheet
);
excelWriter
.
finish
();
IOUtils
.
copy
(
inputStream
,
outputStream
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
IOUtils
.
closeQuietly
(
inputStream
);
IOUtils
.
closeQuietly
(
outputStream
);
}
return
seqNo
;
...
...
src/main/resources/mapper/ApprovalMapper.xml
View file @
2320292
...
...
@@ -88,19 +88,15 @@
FROM
t_approval t5
LEFT JOIN t_vehicle t1 ON t1.ID = t5.biz_id
LEFT JOIN t_vehicle_device t2 ON t1.id = t2.vehicle_id
LEFT JOIN t_electric_fence_sns t3 ON t2.sn = t3.sn
LEFT JOIN t_trial_drive_shop t4 ON t3.fence_id = t4.fence_id
LEFT JOIN t_trial_drive_shop t4 ON t1.created_by = t4.created_by
left join t_electric_fence t7 on t4.fence_id=t7.id
LEFT JOIN t_dict_data t6 ON t5.biz_type = t6.dict_value
WHERE
t1.del_flag = 0
AND t6.dict_type = 'approval_status'
AND t2.bind_status = 1
and t5.status in (1,2,3)
and t5.biz_type=2
GROUP BY
t5.id
ORDER BY t5.updated_date desc
<if
test=
"search.approvalStatus !=null and search.approvalStatus != ''"
>
and t5.status=#{search.status}
</if>
...
...
@@ -136,6 +132,7 @@
AND APP.biz_type=1 and shop_name is not null
GROUP BY
app.id
ORDER BY app.updated_date desc
<if
test=
"search.approvalStatus !=null and search.approvalStatus != ''"
>
and app.status=#{search.approvalStatus}
</if>
...
...
src/main/resources/mapper/TrialDriveShopMapper.xml
View file @
2320292
...
...
@@ -103,7 +103,7 @@
<include
refid=
"Base_Column_List"
/>
from t_trial_drive_shop ttds
where ttds.del_flag = 0
and ttds.
id
= #{id}
and ttds.
created_by
= #{id}
</select>
<update
id=
"logicDeleteById"
>
...
...
src/main/resources/mapper/VehicleDocMapper.xml
View file @
2320292
...
...
@@ -59,14 +59,11 @@
t5.id
FROM
t_vehicle t1
LEFT JOIN (select * from t_approval ORDER BY created_date desc) t5 ON (t1.ID = t5.biz_id AND t5.biz_type=2)
LEFT JOIN t_vehicle_device t2 ON t1.id = t2.vehicle_id
LEFT JOIN t_electric_fence_sns t3 ON t2.sn = t3.sn
LEFT JOIN t_trial_drive_shop t4 ON t3.fence_id = t4.fence_id
LEFT JOIN (select * from (select * from t_approval ORDER BY id desc)t group by t.biz_id,t.biz_type) t5 ON (t1.ID = t5.biz_id AND t5.biz_type=2)
LEFT JOIN t_trial_drive_shop t4 ON t1.created_by = t4.created_by
left join t_electric_fence t7 on t4.fence_id=t7.id
WHERE
t1.del_flag = 0
AND t2.bind_status = 1
and t4.shop_name is not null
<if
test=
"search.approvalStatus !=null and search.approvalStatus != ''"
>
and t5.status=#{search.approvalStatus}
...
...
src/main/resources/mapper/VehicleMapper.xml
View file @
2320292
...
...
@@ -17,6 +17,7 @@
<result
column=
"series_name"
jdbcType=
"VARCHAR"
property=
"seriesName"
/>
<result
column=
"model_id"
jdbcType=
"INTEGER"
property=
"modelId"
/>
<result
column=
"model_name"
jdbcType=
"VARCHAR"
property=
"modelName"
/>
<result
column=
"config_id"
jdbcType=
"INTEGER"
property=
"configId"
/>
<result
column=
"config_desc"
jdbcType=
"VARCHAR"
property=
"configDesc"
/>
<result
column=
"color"
jdbcType=
"VARCHAR"
property=
"color"
/>
<result
column=
"inner_color"
jdbcType=
"VARCHAR"
property=
"innerColor"
/>
...
...
@@ -59,7 +60,7 @@
WARNING - @mbg.generated
-->
id, workorder_id, owner_name, vin, owner_sex, owner_tel, brand_id, brand_name, series_id,
series_name, model_id, model_name, config_desc, color, inner_color, license_plate,
series_name, model_id, model_name, config_
id, config_
desc, color, inner_color, license_plate,
vehicle_type, engine, displacement, mileage, buy_date, description, remark, serve_type,
validate_status, validate_info, del_flag, created_date, created_by, updated_date,
updated_by
...
...
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