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
cd46fefc
Commit
cd46fefc
authored
May 02, 2018
by
王夏晖
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
824940a6
fe6b1fee
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
28 deletions
+33
-28
BusParamReferRepository.java
...business/mainte/adaptive/dao/BusParamReferRepository.java
+4
-4
AdaptiveServiceImpl.java
...ess/mainte/adaptive/service/impl/AdaptiveServiceImpl.java
+26
-20
Params.java
.../java/org/rcisoft/business/mainte/adaptive/vo/Params.java
+0
-1
inspectionMapper.xml
...sources/mapper/sys/device/inspection/inspectionMapper.xml
+3
-3
No files found.
src/main/java/org/rcisoft/business/mainte/adaptive/dao/BusParamReferRepository.java
View file @
cd46fefc
...
@@ -17,12 +17,12 @@ public interface BusParamReferRepository {
...
@@ -17,12 +17,12 @@ public interface BusParamReferRepository {
/**
/**
* 查询网关参数
* 查询网关参数
* @param params proId:项目id
,ownParam:项目固定参数
* @param params proId:项目id
* @return
* @return
*/
*/
@Select
(
"<script>select r.OTHER_PARAM from bus_param_refer r "
+
@Select
(
"<script>select r.O
WN_PARAM,r.O
THER_PARAM from bus_param_refer r "
+
"where r.PRO_ID=#{proId}
and r.OWN_PARAM=#{ownParam}
</script>"
)
"where r.PRO_ID=#{proId}</script>"
)
@ResultMap
(
value
=
"BusParamRefer"
)
@ResultMap
(
value
=
"BusParamRefer"
)
BusParamRefer
queryOtherParam
(
Params
params
);
List
<
BusParamRefer
>
queryOtherParam
(
Params
params
);
}
}
src/main/java/org/rcisoft/business/mainte/adaptive/service/impl/AdaptiveServiceImpl.java
View file @
cd46fefc
package
org
.
rcisoft
.
business
.
mainte
.
adaptive
.
service
.
impl
;
package
org
.
rcisoft
.
business
.
mainte
.
adaptive
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
org.apache.commons.lang3.StringUtils
;
import
org.rcisoft.business.mainte.adaptive.dao.BusParamReferRepository
;
import
org.rcisoft.business.mainte.adaptive.dao.BusParamReferRepository
;
import
org.rcisoft.business.mainte.adaptive.dao.BusTemperatureRepository
;
import
org.rcisoft.business.mainte.adaptive.dao.BusTemperatureRepository
;
import
org.rcisoft.business.mainte.adaptive.dao.TotalSensorRepository
;
import
org.rcisoft.business.mainte.adaptive.dao.TotalSensorRepository
;
...
@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
...
@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -53,12 +55,21 @@ public class AdaptiveServiceImpl implements AdaptiveService {
...
@@ -53,12 +55,21 @@ public class AdaptiveServiceImpl implements AdaptiveService {
public
ClimateAdaptation
climateAdaptation
(
String
proId
,
String
year
,
String
month
,
String
day
)
{
public
ClimateAdaptation
climateAdaptation
(
String
proId
,
String
year
,
String
month
,
String
day
)
{
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
//查询实际供水温度
//查询实际供水温度
Params
params
=
new
Params
(
proId
,
year
+
"-"
+
month
+
"-"
+
day
,
ProEnum
.
gswd
.
toString
(),
null
);
Params
params
=
new
Params
(
proId
,
year
+
"-"
+
month
+
"-"
+
day
,
null
);
//1.从sensor表查询对应日期的所有记录
//1.从sensor表查询对应日期的所有记录
List
<
TotalSensor
>
totalSensorList
=
totalSensorRepository
.
queryTotalSensorList
(
params
);
List
<
TotalSensor
>
totalSensorList
=
totalSensorRepository
.
queryTotalSensorList
(
params
);
//2.从bus_param_refer表查询“实际供水温度”对应的code
//2.从bus_param_refer表查询“实际供水温度”对应的code
BusParamRefer
busParamRefer
=
busParamReferRepository
.
queryOtherParam
(
params
);
String
[]
code_array
=
new
String
[]{
""
};
String
otherParam
=
busParamRefer
.
getOtherParam
();
String
gswd_code
=
ProEnum
.
gswd
.
toString
();
List
<
BusParamRefer
>
busParamReferList
=
busParamReferRepository
.
queryOtherParam
(
params
);
Iterator
<
BusParamRefer
>
it
=
busParamReferList
.
iterator
();
while
(
it
.
hasNext
())
{
BusParamRefer
busParamRefer
=
it
.
next
();
if
(
StringUtils
.
equals
(
gswd_code
,
busParamRefer
.
getOwnParam
())){
code_array
[
0
]
=
busParamRefer
.
getOtherParam
();
break
;
}
}
//3.取出数据中的整点记录,根据温度的code将数据取出,放入结果中
//3.取出数据中的整点记录,根据温度的code将数据取出,放入结果中
List
<
Object
>
realList
=
Arrays
.
asList
(
new
Object
[]{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
});
List
<
Object
>
realList
=
Arrays
.
asList
(
new
Object
[]{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
});
//循环
//循环
...
@@ -71,7 +82,7 @@ public class AdaptiveServiceImpl implements AdaptiveService {
...
@@ -71,7 +82,7 @@ public class AdaptiveServiceImpl implements AdaptiveService {
//得到json对象
//得到json对象
JSONObject
json
=
JSONObject
.
parseObject
(
totalSensor
.
getSensorJson
());
JSONObject
json
=
JSONObject
.
parseObject
(
totalSensor
.
getSensorJson
());
//得到供水温度
//得到供水温度
Object
gswd
=
json
.
get
(
otherParam
);
Object
gswd
=
json
.
get
(
code_array
[
0
]
);
realList
.
set
(
hour
,
gswd
);
realList
.
set
(
hour
,
gswd
);
}
}
});
});
...
@@ -109,7 +120,7 @@ public class AdaptiveServiceImpl implements AdaptiveService {
...
@@ -109,7 +120,7 @@ public class AdaptiveServiceImpl implements AdaptiveService {
@Override
@Override
public
BuildingAdaptation
buildingAdaptation
(
String
proId
,
String
year
,
String
month
,
String
day
)
{
public
BuildingAdaptation
buildingAdaptation
(
String
proId
,
String
year
,
String
month
,
String
day
)
{
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
Params
params
=
new
Params
(
proId
,
year
+
"-"
+
month
+
"-"
+
day
,
null
,
this
.
getCode
(
proId
));
Params
params
=
new
Params
(
proId
,
year
+
"-"
+
month
+
"-"
+
day
,
this
.
getCode
(
proId
));
//查询室外温度
//查询室外温度
List
<
BusTemperature
>
busTemperaturesList
=
busTemperatureRepository
.
queryBusTemperatureList
(
params
);
List
<
BusTemperature
>
busTemperaturesList
=
busTemperatureRepository
.
queryBusTemperatureList
(
params
);
List
<
Object
>
temperatureList
=
Arrays
.
asList
(
new
Object
[]{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
});
List
<
Object
>
temperatureList
=
Arrays
.
asList
(
new
Object
[]{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
});
...
@@ -120,18 +131,13 @@ public class AdaptiveServiceImpl implements AdaptiveService {
...
@@ -120,18 +131,13 @@ public class AdaptiveServiceImpl implements AdaptiveService {
temperatureList
.
set
(
hour
,
temperature
);
temperatureList
.
set
(
hour
,
temperature
);
});
});
//查询建筑负荷:供水温度,回水温度,水流量
//查询建筑负荷:供水温度,回水温度,水流量
params
.
setOwnParam
(
ProEnum
.
gswd
.
toString
());
String
[]
code_array
=
new
String
[]{
""
,
""
,
""
};
BusParamRefer
busParamRefer
=
busParamReferRepository
.
queryOtherParam
(
params
);
List
<
BusParamRefer
>
busParamRefer
=
busParamReferRepository
.
queryOtherParam
(
params
);
//供水温度
busParamRefer
.
forEach
(
b
->
{
String
gswd_code
=
busParamRefer
==
null
?
""
:
busParamRefer
.
getOtherParam
();
if
(
StringUtils
.
equals
(
b
.
getOwnParam
(),
ProEnum
.
gswd
.
toString
()))
code_array
[
0
]
=
b
.
getOtherParam
();
//回水温度
if
(
StringUtils
.
equals
(
b
.
getOwnParam
(),
ProEnum
.
hswd
.
toString
()))
code_array
[
1
]
=
b
.
getOtherParam
();
params
.
setOwnParam
(
ProEnum
.
hswd
.
toString
());
if
(
StringUtils
.
equals
(
b
.
getOwnParam
(),
ProEnum
.
sll
.
toString
()))
code_array
[
2
]
=
b
.
getOtherParam
();
busParamRefer
=
busParamReferRepository
.
queryOtherParam
(
params
);
});
String
hswd_code
=
busParamRefer
==
null
?
""
:
busParamRefer
.
getOtherParam
();
//水流量
params
.
setOwnParam
(
ProEnum
.
sll
.
toString
());
busParamRefer
=
busParamReferRepository
.
queryOtherParam
(
params
);
String
sll_code
=
busParamRefer
==
null
?
""
:
busParamRefer
.
getOtherParam
();
//从sensor表查询对应日期的所有记录
//从sensor表查询对应日期的所有记录
List
<
TotalSensor
>
totalSensorList
=
totalSensorRepository
.
queryTotalSensorList
(
params
);
List
<
TotalSensor
>
totalSensorList
=
totalSensorRepository
.
queryTotalSensorList
(
params
);
List
<
Object
>
buildingList
=
Arrays
.
asList
(
new
Object
[]{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
});
List
<
Object
>
buildingList
=
Arrays
.
asList
(
new
Object
[]{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
});
...
@@ -144,11 +150,11 @@ public class AdaptiveServiceImpl implements AdaptiveService {
...
@@ -144,11 +150,11 @@ public class AdaptiveServiceImpl implements AdaptiveService {
//得到json对象
//得到json对象
JSONObject
json
=
JSONObject
.
parseObject
(
totalSensor
.
getSensorJson
());
JSONObject
json
=
JSONObject
.
parseObject
(
totalSensor
.
getSensorJson
());
//供水温度
//供水温度
BigDecimal
gswd
=
(
BigDecimal
)
json
.
get
(
gswd_code
);
BigDecimal
gswd
=
(
BigDecimal
)
json
.
get
(
code_array
[
0
]
);
//回水温度
//回水温度
BigDecimal
hswd
=
(
BigDecimal
)
json
.
get
(
hswd_code
);
BigDecimal
hswd
=
(
BigDecimal
)
json
.
get
(
code_array
[
1
]
);
//水流量
//水流量
BigDecimal
sll
=
(
BigDecimal
)
json
.
get
(
sll_code
);
BigDecimal
sll
=
(
BigDecimal
)
json
.
get
(
code_array
[
2
]
);
//公式计算
//公式计算
Float
building
=
Math
.
abs
(
gswd
.
subtract
(
hswd
).
multiply
(
sll
).
multiply
(
new
BigDecimal
(
4.12
)).
divide
(
new
BigDecimal
(
3.6
),
1
,
BigDecimal
.
ROUND_HALF_UP
).
floatValue
());
Float
building
=
Math
.
abs
(
gswd
.
subtract
(
hswd
).
multiply
(
sll
).
multiply
(
new
BigDecimal
(
4.12
)).
divide
(
new
BigDecimal
(
3.6
),
1
,
BigDecimal
.
ROUND_HALF_UP
).
floatValue
());
buildingList
.
set
(
hour
,
building
);
buildingList
.
set
(
hour
,
building
);
...
...
src/main/java/org/rcisoft/business/mainte/adaptive/vo/Params.java
View file @
cd46fefc
...
@@ -14,7 +14,6 @@ public class Params {
...
@@ -14,7 +14,6 @@ public class Params {
private
String
proId
;
private
String
proId
;
private
String
time
;
private
String
time
;
private
String
ownParam
;
private
String
code
;
private
String
code
;
}
}
src/main/resources/mapper/sys/device/inspection/inspectionMapper.xml
View file @
cd46fefc
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
DATE_FORMAT (bdi.INSP_TM,'%Y-%m-%d %H:%i:%S') AS INSP_TM
DATE_FORMAT (bdi.INSP_TM,'%Y-%m-%d %H:%i:%S') AS INSP_TM
FROM
FROM
bus_device bd
bus_device bd
RIGHT JOIN bus_device_inspect bdi ON bd.DEV_
NUM = bdi.DEV_NUM
RIGHT JOIN bus_device_inspect bdi ON bd.DEV_
ID = bdi.DEV_ID
LEFT JOIN bus_device_tp bdt ON bd.DEV_TP_ID = bdt.DEV_TP_ID
LEFT JOIN bus_device_tp bdt ON bd.DEV_TP_ID = bdt.DEV_TP_ID
WHERE
WHERE
bdi.FLAG = #{flag}
bdi.FLAG = #{flag}
...
@@ -28,9 +28,9 @@
...
@@ -28,9 +28,9 @@
DATE_FORMAT (bdi.INSP_TM,'%Y-%m-%d %H:%i:%S') AS INSP_TM
DATE_FORMAT (bdi.INSP_TM,'%Y-%m-%d %H:%i:%S') AS INSP_TM
FROM
FROM
bus_device bd
bus_device bd
RIGHT JOIN bus_device_inspect bdi ON bd.DEV_
NUM = bdi.DEV_NUM
RIGHT JOIN bus_device_inspect bdi ON bd.DEV_
ID = bdi.DEV_ID
LEFT JOIN bus_device_tp bdt ON bd.DEV_TP_ID = bdt.DEV_TP_ID
LEFT JOIN bus_device_tp bdt ON bd.DEV_TP_ID = bdt.DEV_TP_ID
WHERE
WHERE
bd.PRO_ID = #{proId} AND bd
i
.DEV_NUM = #{devNum}
bd.PRO_ID = #{proId} AND bd.DEV_NUM = #{devNum}
</select>
</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