Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
klck
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
位宇华
klck
Commits
3af37f72
Commit
3af37f72
authored
Jun 28, 2024
by
刘_震
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
电力汇总(表格的导入以及特殊表的处理)
parent
81576a99
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
1837 additions
and
0 deletions
+1837
-0
ruoyi-wages/src/main/java/com/ruoyi/system/controller/PowerWagesController.java
...ava/com/ruoyi/system/controller/PowerWagesController.java
+74
-0
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/PowerWagesComMapper.java
...ain/java/com/ruoyi/system/mapper/PowerWagesComMapper.java
+25
-0
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/PowerWagesDeMapper.java
...main/java/com/ruoyi/system/mapper/PowerWagesDeMapper.java
+20
-0
ruoyi-wages/src/main/java/com/ruoyi/system/model/wages/dao/Power.java
...src/main/java/com/ruoyi/system/model/wages/dao/Power.java
+107
-0
ruoyi-wages/src/main/java/com/ruoyi/system/model/wages/dao/PowerDAO.java
.../main/java/com/ruoyi/system/model/wages/dao/PowerDAO.java
+23
-0
ruoyi-wages/src/main/java/com/ruoyi/system/model/wages/dao/PowerWagesComparation.java
...m/ruoyi/system/model/wages/dao/PowerWagesComparation.java
+299
-0
ruoyi-wages/src/main/java/com/ruoyi/system/model/wages/dao/PowerWagesDetails.java
...a/com/ruoyi/system/model/wages/dao/PowerWagesDetails.java
+297
-0
ruoyi-wages/src/main/java/com/ruoyi/system/service/PowerWagesService.java
...main/java/com/ruoyi/system/service/PowerWagesService.java
+18
-0
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/PowerWagesServiceImpl.java
.../com/ruoyi/system/service/impl/PowerWagesServiceImpl.java
+142
-0
ruoyi-wages/src/main/resources/mapper/system/PowerWagesComMapper.xml
.../src/main/resources/mapper/system/PowerWagesComMapper.xml
+354
-0
ruoyi-wages/src/main/resources/mapper/system/PowerWagesDeMapper.xml
...s/src/main/resources/mapper/system/PowerWagesDeMapper.xml
+478
-0
No files found.
ruoyi-wages/src/main/java/com/ruoyi/system/controller/PowerWagesController.java
0 → 100644
View file @
3af37f72
package
com.ruoyi.system.controller
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.system.model.wages.dao.PowerDAO
;
import
com.ruoyi.system.service.PowerWagesService
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
/**
* @author haiwe
* @date 2024/6/26
*/
@RestController
@RequestMapping
(
"/power"
)
@RequiredArgsConstructor
public
class
PowerWagesController
{
private
final
PowerWagesService
powerWagesService
;
/**
* 导入详细表数据
* @param file 文件
* @return 无返回值
*/
@PostMapping
(
"/dExcel"
)
public
AjaxResult
readDExcel
(
@RequestParam
(
"file"
)
MultipartFile
file
,
String
date
,
String
mineId
)
{
Boolean
analyzed
=
powerWagesService
.
readDExcel
(
file
,
date
,
mineId
);
if
(!
analyzed
)
{
return
AjaxResult
.
error
(
"解析失败"
);
}
else
{
return
AjaxResult
.
success
();
}
}
/**
* 读取对照表数据
* @param file
* @param date
* @param mineId
* @return
*/
@PostMapping
(
"/cExcel"
)
public
AjaxResult
readCExcel
(
@RequestParam
(
"file"
)
MultipartFile
file
,
String
date
,
String
mineId
,
String
type
)
{
Boolean
analyzed
=
powerWagesService
.
readCExcel
(
file
,
date
,
mineId
,
type
);
if
(!
analyzed
)
{
return
AjaxResult
.
error
(
"解析失败"
);
}
else
{
return
AjaxResult
.
success
();
}
}
/**
* 特殊表处理-填写数据
* @param dao
* @return
*/
@PostMapping
public
AjaxResult
add
(
@RequestBody
PowerDAO
dao
){
powerWagesService
.
add
(
dao
);
return
AjaxResult
.
success
();
}
}
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/PowerWagesComMapper.java
0 → 100644
View file @
3af37f72
package
com.ruoyi.system.mapper
;
import
com.ruoyi.system.model.wages.dao.Power
;
import
com.ruoyi.system.model.wages.dao.PowerWagesComparation
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* @author haiwe
* @date 2024/6/26
*/
public
interface
PowerWagesComMapper
{
void
insertBatch
(
PowerWagesComparation
comparation
);
PowerWagesComparation
select
(
@Param
(
"type"
)
String
type
,
@Param
(
"date"
)
String
importTime
,
@Param
(
"mineId"
)
String
mineId
);
void
add
(
@Param
(
"accList"
)
List
<
Power
>
powerDetails
,
@Param
(
"mineId"
)
String
mineId
,
@Param
(
"importTime"
)
String
importTime
,
@Param
(
"type"
)
String
type
);
}
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/PowerWagesDeMapper.java
0 → 100644
View file @
3af37f72
package
com.ruoyi.system.mapper
;
import
com.ruoyi.system.model.wages.dao.Power
;
import
com.ruoyi.system.model.wages.dao.PowerWagesDetails
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* @author haiwe
* @date 2024/6/26
*/
public
interface
PowerWagesDeMapper
{
void
insertBatch
(
@Param
(
"accList"
)
List
<
PowerWagesDetails
>
powerList
,
@Param
(
"mineId"
)
String
mineId
,
@Param
(
"date"
)
String
date
);
void
add
(
@Param
(
"accList"
)
List
<
Power
>
powerDetails
,
@Param
(
"comparisonId"
)
Integer
comparisonId
,
@Param
(
"importTime"
)
String
importTime
,
@Param
(
"mineId"
)
String
mineId
);
}
ruoyi-wages/src/main/java/com/ruoyi/system/model/wages/dao/Power.java
0 → 100644
View file @
3af37f72
package
com.ruoyi.system.model.wages.dao
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author haiwe
* @date 2024/6/27
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
Power
{
private
String
a1
;
private
String
a2
;
private
String
a3
;
private
String
a4
;
private
String
a5
;
private
String
a6
;
private
String
a7
;
private
String
a8
;
private
String
a9
;
private
String
a10
;
private
String
a11
;
private
String
a12
;
private
String
a13
;
private
String
a14
;
private
String
a15
;
private
String
a16
;
private
String
a17
;
private
String
a18
;
private
String
a19
;
private
String
a20
;
private
String
a21
;
private
String
a22
;
private
String
a23
;
private
String
a24
;
private
String
a25
;
private
String
a26
;
private
String
a27
;
private
String
a28
;
private
String
a29
;
private
String
a30
;
private
String
a31
;
private
String
a32
;
private
String
a33
;
private
String
a34
;
private
String
a35
;
private
String
a36
;
private
String
a37
;
private
String
a38
;
private
String
a39
;
private
String
a40
;
private
String
a41
;
private
String
a42
;
private
String
a43
;
private
String
a44
;
private
String
a45
;
private
String
a46
;
private
String
a47
;
private
String
a48
;
private
String
a49
;
private
String
a50
;
private
String
a51
;
private
String
a52
;
private
String
a53
;
private
String
a54
;
private
String
a55
;
private
String
a56
;
private
String
a57
;
private
String
a58
;
private
String
a59
;
private
String
a60
;
private
String
a61
;
private
String
a62
;
private
String
a63
;
private
String
a64
;
private
String
a65
;
private
String
a66
;
private
String
a67
;
private
String
a68
;
private
String
a69
;
private
String
a70
;
private
String
a71
;
private
String
a72
;
private
String
a73
;
private
String
a74
;
private
String
a75
;
private
String
a76
;
private
String
a77
;
private
String
a78
;
private
String
a79
;
private
String
a80
;
private
String
a81
;
private
String
a82
;
private
String
a83
;
private
String
a84
;
private
String
a85
;
private
String
a86
;
private
String
a87
;
private
String
a88
;
private
String
a89
;
private
String
a90
;
}
ruoyi-wages/src/main/java/com/ruoyi/system/model/wages/dao/PowerDAO.java
0 → 100644
View file @
3af37f72
package
com.ruoyi.system.model.wages.dao
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
/**
* @author haiwe
* @date 2024/6/28
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
PowerDAO
{
private
String
mineId
;
private
String
importTime
;
private
String
type
;
private
List
<
Power
>
powerDetails
;
}
ruoyi-wages/src/main/java/com/ruoyi/system/model/wages/dao/PowerWagesComparation.java
0 → 100644
View file @
3af37f72
package
com.ruoyi.system.model.wages.dao
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author haiwe
* @date 2024/6/5
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
PowerWagesComparation
{
private
int
comparisonId
;
@ExcelProperty
(
index
=
1
)
private
String
a1
;
@ExcelProperty
(
index
=
2
)
private
String
a2
;
@ExcelProperty
(
index
=
3
)
private
String
a3
;
@ExcelProperty
(
index
=
4
)
private
String
a4
;
@ExcelProperty
(
index
=
5
)
private
String
a5
;
@ExcelProperty
(
index
=
6
)
private
String
a6
;
@ExcelProperty
(
index
=
7
)
private
String
a7
;
@ExcelProperty
(
index
=
8
)
private
String
a8
;
@ExcelProperty
(
index
=
9
)
private
String
a9
;
@ExcelProperty
(
index
=
10
)
private
String
a10
;
@ExcelProperty
(
index
=
11
)
private
String
a11
;
@ExcelProperty
(
index
=
12
)
private
String
a12
;
@ExcelProperty
(
index
=
13
)
private
String
a13
;
@ExcelProperty
(
index
=
14
)
private
String
a14
;
@ExcelProperty
(
index
=
15
)
private
String
a15
;
@ExcelProperty
(
index
=
16
)
private
String
a16
;
@ExcelProperty
(
index
=
17
)
private
String
a17
;
@ExcelProperty
(
index
=
18
)
private
String
a18
;
@ExcelProperty
(
index
=
19
)
private
String
a19
;
@ExcelProperty
(
index
=
20
)
private
String
a20
;
@ExcelProperty
(
index
=
21
)
private
String
a21
;
@ExcelProperty
(
index
=
22
)
private
String
a22
;
@ExcelProperty
(
index
=
23
)
private
String
a23
;
@ExcelProperty
(
index
=
24
)
private
String
a24
;
@ExcelProperty
(
index
=
25
)
private
String
a25
;
@ExcelProperty
(
index
=
26
)
private
String
a26
;
@ExcelProperty
(
index
=
27
)
private
String
a27
;
@ExcelProperty
(
index
=
28
)
private
String
a28
;
@ExcelProperty
(
index
=
29
)
private
String
a29
;
@ExcelProperty
(
index
=
30
)
private
String
a30
;
@ExcelProperty
(
index
=
31
)
private
String
a31
;
@ExcelProperty
(
index
=
32
)
private
String
a32
;
@ExcelProperty
(
index
=
33
)
private
String
a33
;
@ExcelProperty
(
index
=
34
)
private
String
a34
;
@ExcelProperty
(
index
=
35
)
private
String
a35
;
@ExcelProperty
(
index
=
36
)
private
String
a36
;
@ExcelProperty
(
index
=
37
)
private
String
a37
;
@ExcelProperty
(
index
=
38
)
private
String
a38
;
@ExcelProperty
(
index
=
39
)
private
String
a39
;
@ExcelProperty
(
index
=
40
)
private
String
a40
;
@ExcelProperty
(
index
=
41
)
private
String
a41
;
@ExcelProperty
(
index
=
42
)
private
String
a42
;
@ExcelProperty
(
index
=
43
)
private
String
a43
;
@ExcelProperty
(
index
=
44
)
private
String
a44
;
@ExcelProperty
(
index
=
45
)
private
String
a45
;
@ExcelProperty
(
index
=
46
)
private
String
a46
;
@ExcelProperty
(
index
=
47
)
private
String
a47
;
@ExcelProperty
(
index
=
48
)
private
String
a48
;
@ExcelProperty
(
index
=
49
)
private
String
a49
;
@ExcelProperty
(
index
=
50
)
private
String
a50
;
@ExcelProperty
(
index
=
51
)
private
String
a51
;
@ExcelProperty
(
index
=
52
)
private
String
a52
;
@ExcelProperty
(
index
=
53
)
private
String
a53
;
@ExcelProperty
(
index
=
54
)
private
String
a54
;
@ExcelProperty
(
index
=
55
)
private
String
a55
;
@ExcelProperty
(
index
=
56
)
private
String
a56
;
@ExcelProperty
(
index
=
57
)
private
String
a57
;
@ExcelProperty
(
index
=
58
)
private
String
a58
;
@ExcelProperty
(
index
=
59
)
private
String
a59
;
@ExcelProperty
(
index
=
60
)
private
String
a60
;
@ExcelProperty
(
index
=
61
)
private
String
a61
;
@ExcelProperty
(
index
=
62
)
private
String
a62
;
@ExcelProperty
(
index
=
63
)
private
String
a63
;
@ExcelProperty
(
index
=
64
)
private
String
a64
;
@ExcelProperty
(
index
=
65
)
private
String
a65
;
@ExcelProperty
(
index
=
66
)
private
String
a66
;
@ExcelProperty
(
index
=
67
)
private
String
a67
;
@ExcelProperty
(
index
=
68
)
private
String
a68
;
@ExcelProperty
(
index
=
69
)
private
String
a69
;
@ExcelProperty
(
index
=
70
)
private
String
a70
;
@ExcelProperty
(
index
=
71
)
private
String
a71
;
@ExcelProperty
(
index
=
72
)
private
String
a72
;
@ExcelProperty
(
index
=
73
)
private
String
a73
;
@ExcelProperty
(
index
=
74
)
private
String
a74
;
@ExcelProperty
(
index
=
75
)
private
String
a75
;
@ExcelProperty
(
index
=
76
)
private
String
a76
;
@ExcelProperty
(
index
=
77
)
private
String
a77
;
@ExcelProperty
(
index
=
78
)
private
String
a78
;
@ExcelProperty
(
index
=
79
)
private
String
a79
;
@ExcelProperty
(
index
=
80
)
private
String
a80
;
@ExcelProperty
(
index
=
81
)
private
String
a81
;
@ExcelProperty
(
index
=
82
)
private
String
a82
;
@ExcelProperty
(
index
=
83
)
private
String
a83
;
@ExcelProperty
(
index
=
84
)
private
String
a84
;
@ExcelProperty
(
index
=
85
)
private
String
a85
;
@ExcelProperty
(
index
=
86
)
private
String
a86
;
@ExcelProperty
(
index
=
87
)
private
String
a87
;
@ExcelProperty
(
index
=
88
)
private
String
a88
;
@ExcelProperty
(
index
=
89
)
private
String
a89
;
@ExcelProperty
(
index
=
90
)
private
String
a90
;
private
String
importTime
;
/**
* 矿
*/
private
String
mineId
;
private
String
type
;
}
ruoyi-wages/src/main/java/com/ruoyi/system/model/wages/dao/PowerWagesDetails.java
0 → 100644
View file @
3af37f72
package
com.ruoyi.system.model.wages.dao
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author haiwe
* @date 2024/6/5
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
PowerWagesDetails
{
private
int
id
;
@ExcelProperty
(
index
=
1
)
private
String
a1
;
@ExcelProperty
(
index
=
2
)
private
String
a2
;
@ExcelProperty
(
index
=
3
)
private
String
a3
;
@ExcelProperty
(
index
=
4
)
private
String
a4
;
@ExcelProperty
(
index
=
5
)
private
String
a5
;
@ExcelProperty
(
index
=
6
)
private
String
a6
;
@ExcelProperty
(
index
=
7
)
private
String
a7
;
@ExcelProperty
(
index
=
8
)
private
String
a8
;
@ExcelProperty
(
index
=
9
)
private
String
a9
;
@ExcelProperty
(
index
=
10
)
private
String
a10
;
@ExcelProperty
(
index
=
11
)
private
String
a11
;
@ExcelProperty
(
index
=
12
)
private
String
a12
;
@ExcelProperty
(
index
=
13
)
private
String
a13
;
@ExcelProperty
(
index
=
14
)
private
String
a14
;
@ExcelProperty
(
index
=
15
)
private
String
a15
;
@ExcelProperty
(
index
=
16
)
private
String
a16
;
@ExcelProperty
(
index
=
17
)
private
String
a17
;
@ExcelProperty
(
index
=
18
)
private
String
a18
;
@ExcelProperty
(
index
=
19
)
private
String
a19
;
@ExcelProperty
(
index
=
20
)
private
String
a20
;
@ExcelProperty
(
index
=
21
)
private
String
a21
;
@ExcelProperty
(
index
=
22
)
private
String
a22
;
@ExcelProperty
(
index
=
23
)
private
String
a23
;
@ExcelProperty
(
index
=
24
)
private
String
a24
;
@ExcelProperty
(
index
=
25
)
private
String
a25
;
@ExcelProperty
(
index
=
26
)
private
String
a26
;
@ExcelProperty
(
index
=
27
)
private
String
a27
;
@ExcelProperty
(
index
=
28
)
private
String
a28
;
@ExcelProperty
(
index
=
29
)
private
String
a29
;
@ExcelProperty
(
index
=
30
)
private
String
a30
;
@ExcelProperty
(
index
=
31
)
private
String
a31
;
@ExcelProperty
(
index
=
32
)
private
String
a32
;
@ExcelProperty
(
index
=
33
)
private
String
a33
;
@ExcelProperty
(
index
=
34
)
private
String
a34
;
@ExcelProperty
(
index
=
35
)
private
String
a35
;
@ExcelProperty
(
index
=
36
)
private
String
a36
;
@ExcelProperty
(
index
=
37
)
private
String
a37
;
@ExcelProperty
(
index
=
38
)
private
String
a38
;
@ExcelProperty
(
index
=
39
)
private
String
a39
;
@ExcelProperty
(
index
=
40
)
private
String
a40
;
@ExcelProperty
(
index
=
41
)
private
String
a41
;
@ExcelProperty
(
index
=
42
)
private
String
a42
;
@ExcelProperty
(
index
=
43
)
private
String
a43
;
@ExcelProperty
(
index
=
44
)
private
String
a44
;
@ExcelProperty
(
index
=
45
)
private
String
a45
;
@ExcelProperty
(
index
=
46
)
private
String
a46
;
@ExcelProperty
(
index
=
47
)
private
String
a47
;
@ExcelProperty
(
index
=
48
)
private
String
a48
;
@ExcelProperty
(
index
=
49
)
private
String
a49
;
@ExcelProperty
(
index
=
50
)
private
String
a50
;
@ExcelProperty
(
index
=
51
)
private
String
a51
;
@ExcelProperty
(
index
=
52
)
private
String
a52
;
@ExcelProperty
(
index
=
53
)
private
String
a53
;
@ExcelProperty
(
index
=
54
)
private
String
a54
;
@ExcelProperty
(
index
=
55
)
private
String
a55
;
@ExcelProperty
(
index
=
56
)
private
String
a56
;
@ExcelProperty
(
index
=
57
)
private
String
a57
;
@ExcelProperty
(
index
=
58
)
private
String
a58
;
@ExcelProperty
(
index
=
59
)
private
String
a59
;
@ExcelProperty
(
index
=
60
)
private
String
a60
;
@ExcelProperty
(
index
=
61
)
private
String
a61
;
@ExcelProperty
(
index
=
62
)
private
String
a62
;
@ExcelProperty
(
index
=
63
)
private
String
a63
;
@ExcelProperty
(
index
=
64
)
private
String
a64
;
@ExcelProperty
(
index
=
65
)
private
String
a65
;
@ExcelProperty
(
index
=
66
)
private
String
a66
;
@ExcelProperty
(
index
=
67
)
private
String
a67
;
@ExcelProperty
(
index
=
68
)
private
String
a68
;
@ExcelProperty
(
index
=
69
)
private
String
a69
;
@ExcelProperty
(
index
=
70
)
private
String
a70
;
@ExcelProperty
(
index
=
71
)
private
String
a71
;
@ExcelProperty
(
index
=
72
)
private
String
a72
;
@ExcelProperty
(
index
=
73
)
private
String
a73
;
@ExcelProperty
(
index
=
74
)
private
String
a74
;
@ExcelProperty
(
index
=
75
)
private
String
a75
;
@ExcelProperty
(
index
=
76
)
private
String
a76
;
@ExcelProperty
(
index
=
77
)
private
String
a77
;
@ExcelProperty
(
index
=
78
)
private
String
a78
;
@ExcelProperty
(
index
=
79
)
private
String
a79
;
@ExcelProperty
(
index
=
80
)
private
String
a80
;
@ExcelProperty
(
index
=
81
)
private
String
a81
;
@ExcelProperty
(
index
=
82
)
private
String
a82
;
@ExcelProperty
(
index
=
83
)
private
String
a83
;
@ExcelProperty
(
index
=
84
)
private
String
a84
;
@ExcelProperty
(
index
=
85
)
private
String
a85
;
@ExcelProperty
(
index
=
86
)
private
String
a86
;
@ExcelProperty
(
index
=
87
)
private
String
a87
;
@ExcelProperty
(
index
=
88
)
private
String
a88
;
@ExcelProperty
(
index
=
89
)
private
String
a89
;
@ExcelProperty
(
index
=
90
)
private
String
a90
;
private
String
importTime
;
/**
* 矿
*/
private
String
mineId
;
private
Integer
comparisonId
;
}
ruoyi-wages/src/main/java/com/ruoyi/system/service/PowerWagesService.java
0 → 100644
View file @
3af37f72
package
com.ruoyi.system.service
;
import
com.ruoyi.system.model.wages.dao.PowerDAO
;
import
org.springframework.web.multipart.MultipartFile
;
/**
* @author haiwe
* @date 2024/6/26
*/
public
interface
PowerWagesService
{
Boolean
readDExcel
(
MultipartFile
file
,
String
date
,
String
mineId
);
Boolean
readCExcel
(
MultipartFile
file
,
String
date
,
String
mineId
,
String
type
);
void
add
(
PowerDAO
dao
);
}
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/PowerWagesServiceImpl.java
0 → 100644
View file @
3af37f72
package
com.ruoyi.system.service.impl
;
import
com.alibaba.excel.EasyExcel
;
import
com.ruoyi.system.listener.ExcelListener
;
import
com.ruoyi.system.mapper.PowerWagesComMapper
;
import
com.ruoyi.system.mapper.PowerWagesDeMapper
;
import
com.ruoyi.system.model.wages.dao.Power
;
import
com.ruoyi.system.model.wages.dao.PowerDAO
;
import
com.ruoyi.system.model.wages.dao.PowerWagesComparation
;
import
com.ruoyi.system.model.wages.dao.PowerWagesDetails
;
import
com.ruoyi.system.service.PowerWagesService
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @author haiwe
* @date 2024/6/26
*/
@Service
@RequiredArgsConstructor
public
class
PowerWagesServiceImpl
implements
PowerWagesService
{
private
final
PowerWagesComMapper
ceMapper
;
private
final
PowerWagesDeMapper
deMapper
;
/**
* 导入详细表数据
*
* @param file
* @param mineId
* @param date
* @return
*/
@Override
public
Boolean
readDExcel
(
MultipartFile
file
,
String
date
,
String
mineId
)
{
try
{
String
type
=
"1"
;
//定义需要解析的sheet名
List
<
String
>
sheetList
=
Arrays
.
asList
(
"电量数据专业化公司"
,
"外界电量数据"
);
// 定义需要过滤的关键词列表
List
<
String
>
filterList
=
Arrays
.
asList
(
"合计"
,
"小计"
,
"总表小计"
,
"劳服总表"
,
"校验"
,
"null"
);
// 获取上传文件的输入流
for
(
int
i
=
0
;
i
<
sheetList
.
size
();
i
++)
{
type
=
type
+
i
;
PowerWagesComparation
comparation
=
ceMapper
.
select
(
type
,
date
,
mineId
);
if
(
comparation
!=
null
)
{
//获取对应表的id
Integer
comparisonId
=
comparation
.
getComparisonId
();
InputStream
inputStream
=
file
.
getInputStream
();
System
.
err
.
println
(
sheetList
.
get
(
i
));
List
<
PowerWagesDetails
>
PowerList
=
EasyExcel
.
read
(
inputStream
,
PowerWagesDetails
.
class
,
new
ExcelListener
<
PowerWagesDetails
>())
.
sheet
(
sheetList
.
get
(
i
))
.
headRowNumber
(
3
)
.
doReadSync
();
inputStream
.
close
();
PowerList
=
PowerList
.
parallelStream
()
.
filter
(
v
->
v
.
getA2
()
!=
null
&&
!
v
.
getA2
().
equals
(
"null"
)
&&
!
filterList
.
contains
(
v
.
getA2
()))
.
filter
(
v
->
v
.
getA1
()
!=
null
&&
!
v
.
getA3
().
equals
(
"null"
)
&&
!
filterList
.
contains
(
v
.
getA3
()))
.
peek
(
v
->
v
.
setComparisonId
(
comparisonId
))
.
collect
(
Collectors
.
toList
());
deMapper
.
insertBatch
(
PowerList
,
mineId
,
date
);
}
else
{
return
false
;
}
}
return
true
;
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"Excel文件读取失败:"
+
e
.
getMessage
());
}
}
@Override
public
Boolean
readCExcel
(
MultipartFile
file
,
String
date
,
String
mineId
,
String
type
)
{
try
{
//定义需要解析的sheet名
List
<
String
>
sheetList
=
Arrays
.
asList
(
"电量数据专业化公司"
,
"外界电量数据"
);
// 获取上传文件的输入流
for
(
int
i
=
0
;
i
<
sheetList
.
size
();
i
++)
{
InputStream
inputStream
=
file
.
getInputStream
();
System
.
err
.
println
(
sheetList
.
get
(
i
));
List
<
PowerWagesComparation
>
powerList
=
EasyExcel
.
read
(
inputStream
,
PowerWagesComparation
.
class
,
new
ExcelListener
<
PowerWagesComparation
>())
.
sheet
(
sheetList
.
get
(
i
))
.
headRowNumber
(
2
)
.
doReadSync
();
inputStream
.
close
();
PowerWagesComparation
comparation
=
powerList
.
get
(
0
);
type
=
type
+
i
;
comparation
.
setType
(
type
);
comparation
.
setMineId
(
mineId
);
comparation
.
setImportTime
(
date
);
ceMapper
.
insertBatch
(
comparation
);
}
return
true
;
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"Excel文件读取失败:"
+
e
.
getMessage
());
}
}
@Override
public
void
add
(
PowerDAO
dao
)
{
//获取相关属性
String
type
=
dao
.
getType
();
String
importTime
=
dao
.
getImportTime
();
String
mineId
=
dao
.
getMineId
();
PowerWagesDetails
powerWagesDetails
=
new
PowerWagesDetails
();
List
<
Power
>
powerDetails
=
dao
.
getPowerDetails
();
//如何这个集合的长度>1,说明导入的是详细表
if
(
powerDetails
.
size
()
>
1
)
{
PowerWagesComparation
comparation
=
ceMapper
.
select
(
type
,
importTime
,
mineId
);
if
(
comparation
!=
null
)
{
//获取对应表的id
Integer
comparisonId
=
comparation
.
getComparisonId
();
deMapper
.
add
(
powerDetails
,
comparisonId
,
importTime
,
mineId
);
}
}
else
{
PowerWagesComparation
comparation
=
ceMapper
.
select
(
type
,
importTime
,
mineId
);
if
(
comparation
==
null
)
{
ceMapper
.
add
(
powerDetails
,
mineId
,
importTime
,
type
);
}
}
}
}
ruoyi-wages/src/main/resources/mapper/system/PowerWagesComMapper.xml
0 → 100644
View file @
3af37f72
This diff is collapsed.
Click to expand it.
ruoyi-wages/src/main/resources/mapper/system/PowerWagesDeMapper.xml
0 → 100644
View file @
3af37f72
This diff is collapsed.
Click to expand it.
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