Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zhny
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王夏晖
zhny
Commits
12d0668f
Commit
12d0668f
authored
Jun 01, 2018
by
王夏晖
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加能耗计划的复制
parent
4405379c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
80 additions
and
7 deletions
+80
-7
BusEnergyPlanController.java
...mainte/energyplan/controller/BusEnergyPlanController.java
+7
-0
BusEnergyPlanRepository.java
...siness/mainte/energyplan/dao/BusEnergyPlanRepository.java
+5
-5
BusEnergyplanTRepository.java
...iness/mainte/energyplan/dao/BusEnergyplanTRepository.java
+11
-2
BusEnergyPlanService.java
...iness/mainte/energyplan/service/BusEnergyPlanService.java
+2
-0
BusEnergyPlanServiceImpl.java
...nte/energyplan/service/impl/BusEnergyPlanServiceImpl.java
+55
-0
No files found.
src/main/java/org/rcisoft/business/mainte/energyplan/controller/BusEnergyPlanController.java
View file @
12d0668f
...
@@ -62,6 +62,13 @@ public class BusEnergyPlanController extends PaginationController<BusEnergyPlan>
...
@@ -62,6 +62,13 @@ public class BusEnergyPlanController extends PaginationController<BusEnergyPlan>
null
);
null
);
}
}
@ApiOperation
(
value
=
"能耗计划复制"
,
notes
=
"能耗计划复制"
)
@PostMapping
(
value
=
"/energyPlanCopy"
)
public
Result
energyPlanCopy
(
@RequestParam
String
proId
,
@RequestParam
String
day
,
@RequestParam
String
copyDays
)
throws
Exception
{
PersistModel
pm
=
busEnergyPlanServiceImpl
.
energyPlanCopy
(
proId
,
day
,
copyDays
);
return
Result
.
builder
(
pm
);
}
@ApiOperation
(
value
=
"删除设备某一天的能耗计划"
,
notes
=
"删除设备某一天的能耗计划"
)
@ApiOperation
(
value
=
"删除设备某一天的能耗计划"
,
notes
=
"删除设备某一天的能耗计划"
)
@DeleteMapping
(
"/delete"
)
@DeleteMapping
(
"/delete"
)
public
Result
delete
(
@RequestParam
String
devNum
,
@RequestParam
String
day
)
{
public
Result
delete
(
@RequestParam
String
devNum
,
@RequestParam
String
day
)
{
...
...
src/main/java/org/rcisoft/business/mainte/energyplan/dao/BusEnergyPlanRepository.java
View file @
12d0668f
package
org
.
rcisoft
.
business
.
mainte
.
energyplan
.
dao
;
package
org
.
rcisoft
.
business
.
mainte
.
energyplan
.
dao
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.Select
;
import
org.apache.ibatis.annotations.Select
;
import
org.rcisoft.business.mainte.energyplan.entity.BusEnergyPlan
;
import
org.rcisoft.business.mainte.energyplan.entity.BusEnergyPlan
;
...
@@ -17,13 +18,12 @@ import java.util.Map;
...
@@ -17,13 +18,12 @@ import java.util.Map;
public
interface
BusEnergyPlanRepository
extends
BaseMapper
<
BusEnergyPlan
>
{
public
interface
BusEnergyPlanRepository
extends
BaseMapper
<
BusEnergyPlan
>
{
/**
/**
* 分页查询 busEnergyPlan
*查询单个项目某一天的能好计划
*
*/
*/
@Select
(
"<script>select * from bus_energy_plan where 1=1 "
@Select
(
"<script>select a.* from bus_energy_plan a,bus_device b where a.DEV_NUM = b.DEV_NUM and"
+
" b.PRO_ID = #{proId} and date_format(a.TM, '%Y-%m-%d')=#{day} "
+
"</script>"
)
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
Map
<
String
,
Object
>>
queryBusEnergyPlans
(
@Param
(
"proId"
)
String
proId
,
@Param
(
"day"
)
String
day
);
List
<
BusEnergyPlan
>
queryBusEnergyPlans
(
BusEnergyPlan
busEnergyPlan
);
@Select
(
"<script>SELECT sum(a.ENERGY_POWER) power_plan_day,sum(a.ENERGY_GAS) gas_plan_day FROM bus_energyplan_v a,bus_device b "
+
@Select
(
"<script>SELECT sum(a.ENERGY_POWER) power_plan_day,sum(a.ENERGY_GAS) gas_plan_day FROM bus_energyplan_v a,bus_device b "
+
"WHERE a.DEV_NUM = b.DEV_NUM AND b.PRO_ID = #{pro_id} AND date_format(a.TM, '%Y-%m-%d') = #{day}"
"WHERE a.DEV_NUM = b.DEV_NUM AND b.PRO_ID = #{pro_id} AND date_format(a.TM, '%Y-%m-%d') = #{day}"
...
...
src/main/java/org/rcisoft/business/mainte/energyplan/dao/BusEnergyplanTRepository.java
View file @
12d0668f
...
@@ -16,11 +16,20 @@ import java.util.Map;
...
@@ -16,11 +16,20 @@ import java.util.Map;
public
interface
BusEnergyplanTRepository
extends
BaseMapper
<
BusEnergyplanT
>
{
public
interface
BusEnergyplanTRepository
extends
BaseMapper
<
BusEnergyplanT
>
{
/**
/**
* 分页查询 busEnergyplanT
*查询单个设备某一天的能耗计划概览
*
*/
*/
@Select
(
"<script>select * from bus_energyplan_t where dev_num = #{devNum} "
+
@Select
(
"<script>select * from bus_energyplan_t where dev_num = #{devNum} "
+
" and day = #{day} </script>"
)
" and day = #{day} </script>"
)
List
<
Map
<
String
,
Object
>>
queryBusEnergyplanTs
(
@Param
(
"devNum"
)
String
devNum
,
@Param
(
"day"
)
String
day
);
List
<
Map
<
String
,
Object
>>
queryBusEnergyplanTs
(
@Param
(
"devNum"
)
String
devNum
,
@Param
(
"day"
)
String
day
);
/**
*查询单个项目某一天的能耗计划概览
* @return
*/
@Select
(
"<script>select * from bus_energyplan_t a,bus_device b where a.DEV_NUM = b.DEV_NUM and "
+
" b.PRO_ID = #{proId} and a.`DAY` = #{day} "
+
"</script>"
)
List
<
Map
<
String
,
Object
>>
queryBusEnergyPlanTs
(
@Param
(
"proId"
)
String
proId
,
@Param
(
"day"
)
String
day
);
}
}
src/main/java/org/rcisoft/business/mainte/energyplan/service/BusEnergyPlanService.java
View file @
12d0668f
...
@@ -80,6 +80,8 @@ public interface BusEnergyPlanService {
...
@@ -80,6 +80,8 @@ public interface BusEnergyPlanService {
int
paramLibraryOperate
(
Map
<
String
,
Object
>
map
);
int
paramLibraryOperate
(
Map
<
String
,
Object
>
map
);
PersistModel
energyPlanCopy
(
String
proId
,
String
day
,
String
copyDays
);
}
}
src/main/java/org/rcisoft/business/mainte/energyplan/service/impl/BusEnergyPlanServiceImpl.java
View file @
12d0668f
...
@@ -3,6 +3,7 @@ package org.rcisoft.business.mainte.energyplan.service.impl;
...
@@ -3,6 +3,7 @@ package org.rcisoft.business.mainte.energyplan.service.impl;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
org.rcisoft.business.mainte.energyplan.dao.BusEnergyPlanRepository
;
import
org.rcisoft.business.mainte.energyplan.dao.BusEnergyPlanRepository
;
import
org.rcisoft.business.mainte.energyplan.dao.BusEnergyplanTRepository
;
import
org.rcisoft.business.mainte.energyplan.entity.BusEnergyPlan
;
import
org.rcisoft.business.mainte.energyplan.entity.BusEnergyPlan
;
import
org.rcisoft.business.mainte.energyplan.entity.BusEnergyplanT
;
import
org.rcisoft.business.mainte.energyplan.entity.BusEnergyplanT
;
import
org.rcisoft.business.mainte.energyplan.service.BusEnergyPlanService
;
import
org.rcisoft.business.mainte.energyplan.service.BusEnergyPlanService
;
...
@@ -47,6 +48,8 @@ public class BusEnergyPlanServiceImpl implements BusEnergyPlanService {
...
@@ -47,6 +48,8 @@ public class BusEnergyPlanServiceImpl implements BusEnergyPlanService {
private
ParamLibraryRepository
paramLibraryRepository
;
private
ParamLibraryRepository
paramLibraryRepository
;
@Autowired
@Autowired
private
BusEnergyplanTService
busEnergyplanTService
;
private
BusEnergyplanTService
busEnergyplanTService
;
@Autowired
private
BusEnergyplanTRepository
busEnergyplanTRepository
;
@Value
(
"${serverimgurl}"
)
@Value
(
"${serverimgurl}"
)
private
String
serverImgUrl
;
private
String
serverImgUrl
;
...
@@ -338,5 +341,57 @@ public class BusEnergyPlanServiceImpl implements BusEnergyPlanService {
...
@@ -338,5 +341,57 @@ public class BusEnergyPlanServiceImpl implements BusEnergyPlanService {
return
1
;
return
1
;
}
}
@Transactional
@Override
public
PersistModel
energyPlanCopy
(
String
proId
,
String
day
,
String
copyDays
)
{
int
line
=
1
;
String
message
=
""
;
if
(
proId
==
null
||
proId
.
equals
(
""
)
||
day
==
null
||
day
.
equals
(
""
)){
line
=
0
;
message
=
"能耗计划复制失败"
;
return
new
PersistModel
(
line
,
message
);
}
String
[]
copyDayList
=
copyDays
.
split
(
","
);
//能耗计划
List
<
Map
<
String
,
Object
>>
planList
=
busEnergyPlanRepository
.
queryBusEnergyPlans
(
proId
,
day
);
//能耗计划概览
List
<
Map
<
String
,
Object
>>
plantList
=
busEnergyplanTRepository
.
queryBusEnergyPlanTs
(
proId
,
day
);
SimpleDateFormat
simple
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
try
{
for
(
String
newDay
:
copyDayList
){
for
(
Map
<
String
,
Object
>
mp
:
planList
){
BusEnergyPlan
be
=
new
BusEnergyPlan
();
be
.
setDevNum
(
mp
.
get
(
"DEV_NUM"
).
toString
());
be
.
setParam
(
mp
.
get
(
"PARAM"
).
toString
());
be
.
setParamVal
(
Float
.
valueOf
(
mp
.
get
(
"PARAM_VAL"
).
toString
()));
be
.
setPower
(
Float
.
valueOf
(
mp
.
get
(
"POWER"
).
toString
()));
be
.
setGasSpeed
(
Float
.
valueOf
(
mp
.
get
(
"GAS_SPEED"
).
toString
()));
be
.
setTm
(
simple
.
parse
(
newDay
+
" "
+
simple
.
format
(
mp
.
get
(
"TM"
)).
substring
(
11
)));
busEnergyPlanRepository
.
insertSelective
(
be
);
}
for
(
Map
<
String
,
Object
>
mp
:
plantList
){
BusEnergyplanT
bt
=
new
BusEnergyplanT
();
bt
.
setDevNum
(
mp
.
get
(
"DEV_NUM"
).
toString
());
bt
.
setDevTpId
(
mp
.
get
(
"DEV_TP_ID"
).
toString
());
bt
.
setStartTm
(
mp
.
get
(
"START_TM"
).
toString
());
bt
.
setEndTm
(
mp
.
get
(
"END_TM"
).
toString
());
bt
.
setValOne
(
mp
.
get
(
"VAL_ONE"
).
toString
());
bt
.
setValTwo
(
mp
.
get
(
"VAL_TWO"
).
toString
());
bt
.
setValThree
(
mp
.
get
(
"VAL_THREE"
).
toString
());
bt
.
setCompareVal
(
mp
.
get
(
"COMPARE_VAL"
).
toString
());
bt
.
setId
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
bt
.
setDay
(
newDay
);
busEnergyplanTRepository
.
insert
(
bt
);
}
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
line
=
0
;
message
=
"数据异常,能耗计划复制失败"
;
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
}
return
new
PersistModel
(
line
,
message
);
}
}
}
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