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
882b9c95
Commit
882b9c95
authored
Aug 28, 2024
by
Fuzy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修正
parent
bf12d4b9
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
278 additions
and
27 deletions
+278
-27
ruoyi-wages/src/main/java/com/ruoyi/system/controller/PowerDisplayController.java
...a/com/ruoyi/system/controller/PowerDisplayController.java
+2
-1
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/PowerDisplayMapper.java
...main/java/com/ruoyi/system/mapper/PowerDisplayMapper.java
+4
-1
ruoyi-wages/src/main/java/com/ruoyi/system/model/power/dao/PowerClassificationQueryDao.java
...i/system/model/power/dao/PowerClassificationQueryDao.java
+10
-0
ruoyi-wages/src/main/java/com/ruoyi/system/model/power/dao/PowerControlDao.java
...ava/com/ruoyi/system/model/power/dao/PowerControlDao.java
+13
-0
ruoyi-wages/src/main/java/com/ruoyi/system/model/power/dto/ElectricityIntoTheParameterDto.java
...ystem/model/power/dto/ElectricityIntoTheParameterDto.java
+17
-0
ruoyi-wages/src/main/java/com/ruoyi/system/model/power/dto/PowerDisplayDto.java
...ava/com/ruoyi/system/model/power/dto/PowerDisplayDto.java
+2
-0
ruoyi-wages/src/main/java/com/ruoyi/system/model/rule/RuleRequestModel.java
...in/java/com/ruoyi/system/model/rule/RuleRequestModel.java
+20
-2
ruoyi-wages/src/main/java/com/ruoyi/system/service/PowerDisplayService.java
...in/java/com/ruoyi/system/service/PowerDisplayService.java
+2
-2
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/PowerDisplayServiceImpl.java
...om/ruoyi/system/service/impl/PowerDisplayServiceImpl.java
+71
-6
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/RuleServiceImpl.java
...n/java/com/ruoyi/system/service/impl/RuleServiceImpl.java
+0
-7
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/saveOnTheLargeScreenPower/DanHou.java
...system/service/impl/saveOnTheLargeScreenPower/DanHou.java
+69
-0
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/saveOnTheLargeScreenPower/LvJiaTuo.java
...stem/service/impl/saveOnTheLargeScreenPower/LvJiaTuo.java
+47
-0
ruoyi-wages/src/main/resources/mapper/system/PowerDisplayMapper.xml
...s/src/main/resources/mapper/system/PowerDisplayMapper.xml
+12
-5
ruoyi-wages/src/main/resources/mapper/system/RuleMapper.xml
ruoyi-wages/src/main/resources/mapper/system/RuleMapper.xml
+9
-3
No files found.
ruoyi-wages/src/main/java/com/ruoyi/system/controller/PowerDisplayController.java
View file @
882b9c95
package
com.ruoyi.system.controller
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.system.model.power.dto.ElectricityIntoTheParameterDto
;
import
com.ruoyi.system.model.power.dto.PowerDisplayDto
;
import
com.ruoyi.system.service.PowerDisplayService
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -28,7 +29,7 @@ public class PowerDisplayController {
* @return
*/
@PostMapping
(
"/peek"
)
public
AjaxResult
peek
(
@RequestBody
List
<
PowerDisplay
Dto
>
powerDisplayDtoList
)
{
public
AjaxResult
peek
(
@RequestBody
List
<
ElectricityIntoTheParameter
Dto
>
powerDisplayDtoList
)
{
powerDisplayService
.
peek
(
powerDisplayDtoList
);
return
new
AjaxResult
(
200
,
"成功"
);
}
...
...
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/PowerDisplayMapper.java
View file @
882b9c95
package
com.ruoyi.system.mapper
;
import
com.ruoyi.system.model.power.dao.PowerClassificationQueryDao
;
import
com.ruoyi.system.model.power.dao.PowerControlDao
;
import
com.ruoyi.system.model.power.dto.PowerDisplayDto
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -14,5 +15,7 @@ import java.util.List;
public
interface
PowerDisplayMapper
{
List
<
PowerClassificationQueryDao
>
selectClassificationToMid
(
@Param
(
"id"
)
String
mindId
);
void
insert
(
List
<
PowerDisplayDto
>
list
);
void
insert
(
@Param
(
"list"
)
List
<
PowerDisplayDto
>
list
);
List
<
PowerControlDao
>
selControl
(
@Param
(
"id"
)
String
mindId
);
}
ruoyi-wages/src/main/java/com/ruoyi/system/model/power/dao/PowerClassificationQueryDao.java
View file @
882b9c95
...
...
@@ -13,6 +13,8 @@ public class PowerClassificationQueryDao {
private
String
levelOneClassification
;
// 二级分类
private
String
levelTwoClassification
;
// 三级分类
private
String
levelThreeClassification
;
// 项目名
private
String
classificationName
;
...
...
@@ -40,6 +42,14 @@ public class PowerClassificationQueryDao {
this
.
classificationName
=
classificationName
;
}
public
String
getLevelThreeClassification
()
{
return
levelThreeClassification
;
}
public
void
setLevelThreeClassification
(
String
levelThreeClassification
)
{
this
.
levelThreeClassification
=
levelThreeClassification
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
...
...
ruoyi-wages/src/main/java/com/ruoyi/system/model/power/dao/PowerControlDao.java
0 → 100644
View file @
882b9c95
package
com.ruoyi.system.model.power.dao
;
import
lombok.Data
;
/**
* 2024/8/26
* 列与字段对照
*/
@Data
public
class
PowerControlDao
{
private
String
column
;
private
String
field
;
}
ruoyi-wages/src/main/java/com/ruoyi/system/model/power/dto/ElectricityIntoTheParameterDto.java
0 → 100644
View file @
882b9c95
package
com.ruoyi.system.model.power.dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* 2024/8/26
*/
@Data
public
class
ElectricityIntoTheParameterDto
implements
Serializable
{
private
String
row
;
private
String
coloumn
;
private
String
value
;
private
String
date
;
private
String
mindId
;
}
ruoyi-wages/src/main/java/com/ruoyi/system/model/power/dto/PowerDisplayDto.java
View file @
882b9c95
...
...
@@ -46,4 +46,6 @@ public class PowerDisplayDto {
private
String
levelOneClassification
;
// 二级分类
private
String
levelTwoClassification
;
// 三级分类
private
String
levelThreeClassification
;
}
ruoyi-wages/src/main/java/com/ruoyi/system/model/rule/RuleRequestModel.java
View file @
882b9c95
package
com.ruoyi.system.model.rule
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
java.io.Serializable
;
import
java.util.List
;
public
class
RuleRequestModel
implements
Serializable
{
...
...
@@ -18,6 +16,26 @@ public class RuleRequestModel implements Serializable {
private
JSONArray
rules
;
private
String
summary
;
private
String
type
;
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getSummary
()
{
return
summary
;
}
public
void
setSummary
(
String
summary
)
{
this
.
summary
=
summary
;
}
public
String
getId
()
{
return
id
;
}
...
...
ruoyi-wages/src/main/java/com/ruoyi/system/service/PowerDisplayService.java
View file @
882b9c95
package
com.ruoyi.system.service
;
import
com.ruoyi.system.model.power.dto.
PowerDisplay
Dto
;
import
com.ruoyi.system.model.power.dto.
ElectricityIntoTheParameter
Dto
;
import
java.util.List
;
...
...
@@ -8,5 +8,5 @@ import java.util.List;
* 2024/7/30
*/
public
interface
PowerDisplayService
{
void
peek
(
List
<
PowerDisplay
Dto
>
powerDisplayDtoList
);
void
peek
(
List
<
ElectricityIntoTheParameter
Dto
>
powerDisplayDtoList
);
}
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/PowerDisplayServiceImpl.java
View file @
882b9c95
...
...
@@ -2,14 +2,20 @@ package com.ruoyi.system.service.impl;
import
com.ruoyi.system.mapper.PowerDisplayMapper
;
import
com.ruoyi.system.model.power.dao.PowerClassificationQueryDao
;
import
com.ruoyi.system.model.power.dao.PowerControlDao
;
import
com.ruoyi.system.model.power.dto.ElectricityIntoTheParameterDto
;
import
com.ruoyi.system.model.power.dto.PowerDisplayDto
;
import
com.ruoyi.system.service.PowerDisplayService
;
import
com.ruoyi.system.service.impl.saveOnTheLargeScreenPower.LinXi
;
import
com.ruoyi.system.service.impl.saveOnTheLargeScreenPower.SaveOnTheLargeScreenImpl
;
import
com.ruoyi.system.service.impl.saveOnTheLargeScreenPower.*
;
import
org.springframework.stereotype.Service
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.stream.Collectors
;
/**
* 2024/7/30
...
...
@@ -23,16 +29,75 @@ public class PowerDisplayServiceImpl implements PowerDisplayService {
}
@Override
public
void
peek
(
List
<
PowerDisplayDto
>
powerDisplayDtoList
)
{
String
mindId
=
powerDisplayDtoList
.
get
(
0
).
getMindId
().
replaceAll
(
" "
,
""
);
public
void
peek
(
List
<
ElectricityIntoTheParameterDto
>
electricityIntoTheParameterDtoDtoList
)
{
String
mindId
=
electricityIntoTheParameterDtoDtoList
.
get
(
0
).
getMindId
().
replaceAll
(
" "
,
""
);
List
<
PowerControlDao
>
controlList
=
powerDisplayMapper
.
selControl
(
mindId
);
List
<
PowerDisplayDto
>
powerDisplayDtoList
=
new
ArrayList
<>();
Class
<
PowerDisplayDto
>
powerDisplayDtoClass
=
PowerDisplayDto
.
class
;
AtomicBoolean
b
=
new
AtomicBoolean
(
false
);
electricityIntoTheParameterDtoDtoList
.
parallelStream
().
forEach
(
v
->
{
PowerDisplayDto
displayDto
;
if
(
mindId
.
equals
(
"011704"
)
&&
v
.
getRow
().
equals
(
"电价(含税)"
))
return
;
if
(
powerDisplayDtoList
.
size
()
>
0
)
{
b
.
set
(
powerDisplayDtoList
.
parallelStream
().
anyMatch
(
a
->
a
.
getClassificationName
().
equals
(
v
.
getRow
())));
}
if
(
b
.
get
())
{
displayDto
=
powerDisplayDtoList
.
parallelStream
().
filter
(
a
->
a
.
getClassificationName
().
equals
(
v
.
getRow
())).
findFirst
().
get
();
}
else
{
displayDto
=
new
PowerDisplayDto
();
displayDto
.
setClassificationName
(
v
.
getRow
());
powerDisplayDtoList
.
add
(
displayDto
);
}
Optional
<
PowerControlDao
>
first
=
controlList
.
parallelStream
().
filter
(
a
->
a
.
getColumn
().
equals
(
v
.
getColoumn
())).
findFirst
();
if
(
first
.
isPresent
()
&&
first
.
get
().
getColumn
()
!=
null
&&
first
.
get
().
getField
()
!=
null
)
{
PowerControlDao
powerControlDao
=
first
.
get
();
try
{
Method
method
=
powerDisplayDtoClass
.
getMethod
(
"set"
+
powerControlDao
.
getField
(),
String
.
class
);
method
.
invoke
(
displayDto
,
v
.
getValue
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
b
.
set
(
false
);
});
List
<
PowerClassificationQueryDao
>
dao
=
powerDisplayMapper
.
selectClassificationToMid
(
mindId
);
SaveOnTheLargeScreenImpl
saveOnTheLargeScreen
=
null
;
List
<
String
>
asList
=
Arrays
.
asList
(
"011704"
);
if
(
asList
.
contains
(
mindId
))
{
List
<
String
>
linXi
=
Arrays
.
asList
(
"011704"
);
List
<
String
>
lvJiaTuo
=
Arrays
.
asList
(
"011702"
);
List
<
String
>
danHou
=
Arrays
.
asList
(
"011204"
);
List
<
String
>
dongHuanTuo
=
Arrays
.
asList
(
"010102"
);
if
(
linXi
.
contains
(
mindId
))
{
List
<
ElectricityIntoTheParameterDto
>
collect
=
electricityIntoTheParameterDtoDtoList
.
parallelStream
().
filter
(
v
->
v
.
getRow
().
equals
(
"电价(含税)"
)).
collect
(
Collectors
.
toList
());
if
(
collect
.
size
()
!=
0
)
{
collect
.
parallelStream
().
forEach
(
v
->
{
Optional
<
PowerControlDao
>
first
=
controlList
.
parallelStream
().
filter
(
a
->
a
.
getColumn
().
equals
(
v
.
getColoumn
())).
findFirst
();
try
{
if
(
first
.
isPresent
())
{
PowerControlDao
powerControlDao
=
first
.
get
();
Method
method
=
powerDisplayDtoClass
.
getMethod
(
"set"
+
powerControlDao
.
getField
(),
String
.
class
);
for
(
PowerDisplayDto
displayDto
:
powerDisplayDtoList
)
{
method
.
invoke
(
displayDto
,
v
.
getValue
());
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
});
}
saveOnTheLargeScreen
=
new
SaveOnTheLargeScreenImpl
(
new
LinXi
());
}
else
if
(
lvJiaTuo
.
contains
(
mindId
))
{
saveOnTheLargeScreen
=
new
SaveOnTheLargeScreenImpl
(
new
LvJiaTuo
());
}
else
if
(
danHou
.
contains
(
mindId
))
{
saveOnTheLargeScreen
=
new
SaveOnTheLargeScreenImpl
(
new
DanHou
());
}
else
if
(
dongHuanTuo
.
contains
(
mindId
))
{
saveOnTheLargeScreen
=
new
SaveOnTheLargeScreenImpl
(
new
DongHuanTuo
());
}
if
(
saveOnTheLargeScreen
!=
null
)
{
List
<
PowerDisplayDto
>
list
=
saveOnTheLargeScreen
.
save
(
mindId
,
powerDisplayDtoList
,
dao
);
list
.
parallelStream
().
forEach
(
v
->
{
if
(
v
.
getLevelOneClassification
()
==
null
||
""
.
equals
(
v
.
getLevelOneClassification
()))
v
.
setLevelOneClassification
(
"其他"
);
});
powerDisplayMapper
.
insert
(
list
);
}
}
...
...
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/RuleServiceImpl.java
View file @
882b9c95
...
...
@@ -2,22 +2,15 @@ package com.ruoyi.system.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.system.mapper.RuleMapper
;
import
com.ruoyi.system.model.rule.RuleModel
;
import
com.ruoyi.system.model.rule.RuleRequestModel
;
import
com.ruoyi.system.service.RuleService
;
import
org.springframework.stereotype.Service
;
import
java.io.DataInput
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.IntStream
;
@Service
public
class
RuleServiceImpl
implements
RuleService
{
...
...
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/saveOnTheLargeScreenPower/DanHou.java
0 → 100644
View file @
882b9c95
package
com.ruoyi.system.service.impl.saveOnTheLargeScreenPower
;
import
com.ruoyi.system.model.power.dao.PowerClassificationQueryDao
;
import
com.ruoyi.system.model.power.dto.PowerDisplayDto
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
/**
* 2024/8/19
*/
public
class
DanHou
implements
SaveOnTheLargeScreen
{
@Override
public
List
<
PowerDisplayDto
>
save
(
String
mindId
,
List
<
PowerDisplayDto
>
powerDisplayDtoList
,
List
<
PowerClassificationQueryDao
>
dao
)
{
powerDisplayDtoList
.
parallelStream
().
forEach
(
v
->
{
for
(
PowerClassificationQueryDao
queryDao
:
dao
)
{
if
(
v
.
getClassificationName
()
!=
null
&&
v
.
getClassificationName
().
equals
(
queryDao
.
getClassificationName
()))
{
v
.
setLevelOneClassification
(
queryDao
.
getLevelOneClassification
());
v
.
setLevelTwoClassification
(
queryDao
.
getLevelTwoClassification
());
v
.
setLevelThreeClassification
(
queryDao
.
getLevelThreeClassification
());
break
;
}
}
});
Optional
<
PowerDisplayDto
>
first
=
powerDisplayDtoList
.
parallelStream
().
filter
(
v
->
"合计"
.
equals
(
v
.
getClassificationName
())
&&
"辅助生产用电"
.
equals
(
v
.
getLevelThreeClassification
())).
findFirst
();
Optional
<
PowerDisplayDto
>
first1
=
powerDisplayDtoList
.
parallelStream
().
filter
(
v
->
"风选厂"
.
equals
(
v
.
getClassificationName
())
&&
"风选用电"
.
equals
(
v
.
getLevelThreeClassification
())).
findFirst
();
Optional
<
PowerDisplayDto
>
first4
=
powerDisplayDtoList
.
parallelStream
().
filter
(
v
->
"崔矿供应"
.
equals
(
v
.
getClassificationName
())
&&
"辅助生产用电"
.
equals
(
v
.
getLevelThreeClassification
())).
findFirst
();
Optional
<
PowerDisplayDto
>
first5
=
powerDisplayDtoList
.
parallelStream
().
filter
(
v
->
"南留庄供应"
.
equals
(
v
.
getClassificationName
())
&&
"辅助生产用电"
.
equals
(
v
.
getLevelThreeClassification
())).
findFirst
();
Optional
<
PowerDisplayDto
>
first6
=
powerDisplayDtoList
.
parallelStream
().
filter
(
v
->
"污水处理场"
.
equals
(
v
.
getClassificationName
())
&&
"辅助生产用电"
.
equals
(
v
.
getLevelThreeClassification
())).
findFirst
();
// 减排风
sub
(
first
,
first1
);
// 加单侯矿供应
add
(
first
,
first4
);
add
(
first
,
first5
);
add
(
first
,
first6
);
Optional
<
PowerDisplayDto
>
first2
=
powerDisplayDtoList
.
parallelStream
().
filter
(
v
->
"原煤电量"
.
equals
(
v
.
getClassificationName
())
&&
"生产用电"
.
equals
(
v
.
getLevelThreeClassification
())).
findFirst
();
Optional
<
PowerDisplayDto
>
first3
=
powerDisplayDtoList
.
parallelStream
().
filter
(
v
->
"各项小计"
.
equals
(
v
.
getClassificationName
())
&&
"排水用电"
.
equals
(
v
.
getLevelThreeClassification
())).
findFirst
();
List
<
PowerDisplayDto
>
collect
=
powerDisplayDtoList
.
parallelStream
().
filter
(
v
->
"研发支出"
.
equals
(
v
.
getLevelOneClassification
())).
collect
(
Collectors
.
toList
());
// 减排水
sub
(
first2
,
first3
);
// 减研发
if
(
first2
.
isPresent
()
&&
collect
.
size
()
!=
0
){
for
(
PowerDisplayDto
dto
:
collect
)
{
sub
(
first2
,
Optional
.
of
(
dto
));
}
}
return
powerDisplayDtoList
;
}
private
void
sub
(
Optional
<
PowerDisplayDto
>
first
,
Optional
<
PowerDisplayDto
>
first1
)
{
if
(
first
.
isPresent
()
&&
first1
.
isPresent
())
{
PowerDisplayDto
dto
=
first
.
get
();
PowerDisplayDto
dto1
=
first1
.
get
();
dto
.
setPowerTotal
(
new
BigDecimal
(
dto
.
getPowerTotal
()).
subtract
(
new
BigDecimal
(
dto1
.
getPowerTotal
()
!=
null
&&
!
""
.
equals
(
dto1
.
getPowerTotal
())
?
dto1
.
getPowerTotal
()
:
"0"
))
+
""
);
dto
.
setElectricityTotal
(
new
BigDecimal
(
dto
.
getElectricityTotal
()).
subtract
(
new
BigDecimal
(
dto1
.
getElectricityTotal
()
!=
null
&&
!
""
.
equals
(
dto1
.
getElectricityTotal
())
?
dto1
.
getElectricityTotal
()
:
"0"
))
+
""
);
}
}
private
void
add
(
Optional
<
PowerDisplayDto
>
first
,
Optional
<
PowerDisplayDto
>
first4
)
{
if
(
first
.
isPresent
()
&&
first4
.
isPresent
())
{
PowerDisplayDto
dto
=
first
.
get
();
PowerDisplayDto
dto1
=
first4
.
get
();
dto
.
setPowerTotal
(
new
BigDecimal
(
dto
.
getPowerTotal
()).
add
(
new
BigDecimal
(
dto1
.
getPowerTotal
()
!=
null
&&
!
""
.
equals
(
dto1
.
getPowerTotal
())
?
dto1
.
getPowerTotal
()
:
"0"
))
+
""
);
dto
.
setElectricityTotal
(
new
BigDecimal
(
dto
.
getElectricityTotal
()).
add
(
new
BigDecimal
(
dto1
.
getElectricityTotal
()
!=
null
&&
!
""
.
equals
(
dto1
.
getElectricityTotal
())
?
dto1
.
getElectricityTotal
()
:
"0"
))
+
""
);
}
}
}
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/saveOnTheLargeScreenPower/LvJiaTuo.java
0 → 100644
View file @
882b9c95
package
com.ruoyi.system.service.impl.saveOnTheLargeScreenPower
;
import
com.ruoyi.system.model.power.dao.PowerClassificationQueryDao
;
import
com.ruoyi.system.model.power.dto.PowerDisplayDto
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
/**
* 2024/8/14
*/
public
class
LvJiaTuo
implements
SaveOnTheLargeScreen
{
@Override
public
List
<
PowerDisplayDto
>
save
(
String
mindId
,
List
<
PowerDisplayDto
>
powerDisplayDtoList
,
List
<
PowerClassificationQueryDao
>
dao
)
{
powerDisplayDtoList
.
parallelStream
().
forEach
(
v
->
{
for
(
PowerClassificationQueryDao
queryDao
:
dao
)
{
if
(
v
.
getClassificationName
()
!=
null
&&
v
.
getClassificationName
().
equals
(
queryDao
.
getClassificationName
()))
{
v
.
setLevelOneClassification
(
queryDao
.
getLevelOneClassification
());
v
.
setLevelTwoClassification
(
queryDao
.
getLevelTwoClassification
());
v
.
setLevelThreeClassification
(
queryDao
.
getLevelThreeClassification
());
break
;
}
}
});
List
<
PowerDisplayDto
>
rDExpendituresOnRawCoal
=
powerDisplayDtoList
.
parallelStream
().
filter
(
v
->
v
.
getLevelOneClassification
().
equals
(
"研发支出"
)
&&
"原煤"
.
equals
(
v
.
getLevelThreeClassification
())).
collect
(
Collectors
.
toList
());
List
<
PowerDisplayDto
>
rDSpendingWashesCoal
=
powerDisplayDtoList
.
parallelStream
().
filter
(
v
->
v
.
getLevelOneClassification
().
equals
(
"研发支出"
)
&&
"洗煤"
.
equals
(
v
.
getLevelThreeClassification
())).
collect
(
Collectors
.
toList
());
Optional
<
PowerDisplayDto
>
onRawCoal
=
powerDisplayDtoList
.
parallelStream
().
filter
(
v
->
v
.
getClassificationName
().
equals
(
"生产成本原煤线电费"
)).
findFirst
();
Optional
<
PowerDisplayDto
>
washesCoal
=
powerDisplayDtoList
.
parallelStream
().
filter
(
v
->
v
.
getClassificationName
().
equals
(
"生产成本洗煤线电费"
)).
findFirst
();
if
(
onRawCoal
.
isPresent
())
{
PowerDisplayDto
displayDto
=
onRawCoal
.
get
();
for
(
PowerDisplayDto
dto
:
rDExpendituresOnRawCoal
)
{
displayDto
.
setElectricityTotal
(
new
BigDecimal
(
displayDto
.
getElectricityTotal
()).
subtract
(
new
BigDecimal
(
dto
.
getElectricityTotal
()
!=
null
?
dto
.
getElectricityTotal
()
:
"0"
))
+
""
);
displayDto
.
setPowerTotal
(
new
BigDecimal
(
displayDto
.
getPowerTotal
()).
subtract
(
new
BigDecimal
(
dto
.
getPowerTotal
()
!=
null
?
dto
.
getPowerTotal
()
:
"0"
))
+
""
);
}
}
if
(
washesCoal
.
isPresent
())
{
PowerDisplayDto
displayDto
=
washesCoal
.
get
();
for
(
PowerDisplayDto
dto
:
rDSpendingWashesCoal
)
{
displayDto
.
setElectricityTotal
(
new
BigDecimal
(
displayDto
.
getElectricityTotal
()).
subtract
(
new
BigDecimal
(
dto
.
getElectricityTotal
()
!=
null
?
dto
.
getElectricityTotal
()
:
"0"
))
+
""
);
displayDto
.
setPowerTotal
(
new
BigDecimal
(
displayDto
.
getPowerTotal
()).
subtract
(
new
BigDecimal
(
dto
.
getPowerTotal
()
!=
null
?
dto
.
getPowerTotal
()
:
"0"
))
+
""
);
}
}
return
powerDisplayDtoList
;
}
}
ruoyi-wages/src/main/resources/mapper/system/PowerDisplayMapper.xml
View file @
882b9c95
...
...
@@ -8,7 +8,8 @@
level_two_classification, classification_name,
power_total, power_tip, power_peak, power_flat, power_valley,
electricity_total, electricity_tip, electricity_peak, electricity_flat, electricity_valley,
electricity_price_tip, electricity_price_peak, electricity_price_flat, electricity_price_valley)
electricity_price_tip, electricity_price_peak, electricity_price_flat, electricity_price_valley,
level_three_classification)
values
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(#{item.dateColumn}, #{item.mindId}, #{item.levelOneClassification}, #{item.levelTwoClassification},
...
...
@@ -17,7 +18,7 @@
, #{item.electricityTotal}, #{item.electricityTip}, #{item.electricityPeak}, #{item.electricityFlat},
#{item.electricityValley}
, #{item.electricityPriceTip}, #{item.electricityPricePeak}, #{item.electricityPriceFlat},
#{item.electricityPriceValley})
#{item.electricityPriceValley}
, #{item.levelThreeClassification}
)
</foreach>
</insert>
...
...
@@ -26,9 +27,15 @@
resultType=
"com.ruoyi.system.model.power.dao.PowerClassificationQueryDao"
>
select a.level_one_classification levelOneClassification,
a.level_two_classification levelTwoClassification,
a.classification_name classificationName
a.classification_name classificationName,
a.level_three_classification levelThreeClassification
from power_classification_query a
where a.mind_id = #{id}
and a.whether_it_is_enabled = '0';
</select>
<select
id=
"selControl"
resultType=
"com.ruoyi.system.model.power.dao.PowerControlDao"
>
select column_name column, field_name field
from wages_power_column_comparison
where mind_id = #{id} and type = '1'
</select>
</mapper>
\ No newline at end of file
ruoyi-wages/src/main/resources/mapper/system/RuleMapper.xml
View file @
882b9c95
...
...
@@ -4,9 +4,9 @@
<insert
id=
"save"
>
INSERT INTO
rule_sheet(template_id, rules, first_rule, second_rule)
rule_sheet(template_id, rules, first_rule, second_rule
, summary_identification, type
)
values
(#{rule.templateId}, #{s}, #{rule.firstRule}, #{rule.secondRule})
(#{rule.templateId}, #{s}, #{rule.firstRule}, #{rule.secondRule}
, #{rule.summary}, #{rule.type}
)
</insert>
<update
id=
"updateToId"
>
update rule_sheet set
...
...
@@ -21,12 +21,18 @@
</if>
<if
test=
"s != null and s != ''"
>
rules = #{s},
</if>
<if
test=
"rule.summary != null and rule.summary != ''"
>
summary_identification = #{rule.summary},
</if>
<if
test=
"rule.type != null and rule.type != ''"
>
type = #{rule.type},
</if>
id = #{rule.id}
where id = #{rule.id};
</update>
<select
id=
"query"
resultType=
"com.ruoyi.system.model.rule.RuleRequestModel"
>
select template_id as templateId, first_rule as firstRule, second_rule as secondRule
select template_id as templateId, first_rule as firstRule, second_rule as secondRule
, summary_identification as summary, type
from rule_sheet
where template_id = #{id}
</select>
...
...
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