Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
tasktime
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
任建彩
tasktime
Commits
c7ebce2c
提交
c7ebce2c
authored
9月 10, 2021
作者:
任建彩
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
http://test16.zhongdianyun.com/renjiancai/tasktime.git
上级
44716688
f8e8451a
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
33 行增加
和
5 行删除
+33
-5
ImportExcelUtil.java
olive-console/src/main/java/com/utils/ImportExcelUtil.java
+23
-3
TaskDao.java
...nsole/src/main/java/com/zrqx/olive/ttask/dao/TaskDao.java
+1
-1
TaskServiceImpl.java
...ava/com/zrqx/olive/ttask/service/imp/TaskServiceImpl.java
+9
-1
没有找到文件。
olive-console/src/main/java/com/utils/ImportExcelUtil.java
浏览文件 @
c7ebce2c
...
@@ -544,7 +544,7 @@ public class ImportExcelUtil {
...
@@ -544,7 +544,7 @@ public class ImportExcelUtil {
* @throws BaseException
* @throws BaseException
* 如果文件不是Excel文件、目标对象不包含解析所需的参数设置或解析过程中发生错误,抛出该异常
* 如果文件不是Excel文件、目标对象不包含解析所需的参数设置或解析过程中发生错误,抛出该异常
*/
*/
public
static
<
T
>
List
<
T
>
importExcel
(
InputStream
excel
,
Class
<
T
>
targetClass
,
String
fileName
)
public
static
<
T
>
List
<
T
>
importExcel
(
InputStream
excel
,
Class
<
T
>
targetClass
,
String
fileName
,
Map
<
String
,
String
>
columnMap
)
throws
BaseException
{
throws
BaseException
{
if
(!
StringUtils
.
endsWithIgnoreCase
(
fileName
,
ExcelParseMode
.
XLS
)
if
(!
StringUtils
.
endsWithIgnoreCase
(
fileName
,
ExcelParseMode
.
XLS
)
&&
!
StringUtils
.
endsWithIgnoreCase
(
fileName
,
ExcelParseMode
.
XLSX
))
{
&&
!
StringUtils
.
endsWithIgnoreCase
(
fileName
,
ExcelParseMode
.
XLSX
))
{
...
@@ -628,10 +628,13 @@ public class ImportExcelUtil {
...
@@ -628,10 +628,13 @@ public class ImportExcelUtil {
// 如果最大行大于实际行数或小于0(小于0表示使用实际行数),则最大行使用实际行数
// 如果最大行大于实际行数或小于0(小于0表示使用实际行数),则最大行使用实际行数
// maxRow = sheet.getLastRowNum() + 1 < maxRow || maxRow < 0 ?
// maxRow = sheet.getLastRowNum() + 1 < maxRow || maxRow < 0 ?
// sheet.getLastRowNum() + 1 : maxRow;
// sheet.getLastRowNum() + 1 : maxRow;
int
q
=
0
;
// 遍历行
// 遍历行
// for(int i = minRow - 1; i < maxRow; i++){
// for(int i = minRow - 1; i < maxRow; i++){
//判断所有列的数据值
StringBuffer
buffer
=
new
StringBuffer
();
for
(
int
i
=
1
;
i
<
sheet
.
getLastRowNum
()
+
1
;
i
++)
{
for
(
int
i
=
1
;
i
<
sheet
.
getLastRowNum
()
+
1
;
i
++)
{
System
.
out
.
println
(
sheet
.
getLastRowNum
());
// 读取行
// 读取行
Row
row
=
sheet
.
getRow
(
i
);
Row
row
=
sheet
.
getRow
(
i
);
...
@@ -678,6 +681,7 @@ public class ImportExcelUtil {
...
@@ -678,6 +681,7 @@ public class ImportExcelUtil {
// 获取单元格
// 获取单元格
Cell
cell
=
row
.
getCell
(
j
);
Cell
cell
=
row
.
getCell
(
j
);
if
(
cell
==
null
)
{
if
(
cell
==
null
)
{
continue
;
continue
;
}
}
...
@@ -686,9 +690,23 @@ public class ImportExcelUtil {
...
@@ -686,9 +690,23 @@ public class ImportExcelUtil {
// if(fieldMap.containsKey(cell.getColumnIndex())){
// if(fieldMap.containsKey(cell.getColumnIndex())){
String
key
=
sheet
.
getRow
(
0
).
getCell
(
cell
.
getColumnIndex
()).
toString
().
trim
();
String
key
=
sheet
.
getRow
(
0
).
getCell
(
cell
.
getColumnIndex
()).
toString
().
trim
();
if
(
fieldMap
.
get
(
key
)
!=
null
)
{
if
(
fieldMap
.
get
(
key
)
!=
null
)
{
System
.
out
.
println
(
i
);
q
=
i
;
System
.
out
.
println
(++
q
);
System
.
out
.
println
(
key
);
Field
f
=
fieldMap
.
get
(
key
);
Field
f
=
fieldMap
.
get
(
key
);
System
.
out
.
println
(
f
.
getName
());
System
.
out
.
println
(
cell
.
getStringCellValue
());
f
.
setAccessible
(
true
);
f
.
setAccessible
(
true
);
try
{
try
{
//不能为空值的map
if
(
columnMap
.
get
(
f
.
getName
())
!=
null
)
{
if
(
StringUtils
.
isNotBlank
(
cell
.
getStringCellValue
()))
{
buffer
.
append
(++
q
+
f
.
getName
()
+
"不能为空 \n"
);
}
}
if
(
f
.
getType
()
==
String
.
class
)
{
if
(
f
.
getType
()
==
String
.
class
)
{
cell
.
setCellType
(
CellType
.
STRING
);
cell
.
setCellType
(
CellType
.
STRING
);
f
.
set
(
obj
,
cell
.
getStringCellValue
());
f
.
set
(
obj
,
cell
.
getStringCellValue
());
...
@@ -720,7 +738,9 @@ public class ImportExcelUtil {
...
@@ -720,7 +738,9 @@ public class ImportExcelUtil {
}*/
}*/
}
}
}
}
if
(
StringUtils
.
isNotBlank
(
buffer
))
{
throw
new
BaseException
(
3
,
buffer
.
toString
()
);
}
return
objectList
;
return
objectList
;
}
}
...
...
olive-console/src/main/java/com/zrqx/olive/ttask/dao/TaskDao.java
浏览文件 @
c7ebce2c
...
@@ -65,7 +65,7 @@ public interface TaskDao extends BaseMapper<Task> {
...
@@ -65,7 +65,7 @@ public interface TaskDao extends BaseMapper<Task> {
+
" AND task_status != 0 "
+
" AND task_status != 0 "
+
"</if>"
+
"</if>"
+
"<if test = 'request.taskStatus == 5'> "
+
"<if test = 'request.taskStatus == 5'> "
+
" AND complete
Time()
> #{request.endTime} "
+
" AND complete
_Time
> #{request.endTime} "
+
"</if>"
+
"</if>"
+
"<if test = 'request.taskStatus == 1'> "
+
"<if test = 'request.taskStatus == 1'> "
+
" AND task_status = #{request.taskStatus} "
+
" AND task_status = #{request.taskStatus} "
...
...
olive-console/src/main/java/com/zrqx/olive/ttask/service/imp/TaskServiceImpl.java
浏览文件 @
c7ebce2c
...
@@ -47,10 +47,13 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -47,10 +47,13 @@ import org.springframework.web.multipart.MultipartFile;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.lang.reflect.Field
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.Optional
;
import
static
com
.
constants
.
Constants
.
ARTICLE_BANNER_LIMIT
;
import
static
com
.
constants
.
Constants
.
ARTICLE_BANNER_LIMIT
;
...
@@ -110,8 +113,13 @@ public class TaskServiceImpl extends ServiceImpl<TaskDao, Task> implements TaskS
...
@@ -110,8 +113,13 @@ public class TaskServiceImpl extends ServiceImpl<TaskDao, Task> implements TaskS
@Override
@Override
public
CommonResult
<
Object
>
imporTask
(
MultipartFile
file
,
TaskForm
taskRequest
)
throws
BaseException
,
IOException
{
public
CommonResult
<
Object
>
imporTask
(
MultipartFile
file
,
TaskForm
taskRequest
)
throws
BaseException
,
IOException
{
Map
<
String
,
String
>
columnMap
=
new
HashMap
<
String
,
String
>();
columnMap
.
put
(
"moduleName"
,
"moduleName"
);
columnMap
.
put
(
"taskName"
,
"taskName"
);
columnMap
.
put
(
"hours"
,
"hours"
);
List
<
ExcelTaskVo
>
list
=
ImportExcelUtil
.
importExcel
(
file
.
getInputStream
(),
ExcelTaskVo
.
class
,
List
<
ExcelTaskVo
>
list
=
ImportExcelUtil
.
importExcel
(
file
.
getInputStream
(),
ExcelTaskVo
.
class
,
file
.
getOriginalFilename
());
file
.
getOriginalFilename
()
,
columnMap
);
for
(
ExcelTaskVo
excelTaskVo
:
list
)
{
for
(
ExcelTaskVo
excelTaskVo
:
list
)
{
// 处理项目工时
// 处理项目工时
QueryWrapper
<
Team
>
qw1
=
new
QueryWrapper
<>();
QueryWrapper
<
Team
>
qw1
=
new
QueryWrapper
<>();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论