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
36b22b73
Commit
36b22b73
authored
Jul 01, 2024
by
刘_震
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
电力汇总-前端所需数据接口的完成
parent
b5d2b3d9
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
138 additions
and
37 deletions
+138
-37
ruoyi-wages/src/main/java/com/ruoyi/system/controller/PowerWagesController.java
...ava/com/ruoyi/system/controller/PowerWagesController.java
+18
-0
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/PowerWagesComMapper.java
...ain/java/com/ruoyi/system/mapper/PowerWagesComMapper.java
+4
-0
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/PowerWagesDeMapper.java
...main/java/com/ruoyi/system/mapper/PowerWagesDeMapper.java
+4
-0
ruoyi-wages/src/main/java/com/ruoyi/system/model/wages/vo/PowerVo.java
...rc/main/java/com/ruoyi/system/model/wages/vo/PowerVo.java
+21
-0
ruoyi-wages/src/main/java/com/ruoyi/system/service/PowerWagesService.java
...main/java/com/ruoyi/system/service/PowerWagesService.java
+11
-3
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/PowerWagesServiceImpl.java
.../com/ruoyi/system/service/impl/PowerWagesServiceImpl.java
+17
-33
ruoyi-wages/src/main/resources/mapper/system/PowerWagesComMapper.xml
.../src/main/resources/mapper/system/PowerWagesComMapper.xml
+33
-1
ruoyi-wages/src/main/resources/mapper/system/PowerWagesDeMapper.xml
...s/src/main/resources/mapper/system/PowerWagesDeMapper.xml
+30
-0
No files found.
ruoyi-wages/src/main/java/com/ruoyi/system/controller/PowerWagesController.java
View file @
36b22b73
...
@@ -3,11 +3,17 @@ package com.ruoyi.system.controller;
...
@@ -3,11 +3,17 @@ package com.ruoyi.system.controller;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.system.model.wages.dao.PowerDAO
;
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.model.wages.vo.PowerVo
;
import
com.ruoyi.system.service.PowerWagesService
;
import
com.ruoyi.system.service.PowerWagesService
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author haiwe
* @author haiwe
* @date 2024/6/26
* @date 2024/6/26
...
@@ -67,6 +73,18 @@ public class PowerWagesController {
...
@@ -67,6 +73,18 @@ public class PowerWagesController {
return
AjaxResult
.
success
();
return
AjaxResult
.
success
();
}
}
/**
* 返回前端所需要的数据
* @param mineId
* @param date
* @return 前端所需要的数据
*/
@GetMapping
public
AjaxResult
list
(
@RequestParam
(
"mineId"
)
String
mineId
,
@RequestParam
(
"date"
)
String
date
)
{
List
<
PowerVo
>
data
=
powerWagesService
.
selectByMineIdAndDate
(
mineId
,
date
);
return
AjaxResult
.
success
(
data
);
}
...
...
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/PowerWagesComMapper.java
View file @
36b22b73
...
@@ -22,4 +22,8 @@ public interface PowerWagesComMapper {
...
@@ -22,4 +22,8 @@ public interface PowerWagesComMapper {
PowerWagesComparation
select
(
@Param
(
"type"
)
String
type
,
@Param
(
"date"
)
String
importTime
,
@Param
(
"mineId"
)
String
mineId
);
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
);
void
add
(
@Param
(
"accList"
)
List
<
Power
>
powerDetails
,
@Param
(
"mineId"
)
String
mineId
,
@Param
(
"importTime"
)
String
importTime
,
@Param
(
"type"
)
String
type
);
PowerWagesComparation
selectByCId
(
Integer
comparisonId
);
List
<
PowerWagesComparation
>
selectByMineIdAndDate
(
@Param
(
"mineId"
)
String
mineId
,
@Param
(
"date"
)
String
date
);
}
}
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/PowerWagesDeMapper.java
View file @
36b22b73
...
@@ -17,4 +17,8 @@ public interface PowerWagesDeMapper {
...
@@ -17,4 +17,8 @@ public interface PowerWagesDeMapper {
void
insertBatch
(
@Param
(
"accList"
)
List
<
PowerWagesDetails
>
powerList
,
@Param
(
"mineId"
)
String
mineId
,
@Param
(
"date"
)
String
date
);
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
);
void
add
(
@Param
(
"accList"
)
List
<
Power
>
powerDetails
,
@Param
(
"comparisonId"
)
Integer
comparisonId
,
@Param
(
"importTime"
)
String
importTime
,
@Param
(
"mineId"
)
String
mineId
);
List
<
PowerWagesDetails
>
selectByMineIdAndDate
(
@Param
(
"mineId"
)
String
mineId
,
@Param
(
"date"
)
String
date
);
List
<
PowerWagesDetails
>
selectByCId
(
int
comparisonId
);
}
}
ruoyi-wages/src/main/java/com/ruoyi/system/model/wages/vo/PowerVo.java
0 → 100644
View file @
36b22b73
package
com.ruoyi.system.model.wages.vo
;
import
com.ruoyi.system.model.wages.dao.PowerWagesComparation
;
import
com.ruoyi.system.model.wages.dao.PowerWagesDetails
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
/**
* @author haiwe
* @date 2024/6/28
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
PowerVo
{
private
PowerWagesComparation
datas
;
private
List
<
PowerWagesDetails
>
details
;
}
ruoyi-wages/src/main/java/com/ruoyi/system/service/PowerWagesService.java
View file @
36b22b73
...
@@ -2,17 +2,25 @@ package com.ruoyi.system.service;
...
@@ -2,17 +2,25 @@ package com.ruoyi.system.service;
import
com.ruoyi.system.model.wages.dao.PowerDAO
;
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.model.wages.vo.PowerVo
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author haiwe
* @author haiwe
* @date 2024/6/26
* @date 2024/6/26
*/
*/
public
interface
PowerWagesService
{
public
interface
PowerWagesService
{
Boolean
readDExcel
(
MultipartFile
file
,
String
date
,
String
mineId
);
Boolean
readDExcel
(
MultipartFile
file
,
String
date
,
String
mineId
);
Boolean
readCExcel
(
MultipartFile
file
,
String
date
,
String
mineId
,
String
type
);
Boolean
readCExcel
(
MultipartFile
file
,
String
date
,
String
mineId
,
String
type
);
void
add
(
PowerDAO
dao
);
void
add
(
PowerDAO
dao
);
List
<
PowerVo
>
selectByMineIdAndDate
(
String
mineId
,
String
date
);
}
}
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/PowerWagesServiceImpl.java
View file @
36b22b73
...
@@ -10,6 +10,7 @@ import com.ruoyi.system.model.wages.dao.Power;
...
@@ -10,6 +10,7 @@ import com.ruoyi.system.model.wages.dao.Power;
import
com.ruoyi.system.model.wages.dao.PowerDAO
;
import
com.ruoyi.system.model.wages.dao.PowerDAO
;
import
com.ruoyi.system.model.wages.dao.PowerWagesComparation
;
import
com.ruoyi.system.model.wages.dao.PowerWagesComparation
;
import
com.ruoyi.system.model.wages.dao.PowerWagesDetails
;
import
com.ruoyi.system.model.wages.dao.PowerWagesDetails
;
import
com.ruoyi.system.model.wages.vo.PowerVo
;
import
com.ruoyi.system.service.PowerWagesService
;
import
com.ruoyi.system.service.PowerWagesService
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -18,9 +19,7 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -18,9 +19,7 @@ import org.springframework.web.multipart.MultipartFile;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.util.Arrays
;
import
java.util.*
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -138,37 +137,22 @@ public class PowerWagesServiceImpl implements PowerWagesService {
...
@@ -138,37 +137,22 @@ public class PowerWagesServiceImpl implements PowerWagesService {
}
}
@Override
@Override
public
List
<
PowerWagesDetails
>
selectByMineIdAndDate
(
String
mineId
,
String
date
)
throws
IllegalAccessException
{
public
List
<
PowerVo
>
selectByMineIdAndDate
(
String
mineId
,
String
date
){
//定义一个集合用来返回所需要的数据
List
<
PowerWagesDetails
>
details
=
deMapper
.
selectByMineIdAndDate
(
mineId
,
date
);
List
<
PowerVo
>
voList
=
new
ArrayList
<>();
// for (PowerWagesDetails detail : details) {
List
<
PowerWagesComparation
>
comparations
=
ceMapper
.
selectByMineIdAndDate
(
mineId
,
date
);
// PowerWagesComparation comparation = ceMapper.selectByCId(detail.getComparisonId());
for
(
PowerWagesComparation
comparation
:
comparations
)
{
// if (comparation != null) {
PowerVo
powerVo
=
new
PowerVo
();
// // 获取PowerWagesDetails和PowerWagesComparation的字段
List
<
PowerWagesDetails
>
details
=
deMapper
.
selectByCId
(
comparation
.
getComparisonId
());
// Field[] detailFields = PowerWagesDetails.class.getDeclaredFields();
powerVo
.
setDatas
(
comparation
);
// Field[] comparationFields = PowerWagesComparation.class.getDeclaredFields();
powerVo
.
setDetails
(
details
);
//
voList
.
add
(
powerVo
);
// for (Field comparationField : comparationFields) {
}
// comparationField.setAccessible(true);
return
voList
;
// // 遍历details中的字段,找到同名且类型相同的字段进行赋值
// for (Field detailField : detailFields) {
// if (detailField.getName().equals(comparationField.getName()) &&
// detailField.getType().equals(comparationField.getType())) {
// detailField.setAccessible(true);
// Object detailsValue = detailField.get(detail);
// // 将comparation中的值替换为details中的值
// comparationField.set(comparation, detailsValue);
// break;
// }
// }
// }
// } else {
// return null; // 或者根据业务逻辑处理未找到comparation的情况
// }
// }
return
details
;
// 返回处理后的details列表
}
}
}
}
...
...
ruoyi-wages/src/main/resources/mapper/system/PowerWagesComMapper.xml
View file @
36b22b73
...
@@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.ruoyi.system.mapper.PowerWagesComMapper"
>
<mapper
namespace=
"com.ruoyi.system.mapper.PowerWagesComMapper"
>
<resultMap
type=
"com.ruoyi.system.model.wages.dao.PowerWagesComparation"
id=
"PowerWagesComparationResult"
>
<resultMap
type=
"com.ruoyi.system.model.wages.dao.PowerWagesComparation"
id=
"PowerWagesComparationResult"
>
<result
property=
"comparisonId"
column=
"comparison
_i
d"
/>
<result
property=
"comparisonId"
column=
"comparison
I
d"
/>
<result
property=
"a1"
column=
"a1"
/>
<result
property=
"a1"
column=
"a1"
/>
<result
property=
"a2"
column=
"a2"
/>
<result
property=
"a2"
column=
"a2"
/>
<result
property=
"a3"
column=
"a3"
/>
<result
property=
"a3"
column=
"a3"
/>
...
@@ -350,5 +350,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -350,5 +350,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from power_wages_comparation
from power_wages_comparation
where mine_id = #{mineId} and type = #{type} and import_time = #{date}
where mine_id = #{mineId} and type = #{type} and import_time = #{date}
</select>
</select>
<select
id=
"selectByCId"
resultMap=
"PowerWagesComparationResult"
>
select comparisonId,
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
a11, a12, a13, a14, a15, a16, a17, a18, a19,
a20, a21, a22, a23, a24, a25, a26, a27, a28,
a29, a30, a31, a32, a33, a34, a35, a36, a37,
a38, a39, a40, a41, a42, a43, a44, a45, a46,
a47, a48, a49, a50, a51, a52, a53, a54, a55,
a56, a57, a58, a59, a60, a61, a62, a63, a64,
a65, a66, a67, a68, a69, a70, a71, a72, a73,
a74, a75, a76, a77, a78, a79, a80, a81, a82,
a83, a84, a85, a86, a87, a88, a89, a90,
mine_id, import_time, type
from power_wages_comparation
where comparisonId = #{comparisonId}
</select>
<select
id=
"selectByMineIdAndDate"
resultMap=
"PowerWagesComparationResult"
>
select comparisonId,
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
a11, a12, a13, a14, a15, a16, a17, a18, a19,
a20, a21, a22, a23, a24, a25, a26, a27, a28,
a29, a30, a31, a32, a33, a34, a35, a36, a37,
a38, a39, a40, a41, a42, a43, a44, a45, a46,
a47, a48, a49, a50, a51, a52, a53, a54, a55,
a56, a57, a58, a59, a60, a61, a62, a63, a64,
a65, a66, a67, a68, a69, a70, a71, a72, a73,
a74, a75, a76, a77, a78, a79, a80, a81, a82,
a83, a84, a85, a86, a87, a88, a89, a90,
mine_id, import_time, type
from power_wages_comparation
where mine_id = #{mineId} and import_time = #{date}
</select>
</mapper>
</mapper>
\ No newline at end of file
ruoyi-wages/src/main/resources/mapper/system/PowerWagesDeMapper.xml
View file @
36b22b73
...
@@ -475,4 +475,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -475,4 +475,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{mineId},#{importTime},#{comparisonId})
#{mineId},#{importTime},#{comparisonId})
</foreach>
</foreach>
</insert>
</insert>
<select
id=
"selectByMineIdAndDate"
resultMap=
"PowerWagesDetailsResult"
>
select id, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
a11, a12, a13, a14, a15, a16, a17, a18, a19,
a20, a21, a22, a23, a24, a25, a26, a27, a28,
a29, a30, a31, a32, a33, a34, a35, a36, a37,
a38, a39, a40, a41, a42, a43, a44, a45, a46,
a47, a48, a49, a50, a51, a52, a53, a54, a55,
a56, a57, a58, a59, a60, a61, a62, a63, a64,
a65, a66, a67, a68, a69, a70, a71, a72, a73,
a74, a75, a76, a77, a78, a79, a80, a81, a82,
a83, a84, a85, a86, a87, a88, a89, a90,
mine_id, import_time, comparison_id
from power_wages_details
where mine_id = #{mineId} and import_time = #{date}
</select>
<select
id=
"selectByCId"
resultMap=
"PowerWagesDetailsResult"
>
select id, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
a11, a12, a13, a14, a15, a16, a17, a18, a19,
a20, a21, a22, a23, a24, a25, a26, a27, a28,
a29, a30, a31, a32, a33, a34, a35, a36, a37,
a38, a39, a40, a41, a42, a43, a44, a45, a46,
a47, a48, a49, a50, a51, a52, a53, a54, a55,
a56, a57, a58, a59, a60, a61, a62, a63, a64,
a65, a66, a67, a68, a69, a70, a71, a72, a73,
a74, a75, a76, a77, a78, a79, a80, a81, a82,
a83, a84, a85, a86, a87, a88, a89, a90,
mine_id, import_time, comparison_id
from power_wages_details
where comparison_id = #{comparsionId}
</select>
</mapper>
</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