Browse Source

1、广合二厂群控系统相关接口优化;

dev_gh_ers
3067418132@qq.com 2 weeks ago
parent
commit
6661efa01f
  1. 6
      mh-system/src/main/java/com/mh/system/mapper/energy/EnergyMapper.java
  2. 3
      mh-system/src/main/java/com/mh/system/mapper/energy/EnergyQueryMapper.java
  3. 1
      mh-system/src/main/java/com/mh/system/service/energy/impl/EnergyAnalyzeServiceImpl.java
  4. 2
      mh-system/src/main/java/com/mh/system/service/operation/impl/OperationDeviceServiceImpl.java
  5. 58
      mh-system/src/main/resources/mapper/system/EnergyMapper.xml

6
mh-system/src/main/java/com/mh/system/mapper/energy/EnergyMapper.java

@ -59,7 +59,7 @@ public interface EnergyMapper {
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('5', '6') and cpm.grade = 40 " +
// " and cpm.terminal_device_type = '15' " +
" and cpm.terminal_device_type = '15' " +
"<if test='systemType != null and systemType != \"\"'>" +
" and cpm.system_type = #{systemType} " +
"</if>" +
@ -111,7 +111,7 @@ public interface EnergyMapper {
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('5', '6') and cpm.grade = 40 " +
// " and cpm.terminal_device_type = '15' " +
" and cpm.terminal_device_type = '15' " +
"<if test='systemType != null and systemType != \"\"'>" +
" and cpm.system_type = #{systemType} " +
"</if>" +
@ -181,7 +181,7 @@ public interface EnergyMapper {
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('5', '6') and cpm.grade = 40 " +
// " and cpm.terminal_device_type = '15' " +
" and cpm.terminal_device_type = '15' " +
"<if test='systemType != null and systemType != \"\"'>" +
" and cpm.system_type = #{systemType} " +
"</if>" +

3
mh-system/src/main/java/com/mh/system/mapper/energy/EnergyQueryMapper.java

@ -57,6 +57,7 @@ public interface EnergyQueryMapper {
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('5', '6') " +
" and cpm.terminal_device_type = '15' " +
"<if test='systemType != null and systemType != \"\"'> " +
" and cpm.system_type = #{systemType} " +
"</if>" +
@ -108,6 +109,7 @@ public interface EnergyQueryMapper {
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('5', '6') " +
" and cpm.terminal_device_type = '15' " +
"<if test='systemType != null and systemType != \"\"'> " +
" and cpm.system_type = #{systemType} " +
"</if>" +
@ -178,6 +180,7 @@ public interface EnergyQueryMapper {
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('5', '6') " +
" and cpm.terminal_device_type = '15' " +
"<if test='systemType != null and systemType != \"\"'> " +
" and cpm.system_type = #{systemType} " +
"</if>" +

1
mh-system/src/main/java/com/mh/system/service/energy/impl/EnergyAnalyzeServiceImpl.java

@ -85,6 +85,7 @@ public class EnergyAnalyzeServiceImpl implements EnergyAnalyzeService {
HashMap<String, BigDecimal> result = deviceTypeEnergyEntities.stream()
// 过滤叼总表的数据(deviceType=15)
.filter(deviceTypeEnergyEntity -> !deviceTypeEnergyEntity.getDeviceType().equals("15"))
.filter(deviceTypeEnergyEntity -> !deviceTypeEnergyEntity.getDeviceType().equals("99"))
.collect(Collectors.groupingBy(DeviceTypeEnergy::getDeviceTypeRange))
.entrySet().stream().collect(Collectors.toMap(
Map.Entry<String, List<DeviceTypeEnergy>>::getKey,

2
mh-system/src/main/java/com/mh/system/service/operation/impl/OperationDeviceServiceImpl.java

@ -100,7 +100,7 @@ public class OperationDeviceServiceImpl implements IOperationDeviceService {
}
}
}
return false;
return true;
}
@Override

58
mh-system/src/main/resources/mapper/system/EnergyMapper.xml

@ -105,7 +105,7 @@
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.terminal_device_type = '15'
)
</if>
GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time)
@ -143,7 +143,7 @@
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.terminal_device_type = '15'
)
</if>
GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time)
@ -180,7 +180,7 @@
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.terminal_device_type = '15'
)
</if>
GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time)
@ -217,7 +217,7 @@
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.terminal_device_type = '15'
)
</if>
GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time)
@ -260,8 +260,7 @@
<if test="systemType != null and systemType != '' ">
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.grade = 40 and cpm.terminal_device_type = '15'
)
GROUP BY
device_type,
@ -291,8 +290,7 @@
<if test="systemType != null and systemType != '' ">
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.grade = 40 and cpm.terminal_device_type = '15'
)
GROUP BY
device_type,
@ -324,7 +322,7 @@
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.terminal_device_type = '15'
)
GROUP BY
device_type,
@ -355,7 +353,7 @@
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.terminal_device_type = '15'
)
GROUP BY
device_type,
@ -408,7 +406,7 @@
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.terminal_device_type = '15'
)
</if>
GROUP BY TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time)
@ -448,7 +446,7 @@
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.terminal_device_type = '15'
)
</if>
GROUP BY EXTRACT(YEAR FROM cur_time)
@ -511,7 +509,7 @@
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.terminal_device_type = '15'
)
</if>
group by
@ -553,7 +551,7 @@
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.terminal_device_type = '15'
)
</if>
group by
@ -606,7 +604,7 @@
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.terminal_device_type = '15'
)
group by
substring(to_char(cur_time, 'YYYY-MM-DD HH24:MI:SS') from 1 for ${len}),
@ -637,7 +635,7 @@
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.terminal_device_type = '15'
)
group by
substring(to_char(cur_time, 'YYYY-MM-DD HH24:MI:SS') from 1 for ${len}),
@ -669,7 +667,7 @@
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.terminal_device_type = '15'
)
group by
extract(year from cur_time)
@ -698,7 +696,7 @@
and cpm.system_type = #{systemType}
</if>
and cpm.grade = 40
-- and cpm.terminal_device_type = '15'
and cpm.terminal_device_type = '15'
)
group by
extract(year from cur_time)
@ -1031,7 +1029,7 @@
order by timeStr
</select>
<select id="queryLineDataSysByOne" resultType="com.mh.common.core.domain.entity.ConsumptionAnalyze">
<select id="queryLineDataSysByOne" resultType="com.mh.common.core.domain.entity.ConsumptionAnalyze"><![CDATA[
select
sum(coalesce(calc_value,0)) as curValue,
'efrMeter' as deviceType,
@ -1041,7 +1039,7 @@
${curTable} dm
where
dm.cur_time >= #{startTime}::timestamp
and dm.cur_time &lt;= #{endTime}::timestamp
and dm.cur_time <= #{endTime}::timestamp
and dm.device_num in (
select
cpm.mt_num
@ -1068,7 +1066,7 @@
${curTable} dm
where
dm.cur_time >= #{startTime}::timestamp
and dm.cur_time &lt;= #{endTime}::timestamp
and dm.cur_time <= #{endTime}::timestamp
and dm.device_num in (
select
cpm.mt_num
@ -1080,14 +1078,15 @@
and dl.device_type = '6'
and cpm.grade = 140
and cpm.terminal_device_type = '15'
and cpm.param_type = '17'
)
group by
device_type,
TO_CHAR(dm.cur_time,
'YYYY-MM-DD HH24:MI')
</select>
]]></select>
<select id="queryLineDataSysByMany" resultType="com.mh.common.core.domain.entity.ConsumptionAnalyze">
<select id="queryLineDataSysByMany" resultType="com.mh.common.core.domain.entity.ConsumptionAnalyze"><![CDATA[
select
sum(coalesce(calc_value,0)) as curValue,
'efrMeter' as deviceType,
@ -1097,7 +1096,7 @@
${lastTable} dm
where
dm.cur_time >= #{startTime}::timestamp
and dm.cur_time &lt;= #{endTime}::timestamp
and dm.cur_time <= #{endTime}::timestamp
and dm.device_num in (
select
cpm.mt_num
@ -1123,7 +1122,7 @@
${lastTable} dm
where
dm.cur_time >= #{startTime}::timestamp
and dm.cur_time &lt;= #{endTime}::timestamp
and dm.cur_time <= #{endTime}::timestamp
and dm.device_num in (
select
cpm.mt_num
@ -1134,6 +1133,7 @@
cpm.device_ledger_id = dl.id
and dl.device_type = '6'
and cpm.grade = 140 and cpm.terminal_device_type = '15'
and cpm.param_type = '17'
)
group by
device_type,
@ -1149,7 +1149,7 @@
${curTable} dm
where
dm.cur_time >= #{startTime}::timestamp
and dm.cur_time &lt;= #{endTime}::timestamp
and dm.cur_time <= #{endTime}::timestamp
and dm.device_num in (
select
cpm.mt_num
@ -1175,7 +1175,7 @@
${curTable} dm
where
dm.cur_time >= #{startTime}::timestamp
and dm.cur_time &lt;= #{endTime}::timestamp
and dm.cur_time <= #{endTime}::timestamp
and dm.device_num in (
select
cpm.mt_num
@ -1185,13 +1185,13 @@
on
cpm.device_ledger_id = dl.id
and dl.device_type = '6'
and cpm.grade = 140 and cpm.terminal_device_type = '15'
and cpm.grade = 140 and cpm.terminal_device_type = '15' and cpm.param_type = '17'
)
group by
device_type,
TO_CHAR(dm.cur_time,
'YYYY-MM-DD HH24:MI')
</select>
]]></select>
<select id="queryDeviceLineManyTable" resultType="com.mh.common.core.domain.entity.ConsumptionAnalyze">
<if test="lastTableName != curTableName">

Loading…
Cancel
Save