Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
qianhe-ydsj
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangyun
qianhe-ydsj
Commits
11cc4a7e
Commit
11cc4a7e
authored
Mar 26, 2026
by
MMF
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MMF 2026-03-26 评委填报导入
parent
5777aeb4
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
130 additions
and
0 deletions
+130
-0
qianhe-ydsj/src/main/java/com/qianhe/zqcz/pftb/controller/ZqczPftbController.java
+18
-0
qianhe-ydsj/src/main/java/com/qianhe/zqcz/pftb/domain/ZqczPftb.java
+12
-0
qianhe-ydsj/src/main/java/com/qianhe/zqcz/pftb/mapper/ZqczPftbMapper.java
+5
-0
qianhe-ydsj/src/main/java/com/qianhe/zqcz/pftb/service/ZqczPftbService.java
+6
-0
qianhe-ydsj/src/main/java/com/qianhe/zqcz/pftb/service/impl/ZqczPftbServiceImpl.java
+74
-0
qianhe-ydsj/src/main/resources/mapper/zqcz/pftb/ZqczPftbMapper.xml
+15
-0
No files found.
qianhe-ydsj/src/main/java/com/qianhe/zqcz/pftb/controller/ZqczPftbController.java
View file @
11cc4a7e
...
...
@@ -11,6 +11,7 @@ import com.qianhe.zqcz.pftb.service.ZqczPftbService;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
...
...
@@ -59,4 +60,21 @@ public class ZqczPftbController extends BaseController {
public
void
export
(
HttpServletResponse
response
,
ZqczPftbQuery
zqczPftbQuery
)
{
zqczPftbService
.
export
(
response
,
zqczPftbQuery
);
}
/**
* 导入
*/
@PostMapping
(
"/import"
)
public
AjaxResult
importExcel
(
@RequestParam
(
"zsrwid"
)
Long
zsrwid
,
@RequestParam
(
"jcrwid"
)
Long
jcrwid
,
@RequestParam
(
"file"
)
MultipartFile
file
)
{
try
{
int
count
=
zqczPftbService
.
importExcel
(
zsrwid
,
jcrwid
,
file
);
return
success
(
"导入成功,共导入 "
+
count
+
" 条数据"
);
}
catch
(
BusinessException
e
)
{
log
.
warn
(
"最强操作-评分导入失败:"
+
e
.
getMessage
());
return
warn
(
e
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
"最强操作-评分导入失败:"
+
e
.
getMessage
());
return
error
(
e
.
getMessage
());
}
}
}
qianhe-ydsj/src/main/java/com/qianhe/zqcz/pftb/domain/ZqczPftb.java
View file @
11cc4a7e
...
...
@@ -2,6 +2,7 @@ package com.qianhe.zqcz.pftb.domain;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.qianhe.common.core.domain.BaseEntity
;
import
com.qianhe.common.utils.SecurityUtils
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
...
...
@@ -82,4 +83,15 @@ public class ZqczPftb extends BaseEntity {
* 预留5
*/
private
String
yl5
;
public
ZqczPftb
(
Long
xmryid
,
Long
pwid
,
Long
zsrwid
,
Long
jcrwid
,
BigDecimal
khdf
){
this
.
xmryid
=
xmryid
;
this
.
pwid
=
pwid
;
this
.
zsrwid
=
zsrwid
;
this
.
jcrwid
=
jcrwid
;
this
.
khdf
=
khdf
;
this
.
create_by
=
SecurityUtils
.
getLoginUser
().
getUsername
();
// 当前用户
this
.
update_by
=
SecurityUtils
.
getLoginUser
().
getUsername
();
this
.
create_time
=
new
Date
();
}
}
qianhe-ydsj/src/main/java/com/qianhe/zqcz/pftb/mapper/ZqczPftbMapper.java
View file @
11cc4a7e
...
...
@@ -21,6 +21,11 @@ public interface ZqczPftbMapper {
int
add
(
ZqczPftb
zqczPftb
);
/**
* 批量操作
*/
int
batchAdd
(
List
<
ZqczPftb
>
dataList
);
/**
* 根据基层任务ID删除
*/
int
deleteByJcrwid
(
@Param
(
"jcrwid"
)
Long
jcrwid
);
...
...
qianhe-ydsj/src/main/java/com/qianhe/zqcz/pftb/service/ZqczPftbService.java
View file @
11cc4a7e
...
...
@@ -3,6 +3,7 @@ package com.qianhe.zqcz.pftb.service;
import
com.qianhe.zqcz.pftb.domain.ZqczPftb
;
import
com.qianhe.zqcz.pftb.domain.ZqczPftbQuery
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
...
...
@@ -28,4 +29,9 @@ public interface ZqczPftbService {
* 导出
*/
void
export
(
HttpServletResponse
response
,
ZqczPftbQuery
zqczPftbQuery
);
/**
* 导入
*/
int
importExcel
(
Long
zsrwid
,
Long
jcrwid
,
MultipartFile
file
);
}
qianhe-ydsj/src/main/java/com/qianhe/zqcz/pftb/service/impl/ZqczPftbServiceImpl.java
View file @
11cc4a7e
...
...
@@ -3,6 +3,10 @@ package com.qianhe.zqcz.pftb.service.impl;
import
com.qianhe.common.enums.zqcz.ZqczXmlbEnum
;
import
com.qianhe.common.exception.BusinessException
;
import
com.qianhe.common.utils.MtTimeUtil
;
import
com.qianhe.common.utils.SecurityUtils
;
import
com.qianhe.common.utils.StringUtils
;
import
com.qianhe.domain.ExcelCellConfig
;
import
com.qianhe.util.MtExcelImportUtils
;
import
com.qianhe.zqcz.jcdw.mapper.ZqczJcdwMapper
;
import
com.qianhe.zqcz.jcrw.domain.ZqczJcrwVo
;
import
com.qianhe.zqcz.pftb.domain.ZqczPftb
;
...
...
@@ -20,10 +24,12 @@ import org.apache.poi.ss.util.CellRangeAddress;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.net.URLEncoder
;
import
java.time.LocalDateTime
;
import
java.util.*
;
...
...
@@ -167,6 +173,74 @@ public class ZqczPftbServiceImpl implements ZqczPftbService {
}
/**
* 导入
*/
@Override
public
int
importExcel
(
Long
zsrwid
,
Long
jcrwid
,
MultipartFile
file
)
{
if
(
zsrwid
==
null
)
{
throw
new
BusinessException
(
"直属任务ID不能为空"
);
}
if
(
jcrwid
==
null
)
{
throw
new
BusinessException
(
"基层任务ID不能为空"
);
}
if
(
file
==
null
)
{
throw
new
BusinessException
(
"文件不能为空"
);
}
// 查询评委信息
List
<
ZqczPwxxVo
>
pwxxList
=
zqczPwxxMapper
.
list
(
ZqczPwxxQuery
.
builder
().
jcrwid
(
jcrwid
).
build
());
if
(
Optional
.
ofNullable
(
pwxxList
).
orElse
(
Collections
.
emptyList
()).
isEmpty
())
{
throw
new
BusinessException
(
"评委信息未填报"
);
}
// 定义通用校验规则
List
<
ExcelCellConfig
>
cellConfigs
=
new
ArrayList
<>();
cellConfigs
.
add
(
new
ExcelCellConfig
(
0
,
"固定字段(别删)"
,
true
));
// 固定字段(别删)(A列)
cellConfigs
.
add
(
new
ExcelCellConfig
(
1
,
"时间"
,
true
));
// 时间(B列)
cellConfigs
.
add
(
new
ExcelCellConfig
(
2
,
"基层单位名称"
,
true
));
// 基层单位名称(C列)
cellConfigs
.
add
(
new
ExcelCellConfig
(
3
,
"班站名称"
,
true
));
// 班站名称(D列)
cellConfigs
.
add
(
new
ExcelCellConfig
(
4
,
"项目类别"
,
true
));
// 项目类别(E列)
cellConfigs
.
add
(
new
ExcelCellConfig
(
5
,
"盲抽人员姓名"
,
true
));
// 盲抽人员姓名(F列)
cellConfigs
.
add
(
new
ExcelCellConfig
(
6
,
"盲抽项目名称"
,
true
));
// 盲抽项目名称(G列)
for
(
int
i
=
0
;
i
<
pwxxList
.
size
();
i
++)
{
cellConfigs
.
add
(
new
ExcelCellConfig
(
6
+
(
i
+
1
),
String
.
format
(
"评委%s分数(%s)"
,
(
i
+
1
),
pwxxList
.
get
(
i
).
getPwmc
()),
false
));
// 评委信息
}
cellConfigs
.
add
(
new
ExcelCellConfig
(
6
+
pwxxList
.
size
()
+
1
,
"得分(平均)"
,
false
));
// 得分(平均)
cellConfigs
.
add
(
new
ExcelCellConfig
(
6
+
pwxxList
.
size
()
+
2
,
"存在问题"
,
false
));
// 存在问题
return
MtExcelImportUtils
.
importXlsx
(
file
,
true
,
(
i
,
row
)
->
{
List
<
ZqczPftb
>
dataList
=
new
ArrayList
<>();
if
(
i
>
2
)
{
Map
<
String
,
String
>
cellValueMap
=
MtExcelImportUtils
.
parseAndValidateCells
(
row
,
i
,
cellConfigs
);
String
xmryidStr
=
cellValueMap
.
get
(
"固定字段(别删)"
);
// 获取项目人员ID
Long
xmryid
=
Long
.
valueOf
(
xmryidStr
);
for
(
int
j
=
0
;
j
<
pwxxList
.
size
();
j
++)
{
Long
pwid
=
pwxxList
.
get
(
j
).
getPwid
();
String
pwmc
=
pwxxList
.
get
(
j
).
getPwmc
();
String
khdfStr
=
cellValueMap
.
get
(
String
.
format
(
"评委%s分数(%s)"
,
j
+
1
,
pwmc
));
// 获取评委信息
BigDecimal
khdf
=
null
;
if
(
StringUtils
.
isNotEmpty
(
khdfStr
))
{
khdf
=
new
BigDecimal
(
khdfStr
);
}
dataList
.
add
(
new
ZqczPftb
(
xmryid
,
pwid
,
zsrwid
,
jcrwid
,
khdf
));
}
}
return
dataList
;
},
dataList
->
{
List
<
ZqczPftb
>
finalList
=
Optional
.
ofNullable
(
dataList
)
.
orElseGet
(
Collections:
:
emptyList
)
.
stream
()
.
filter
(
Objects:
:
nonNull
)
.
flatMap
(
Collection:
:
stream
)
.
collect
(
Collectors
.
toList
());
// 数据扁平化
zqczPftbMapper
.
batchAdd
(
finalList
);
});
}
/**
* 创建大标题
*/
private
void
createMainTitle
(
Workbook
workbook
,
Sheet
sheet
,
Integer
lastCol
)
{
...
...
qianhe-ydsj/src/main/resources/mapper/zqcz/pftb/ZqczPftbMapper.xml
View file @
11cc4a7e
...
...
@@ -55,4 +55,18 @@
<delete
id=
"deleteByJcrwid"
parameterType=
"long"
>
DELETE FROM zqcz_pftb WHERE JCRWID = #{jcrwid}
</delete>
<!-- 批量新增修改 -->
<insert
id=
"batchAdd"
parameterType=
"java.util.List"
>
REPLACE INTO zqcz_pftb (
XMRYID, PWID, ZSRWID, JCRWID, KHDF,
CREATE_BY, CREATE_TIME, UPDATE_BY, REMARK,
YL1, YL2, YL3, YL4, YL5, UPDATE_TIME
)
VALUES
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(#{item.xmryid}, #{item.pwid}, #{item.zsrwid}, #{item.jcrwid}, #{item.khdf},
#{item.create_by}, #{item.create_time}, #{item.update_by}, #{item.remark},
#{item.yl1}, #{item.yl2}, #{item.yl3}, #{item.yl4}, #{item.yl5}, now())
</foreach>
</insert>
</mapper>
\ No newline at end of file
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