Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vehicle-quality-review
Project
Project
Details
Activity
Releases
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
王飞
vehicle-quality-review
Commits
9b53c3ff
Commit
9b53c3ff
authored
May 14, 2024
by
wdy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://gitlab.91isoft.com:90/wangfei/vehicle-quality-review
into wangdingyi
parents
95e1cead
52ad5508
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
193 additions
and
3 deletions
+193
-3
EnterpriseImportFileVO.java
...main/java/com/ruoyi/domain/vo/EnterpriseImportFileVO.java
+88
-0
ReviewEnterpriseArchiveMapper.java
.../java/com/ruoyi/mapper/ReviewEnterpriseArchiveMapper.java
+4
-0
ReviewEnterpriseArchiveService.java
...ava/com/ruoyi/service/ReviewEnterpriseArchiveService.java
+6
-0
ReviewEnterpriseArchiveServiceImpl.java
...uoyi/service/impl/ReviewEnterpriseArchiveServiceImpl.java
+25
-0
ReviewEnterpriseArchiveController.java
...java/com/ruoyi/web/ReviewEnterpriseArchiveController.java
+28
-0
ImportEnterpriseRequest.java
...n/java/com/ruoyi/web/request/ImportEnterpriseRequest.java
+17
-0
ReviewEnterpriseArchiveMapper.xml
...c/main/resources/mapper/ReviewEnterpriseArchiveMapper.xml
+7
-0
ExcelUtil.java
...n/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
+18
-3
No files found.
quality-review/src/main/java/com/ruoyi/domain/vo/EnterpriseImportFileVO.java
0 → 100644
View file @
9b53c3ff
package
com
.
ruoyi
.
domain
.
vo
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.ruoyi.common.annotation.Excel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
@Data
@TableName
(
value
=
"t_review_enterprise_archive"
)
@ApiModel
(
"企业文件导入"
)
public
class
EnterpriseImportFileVO
{
@ApiModelProperty
(
"主键"
)
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
)
private
Long
id
;
/**
* 企业名称
*/
@Excel
(
name
=
"所属车企"
,
sort
=
1
)
@ApiModelProperty
(
"所属车企名称"
)
private
String
enterpriseName
;
/**
* 文件名称
*/
@Excel
(
name
=
"文件名称"
,
sort
=
2
)
@ApiModelProperty
(
"文件名称"
)
private
String
fileName
;
/**
* 文件版本
*/
@Excel
(
name
=
"文件版本"
,
sort
=
3
)
@ApiModelProperty
(
"文件版本"
)
private
String
version
;
/**
* 发布日期
*/
@Excel
(
name
=
"发布日期"
,
sort
=
4
,
dateFormat
=
"yyyy-MM-dd"
)
@ApiModelProperty
(
"发布日期"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
publishDate
;
/**
* 文件状态
*/
@Excel
(
name
=
"文件状态"
,
sort
=
5
,
readConverterExp
=
"0=现行有效,1=失效"
)
@ApiModelProperty
(
"文件状态"
)
private
String
status
;
/**
* 文件识别号
*/
@Excel
(
name
=
"文件识别号"
,
sort
=
7
)
@ApiModelProperty
(
"文件识别号"
)
private
String
identifyNumber
;
/**
* 存储位置
*/
@Excel
(
name
=
"存储位置"
,
sort
=
6
)
@ApiModelProperty
(
"存储位置"
)
private
String
storage
;
/**
* 关联到任务id
*/
@ApiModelProperty
(
"关联到任务id"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
)
private
Long
taskId
;
@ApiModelProperty
(
"创建人"
)
private
String
createBy
;
@ApiModelProperty
(
"创建时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
}
quality-review/src/main/java/com/ruoyi/mapper/ReviewEnterpriseArchiveMapper.java
View file @
9b53c3ff
...
@@ -2,6 +2,7 @@ package com.ruoyi.mapper;
...
@@ -2,6 +2,7 @@ package com.ruoyi.mapper;
import
com.ruoyi.domain.ReviewEnterpriseArchive
;
import
com.ruoyi.domain.ReviewEnterpriseArchive
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.ruoyi.domain.vo.EnterpriseImportFileVO
;
import
com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewItemVO
;
import
com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewItemVO
;
import
com.ruoyi.web.request.ReviewEnterpriseArchiveFindByTaskIdRequest
;
import
com.ruoyi.web.request.ReviewEnterpriseArchiveFindByTaskIdRequest
;
import
com.ruoyi.web.request.ReviewEnterpriseArchiveFindRequest
;
import
com.ruoyi.web.request.ReviewEnterpriseArchiveFindRequest
;
...
@@ -33,6 +34,9 @@ public interface ReviewEnterpriseArchiveMapper extends BaseMapper<ReviewEnterpri
...
@@ -33,6 +34,9 @@ public interface ReviewEnterpriseArchiveMapper extends BaseMapper<ReviewEnterpri
List
<
ReviewEnterpriseArchive
>
findList
(
@Param
(
"taskId"
)
Long
taskId
);
List
<
ReviewEnterpriseArchive
>
findList
(
@Param
(
"taskId"
)
Long
taskId
);
List
<
ReviewEnterpriseArchive
>
findEnterpriseArchiveByTaskId
(
ReviewEnterpriseArchiveFindByTaskIdRequest
request
);
List
<
ReviewEnterpriseArchive
>
findEnterpriseArchiveByTaskId
(
ReviewEnterpriseArchiveFindByTaskIdRequest
request
);
// 批量新增车企文件
public
int
insertEnterprise
(
List
<
EnterpriseImportFileVO
>
list
);
}
}
...
...
quality-review/src/main/java/com/ruoyi/service/ReviewEnterpriseArchiveService.java
View file @
9b53c3ff
...
@@ -2,6 +2,7 @@ package com.ruoyi.service;
...
@@ -2,6 +2,7 @@ package com.ruoyi.service;
import
com.ruoyi.domain.ReviewEnterpriseArchive
;
import
com.ruoyi.domain.ReviewEnterpriseArchive
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.ruoyi.domain.vo.EnterpriseImportFileVO
;
import
com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO
;
import
com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO
;
import
com.ruoyi.web.request.ReviewEnterpriseArchiveFindByTaskIdRequest
;
import
com.ruoyi.web.request.ReviewEnterpriseArchiveFindByTaskIdRequest
;
import
com.ruoyi.web.request.ReviewEnterpriseArchiveFindFileNameListRequest
;
import
com.ruoyi.web.request.ReviewEnterpriseArchiveFindFileNameListRequest
;
...
@@ -9,6 +10,7 @@ import com.ruoyi.web.request.ReviewEnterpriseArchiveFindRequest;
...
@@ -9,6 +10,7 @@ import com.ruoyi.web.request.ReviewEnterpriseArchiveFindRequest;
import
com.ruoyi.web.request.ReviewEnterpriseArchiveGetInfoRequest
;
import
com.ruoyi.web.request.ReviewEnterpriseArchiveGetInfoRequest
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -39,4 +41,8 @@ public interface ReviewEnterpriseArchiveService extends IService<ReviewEnterpris
...
@@ -39,4 +41,8 @@ public interface ReviewEnterpriseArchiveService extends IService<ReviewEnterpris
List
<
ReviewEnterpriseArchive
>
findList
(
ReviewEnterpriseArchiveFindFileNameListRequest
request
);
List
<
ReviewEnterpriseArchive
>
findList
(
ReviewEnterpriseArchiveFindFileNameListRequest
request
);
List
<
ReviewEnterpriseArchive
>
findEnterpriseArchiveByTaskId
(
ReviewEnterpriseArchiveFindByTaskIdRequest
request
);
List
<
ReviewEnterpriseArchive
>
findEnterpriseArchiveByTaskId
(
ReviewEnterpriseArchiveFindByTaskIdRequest
request
);
// 导入车企文件
void
importEnterprise
(
List
<
EnterpriseImportFileVO
>
list
,
Long
taskId
,
HttpServletResponse
response
);
}
}
quality-review/src/main/java/com/ruoyi/service/impl/ReviewEnterpriseArchiveServiceImpl.java
View file @
9b53c3ff
package
com
.
ruoyi
.
service
.
impl
;
package
com
.
ruoyi
.
service
.
impl
;
import
cn.hutool.core.util.IdUtil
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.common.core.domain.model.LoginUser
;
import
com.ruoyi.common.core.domain.model.LoginUser
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.domain.ReviewEnterpriseArchive
;
import
com.ruoyi.domain.ReviewEnterpriseArchive
;
import
com.ruoyi.domain.Task
;
import
com.ruoyi.domain.Task
;
import
com.ruoyi.domain.vo.EnterpriseImportFileVO
;
import
com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewItemVO
;
import
com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewItemVO
;
import
com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO
;
import
com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO
;
import
com.ruoyi.mapper.TaskMapper
;
import
com.ruoyi.mapper.TaskMapper
;
...
@@ -21,8 +24,15 @@ import com.ruoyi.web.request.ReviewEnterpriseArchiveGetInfoRequest;
...
@@ -21,8 +24,15 @@ import com.ruoyi.web.request.ReviewEnterpriseArchiveGetInfoRequest;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.*
;
import
java.util.*
;
import
static
com
.
ruoyi
.
common
.
utils
.
DateUtils
.
getNowDate
;
/**
/**
* @author wangfei
* @author wangfei
* @description 针对表【t_review_enterprise_archive(车企留档文件)】的数据库操作Service实现
* @description 针对表【t_review_enterprise_archive(车企留档文件)】的数据库操作Service实现
...
@@ -206,6 +216,21 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp
...
@@ -206,6 +216,21 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp
view
.
setItems
(
subList
);
view
.
setItems
(
subList
);
}
}
@Override
public
void
importEnterprise
(
List
<
EnterpriseImportFileVO
>
list
,
Long
taskId
,
HttpServletResponse
response
){
for
(
EnterpriseImportFileVO
vo:
list
){
vo
.
setCreateTime
(
getNowDate
());
vo
.
setCreateBy
(
SecurityUtils
.
getLoginUser
().
getUser
().
getNickName
());
vo
.
setTaskId
(
Long
.
valueOf
(
taskId
));
vo
.
setId
(
IdUtil
.
getSnowflake
().
nextId
());
Long
sum
=
reviewEnterpriseArchiveMapper
.
findFileName
(
Long
.
valueOf
(
taskId
),
vo
.
getFileName
());
if
(
sum
>
0
)
{
throw
new
ServiceException
(
"新增文件名称重复,请检查"
,
HttpStatus
.
ERROR
);
}
}
reviewEnterpriseArchiveMapper
.
insertEnterprise
(
list
);
}
}
}
...
...
quality-review/src/main/java/com/ruoyi/web/ReviewEnterpriseArchiveController.java
View file @
9b53c3ff
package
com
.
ruoyi
.
web
;
package
com
.
ruoyi
.
web
;
import
com.google.common.collect.Lists
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.R
;
import
com.ruoyi.common.core.domain.R
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.domain.ReviewEnterpriseArchive
;
import
com.ruoyi.domain.ReviewEnterpriseArchive
;
import
com.ruoyi.domain.vo.EnterpriseImportFileVO
;
import
com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO
;
import
com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO
;
import
com.ruoyi.service.ReviewEnterpriseArchiveService
;
import
com.ruoyi.service.ReviewEnterpriseArchiveService
;
import
com.ruoyi.web.request.*
;
import
com.ruoyi.web.request.*
;
...
@@ -22,6 +25,12 @@ import org.springframework.web.bind.annotation.RequestBody;
...
@@ -22,6 +25,12 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.List
;
@Api
(
tags
=
"车企文件"
)
@Api
(
tags
=
"车企文件"
)
@RestController
@RestController
...
@@ -95,4 +104,23 @@ public class ReviewEnterpriseArchiveController extends BaseController {
...
@@ -95,4 +104,23 @@ public class ReviewEnterpriseArchiveController extends BaseController {
return
getDataTable
(
reviewEnterpriseArchiveService
.
view
(
request
.
getTaskId
()));
return
getDataTable
(
reviewEnterpriseArchiveService
.
view
(
request
.
getTaskId
()));
}
}
@ApiOperation
(
"车企文件导入模板下载"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/importDownload"
)
public
R
<
String
>
EnterpriseFileDownload
(
HttpServletResponse
response
)
throws
Exception
{
ExcelUtil
<
EnterpriseImportFileVO
>
util
=
new
ExcelUtil
<>(
EnterpriseImportFileVO
.
class
);
ExcelUtil
.
setCombo
(
EnterpriseImportFileVO
.
class
,
"status"
,
Lists
.
newArrayList
(
"现行有效"
,
"已失效"
));
return
R
.
ok
();
}
@ApiOperation
(
"车企文件导入"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/importExcel"
)
public
R
<
String
>
importEnterprise
(
HttpServletResponse
response
,
ImportEnterpriseRequest
request
)
throws
IOException
{
ExcelUtil
<
EnterpriseImportFileVO
>
util
=
new
ExcelUtil
<>(
EnterpriseImportFileVO
.
class
);
List
<
EnterpriseImportFileVO
>
list
=
util
.
importExcel
(
request
.
getFile
().
getInputStream
());
reviewEnterpriseArchiveService
.
importEnterprise
(
list
,
request
.
getTaskId
(),
response
);
return
R
.
ok
();
}
}
}
quality-review/src/main/java/com/ruoyi/web/request/ImportEnterpriseRequest.java
0 → 100644
View file @
9b53c3ff
package
com
.
ruoyi
.
web
.
request
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.web.multipart.MultipartFile
;
@Data
public
class
ImportEnterpriseRequest
{
@ApiModelProperty
(
"文件"
)
MultipartFile
file
;
@ApiModelProperty
(
"任务id"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
)
private
Long
taskId
;
}
quality-review/src/main/resources/mapper/ReviewEnterpriseArchiveMapper.xml
View file @
9b53c3ff
...
@@ -82,4 +82,11 @@
...
@@ -82,4 +82,11 @@
</if>
</if>
</where>
</where>
</select>
</select>
<insert
id=
"insertEnterprise"
parameterType=
"java.util.List"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into t_review_enterprise_archive(id,enterprise_name,file_name,version,publish_date,status,identify_number,storage,task_id,create_by,create_time)values
<foreach
item=
"item"
index=
"index"
collection=
"list"
separator=
","
>
(#{item.id},#{item.enterpriseName},#{item.fileName},#{item.version},#{item.publishDate},#{item.status},#{item.identifyNumber},#{item.storage},#{item.taskId},#{item.createBy},#{item.createTime})
</foreach>
</insert>
</mapper>
</mapper>
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
View file @
9b53c3ff
...
@@ -5,9 +5,7 @@ import java.io.FileOutputStream;
...
@@ -5,9 +5,7 @@ import java.io.FileOutputStream;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.*
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.ParameterizedType
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
...
@@ -1755,4 +1753,21 @@ public class ExcelUtil<T>
...
@@ -1755,4 +1753,21 @@ public class ExcelUtil<T>
}
}
return
method
;
return
method
;
}
}
/**给combo赋值*/
public
static
void
setCombo
(
Class
<?>
clazz
,
String
param
,
List
<
String
>
list
)
throws
Exception
{
// 通过反射 获取目标实体类的属性成员-即办公室号号字段
Field
file
=
clazz
.
getDeclaredField
(
param
);
// 获取该字段的上叫Excel的注解
Excel
annotation
=
file
.
getAnnotation
(
Excel
.
class
);
InvocationHandler
h
=
Proxy
.
getInvocationHandler
(
annotation
);
Field
hField
=
h
.
getClass
().
getDeclaredField
(
"memberValues"
);
// 设置私有可访问
hField
.
setAccessible
(
true
);
Map
memberValues
=
(
Map
)
hField
.
get
(
h
);
// 集合转数组
String
[]
combo
=
list
.
toArray
(
new
String
[
list
.
size
()]);
// 修改属性值
memberValues
.
put
(
"combo"
,
combo
);
}
}
}
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