Commit d22e9d88 authored by co_dengxiongwen's avatar co_dengxiongwen

接口调整

parent 445c079a
package com.devplatform.admin.modules.eq.controller;
import com.devplatform.admin.common.utils.AbstractController;
import com.devplatform.admin.common.utils.Constants;
import com.devplatform.admin.common.utils.DateUtil;
import com.devplatform.admin.common.utils.DateUtils;
import com.devplatform.admin.modules.eq.bean.SwqxzInfoHour;
......@@ -19,6 +20,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -69,6 +72,7 @@ public class AnalysisController extends AbstractController {
List<List<String>> carbonDioxideList = new ArrayList<List<String>>();
List<List<String>> fineParticlesList = new ArrayList<List<String>>();
List<List<String>> radiationList = new ArrayList<List<String>>();
List<List<String>> bjList = new ArrayList<List<String>>();
for (int i = 0; i < list.size(); i++) {
List<String> temperatureListDetail = new ArrayList<String>();
......@@ -111,13 +115,33 @@ public class AnalysisController extends AbstractController {
radiationList.add(radiationListDetail);
}
List<Map<String,Object>> alarmList = sysFaulalarmService.getCountByResourceType(Constants.ID_SWQXZ,startTime,endTime);
if(alarmList != null && alarmList.size() > 0 ){
for (int i = 0; i < alarmList.size(); i++) {
List<String> bjListDetail = new ArrayList<String>();
SimpleDateFormat sdfLongTime = new SimpleDateFormat("yyyyMMddHH");
Date d = (Date) alarmList.get(i).get("start_time");
try{
String time = DateUtil.getPlusTime(sdfLongTime.parse(sdfLongTime.format(d)));
bjListDetail.add(time);
}catch (ParseException e){
e.printStackTrace();
}
bjListDetail.add(alarmList.get(i).get("total").toString());
bjList.add(bjListDetail);
}
}
return R.ok().put("temperatureList", temperatureList)
.put("humidityList", humidityList)
.put("windSpeedList", windSpeedList)
.put("illuminanceList", illuminanceList)
.put("carbonDioxideList", carbonDioxideList)
.put("fineParticlesList", fineParticlesList)
.put("radiationList", radiationList);
.put("radiationList", radiationList)
.put("bjList",bjList);
}
/**
......@@ -138,6 +162,7 @@ public class AnalysisController extends AbstractController {
List<List<String>> temperatureList = new ArrayList<List<String>>();
List<List<String>> humidityList = new ArrayList<List<String>>();
List<List<String>> carbonDioxideList = new ArrayList<List<String>>();
List<List<String>> bjList = new ArrayList<List<String>>();
for (int i = 0; i < list.size(); i++) {
List<String> temperatureListDetail = new ArrayList<String>();
......@@ -160,9 +185,29 @@ public class AnalysisController extends AbstractController {
carbonDioxideList.add(carbonDioxideListDetail);
}
List<Map<String,Object>> alarmList = sysFaulalarmService.getCountByResourceType(Constants.ID_SNQXZ,startTime,endTime);
if(alarmList != null && alarmList.size() > 0 ){
for (int i = 0; i < alarmList.size(); i++) {
List<String> bjListDetail = new ArrayList<String>();
SimpleDateFormat sdfLongTime = new SimpleDateFormat("yyyyMMddHH");
Date d = (Date) alarmList.get(i).get("start_time");
try{
String time = DateUtil.getPlusTime(sdfLongTime.parse(sdfLongTime.format(d)));
bjListDetail.add(time);
}catch (ParseException e){
e.printStackTrace();
}
bjListDetail.add(alarmList.get(i).get("total").toString());
bjList.add(bjListDetail);
}
}
return R.ok().put("temperatureList", temperatureList)
.put("humidityList", humidityList)
.put("carbonDioxideList", carbonDioxideList);
.put("carbonDioxideList", carbonDioxideList)
.put("bjList",bjList);
}
/**
......
......@@ -10,7 +10,6 @@ import com.devplatform.admin.config.WebSocket;
import com.devplatform.admin.modules.eq.bean.TimedTask;
import com.devplatform.admin.modules.eq.service.EquipmentService;
import com.devplatform.admin.modules.eq.service.TimedTaskService;
import com.devplatform.admin.modules.liresource.bean.LiResource;
import com.devplatform.admin.modules.liresource.bean.LiStation;
import com.devplatform.admin.modules.liresource.model.LiResourceModel;
import com.devplatform.admin.modules.liresource.service.LiResourceService;
......@@ -31,7 +30,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 设备控制
......@@ -315,7 +317,7 @@ public class EquipmentController extends AbstractController {
@ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String")
@PostMapping("/checkModel")
public R checkModel(Integer type,Integer status) {
// 控制资源点启停
// 控制资源点
checkModelOnOrOff(type, status);
SysSystemParams sysSystemParams = sysSystemParamsService.getById(Constants.STRING_1);
......@@ -380,23 +382,24 @@ public class EquipmentController extends AbstractController {
* @param type 1=供暖模式,2=机械通风,3=自然通风
* @param status 1=开启,2=关闭
*/
private void checkModelOnOrOff(Integer type, Integer status) {
List<LiResource> list = new ArrayList<LiResource>();
// 查询所有模式匹配的资源点
list = liResourceService.queryListByParam(type.toString());
for (int i = 0; i < list.size(); i++) {
LiResourceModel model = new LiResourceModel();
model.setId(list.get(i).getId());
model.setStatus(status==1?1:0);
model.setActionName(list.get(i).getName() + (status==1?"开启":"关闭"));
//操作类型,1=开关
model.setActionType(1);
onOrOff(model);
private Map<String, Object> checkModelOnOrOff(Integer type, Integer status) {
String postUrl = "http://localhost:8089/command/operationType";
Map<String, String> postParam = new HashMap<String, String>(10);
postParam.put("params",status==1 ? "1": "0");
postParam.put("rgType", type.toString());
postParam.put("userId", getUserId());
postParam.put("userName", getUser().getName());
Map<String, Object> resultMap = TestClient.uploadText(postUrl, postParam);
Map<String, Object> map = null;
if (Constants.STRING_200.equals(resultMap.get(Constants.STATUS_CODE).toString())) {
map = JSONObject.parseObject(resultMap.get("data").toString(), Map.class);
}
return map;
}
private Map<String, Object> onOrOff(LiResourceModel model) {
String postUrl = "http://10.2.72.33:8089/command/operation";
String postUrl = "http://localhost:8089/command/operation";
Map<String, String> postParam = new HashMap<String, String>(10);
postParam.put("liResourceId", model.getId());
postParam.put("params", model.getStatus().toString());
......
......@@ -50,8 +50,6 @@ public class KanBanController extends AbstractController {
return R.ok().put("list", getMyPage(list,model));
}
/**
* 查询历史数据
* @param params
......
......@@ -33,4 +33,6 @@ public interface TotalDayDao extends MyBaseMapper<TotalDay> {
List<TotalDay> queryPageList(TotalDayModel model);
List<Map<String,Object>> queryList(@Param("startTime")String startTime,@Param("endTime")String endTime);
Map<String, Object> totalDay(@Param("time")String time, @Param("type")Integer type);
}
......@@ -33,4 +33,6 @@ public interface TotalMonthDao extends MyBaseMapper<TotalMonth> {
List<TotalMonth> queryPageList(TotalMonthModel model);
List<Map<String, Object>> queryList(@Param("startTime")String startTime,@Param("endTime")String endTime);
Map<String, Object> totalMonth(@Param("time")String time, @Param("type")Integer type);
}
......@@ -24,4 +24,6 @@ public interface TotalDayService extends MyBaseService<TotalDay> {
List<TotalDay> queryPageList(TotalDayModel model);
List<Map<String,Object>> queryList(String startTime,String endTime);
Map<String,Object> totalDay(String time,Integer type);
}
......@@ -24,4 +24,6 @@ public interface TotalMonthService extends MyBaseService<TotalMonth> {
List<TotalMonth> queryPageList(TotalMonthModel model);
List<Map<String, Object>> queryList(String startTime,String endTime);
Map<String,Object> totalMonth(String time,Integer type);
}
package com.devplatform.admin.modules.eq.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devplatform.admin.common.utils.Constants;
import com.devplatform.admin.common.utils.DateUtil;
import com.devplatform.admin.common.utils.DateUtils;
import com.devplatform.admin.modules.eq.service.*;
import com.devplatform.admin.modules.liresource.bean.LiResource;
import com.devplatform.admin.modules.liresource.service.LiResourceService;
import com.devplatform.admin.modules.sys.bean.SysSystemParams;
import com.devplatform.admin.modules.sys.service.SysSystemParamsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
/**
......@@ -37,12 +41,17 @@ public class AnalysisServiceImpl implements AnalysisService {
private DlswjInfoService dlswjInfoService;
@Autowired
private SljfgInfoService sljfgInfoService;
@Autowired
private LiResourceService liResourceService;
@Override
public Map<String,Object> getSyParam(){
Map<String,Object> map = new HashMap<>();
try {
SysSystemParams sysSystemParams = sysSystemParamsService.getById(Constants.STRING_1);
int count = liResourceService.count(new LambdaQueryWrapper<LiResource>()
.eq(LiResource::getStatus,Constants.INT_4)
.eq(LiResource::getDeleted,Constants.INT_0));
Integer dayTime = Integer.valueOf(sysSystemParams.getSystemRunningTime())/(24*60*60);
Integer hourTime = Integer.valueOf(sysSystemParams.getSystemRunningTime())%(24*60*60)/(60*60);
......@@ -55,7 +64,7 @@ public class AnalysisServiceImpl implements AnalysisService {
//系统运行时间
map.put("systemRunningTime",timeList);
//报警总数
map.put("faultAlarm",2);
map.put("faultAlarm",count);
//供暖模式
map.put("sun",sysSystemParams.getSun());
//机械通风模式
......@@ -76,22 +85,62 @@ public class AnalysisServiceImpl implements AnalysisService {
//能耗
Map<String,Object> energy = new HashMap<>();
SimpleDateFormat sdfLongTime = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat sdfLongTime2 = new SimpleDateFormat("yyyyMM");
Date now = new Date();
String time = sdfLongTime.format(now);
String time2 = sdfLongTime2.format(now);
Map<String, Object> dayMap = totalDayService.totalDay(time,Constants.INT_1);
Map<String, Object> dayMap2 = totalDayService.totalDay(time,Constants.INT_2);
Map<String, Object> monthMap = totalMonthService.totalMonth(time2,Constants.INT_1);
Map<String, Object> monthMap2 = totalMonthService.totalMonth(time2,Constants.INT_2);
String sdEnergyDay = Constants.STRING_0;
String jnEnergyDay = Constants.STRING_0;
String sdEnergyMonth = Constants.STRING_0;
String jnEnergyMonth = Constants.STRING_0;
if(dayMap != null && dayMap.size() >= 0){
if(dayMap.containsKey("electric_energy")){
sdEnergyDay = dayMap.get("electric_energy").toString();
}
}
if(dayMap2 != null && dayMap2.size() >= 0){
if(dayMap2.containsKey("electric_energy")){
jnEnergyDay = dayMap2.get("electric_energy").toString();
}
}
if(monthMap != null && monthMap.size() >= 0){
if(monthMap.containsKey("electric_energy")){
sdEnergyMonth = monthMap.get("electric_energy").toString();
}
}
if(monthMap2 != null && monthMap2.size() >= 0){
if(monthMap2.containsKey("electric_energy")){
jnEnergyMonth = monthMap2.get("electric_energy").toString();
}
}
//当天
//手动运行时间-天
energy.put("sdSystemRunningTimeDay",sysSystemParams.getSdSystemRunningTimeDay());
Integer sdHour = Integer.valueOf(sysSystemParams.getSdSystemRunningTimeDay())/(60*60);
Integer jnHour = Integer.valueOf(sysSystemParams.getJnSystemRunningTimeDay())/(60*60);
energy.put("sdSystemRunningTimeDay",sdHour);
//节能运行时间-天
energy.put("jnSystemRunningTimeDay",sysSystemParams.getJnSystemRunningTimeDay());
energy.put("sdEnergyDay",100);
energy.put("jnEnergyDay",100);
energy.put("totalEnergyDay",200);
energy.put("jnSystemRunningTimeDay",jnHour);
energy.put("sdEnergyDay",sdEnergyDay);
energy.put("jnEnergyDay",jnEnergyDay);
energy.put("totalEnergyDay",0);
//当月
//手动运行时间-月
energy.put("sdSystemRunningTimeMonth",sysSystemParams.getSdSystemRunningTimeMonth());
Integer sdHourM = Integer.valueOf(sysSystemParams.getSdSystemRunningTimeMonth())/(60*60);
Integer jnHourM = Integer.valueOf(sysSystemParams.getJnSystemRunningTimeMonth())/(60*60);
energy.put("sdSystemRunningTimeMonth",sdHourM);
//节能运行时间-月
energy.put("jnSystemRunningTimeMonth",sysSystemParams.getJnSystemRunningTimeMonth());
energy.put("sdEnergyMonth",1000);
energy.put("jnEnergyMonth",1000);
energy.put("totalEnergyMonth",2000);
energy.put("jnSystemRunningTimeMonth",jnHourM);
energy.put("sdEnergyMonth",sdEnergyMonth);
energy.put("jnEnergyMonth",jnEnergyMonth);
energy.put("totalEnergyMonth",0);
map.put("energy",energy);
//能耗统计
......
......@@ -2,6 +2,7 @@ package com.devplatform.admin.modules.eq.service.impl;
import com.devplatform.admin.common.utils.Constants;
import com.devplatform.admin.modules.eq.service.*;
import com.devplatform.admin.modules.liresource.service.LiResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -39,6 +40,8 @@ public class EquipmentServiceImpl implements EquipmentService {
private SnqxzInfoHourService snqxzInfoHourService;
@Autowired
private DlxfsnjInfoService dlxfsnjInfoService;
@Autowired
private LiResourceService liResourceService;
@Override
public Map<String, Object> getList() {
......@@ -61,6 +64,9 @@ public class EquipmentServiceImpl implements EquipmentService {
List<Map<String,Object>> snqxzList = snqxzInfoService.getList();
//室外气象站
List<Map<String,Object>> swqxzList = swqxzInfoService.getList();
//多联新风处理机室内机
List<Map<String,Object>> dlxfsnjList = dlxfsnjInfoService.getList();
......
......@@ -31,5 +31,10 @@ public class TotalDayServiceImpl extends MyBaseServiceImpl<TotalDayDao, TotalDay
return baseMapper.queryList(startTime,endTime);
}
@Override
public Map<String, Object> totalDay(String time, Integer type) {
return baseMapper.totalDay(time,type);
}
}
......@@ -31,4 +31,9 @@ public class TotalMonthServiceImpl extends MyBaseServiceImpl<TotalMonthDao, Tota
return baseMapper.queryList(startTime,endTime);
}
@Override
public Map<String, Object> totalMonth(String time, Integer type) {
return baseMapper.totalMonth(time,type);
}
}
......@@ -45,4 +45,6 @@ public interface SysFaulalarmDao extends MyBaseMapper<SysFaulalarm> {
* @return
*/
List<Map<String, Object>> getListGroupByResourceId(@Param("params")Map<String, Object> params);
List<Map<String, Object>> getCountByResourceType(@Param("resourceType")String resourceType,@Param("startTime")String startTime,@Param("endTime")String endTime);
}
......@@ -35,4 +35,11 @@ public interface SysFaulalarmService extends MyBaseService<SysFaulalarm> {
* @return
*/
List<Map<String,Object>> getListGroupByResourceId(Map<String, Object> params);
/**
* 按资源点类型得到当天的报警数
* @param resourceType
* @return
*/
List<Map<String,Object>> getCountByResourceType(String resourceType,String startTime,String endTime);
}
......@@ -35,4 +35,9 @@ public class SysFaulalarmServiceImpl extends MyBaseServiceImpl<SysFaulalarmDao,
public List<Map<String, Object>> getListGroupByResourceId(Map<String, Object> params) {
return baseMapper.getListGroupByResourceId(params);
}
@Override
public List<Map<String, Object>> getCountByResourceType(String resourceType,String startTime,String endTime) {
return baseMapper.getCountByResourceType(resourceType,startTime,endTime);
}
}
......@@ -44,7 +44,7 @@
</select>
<select id="queryPageListByParam" resultType="java.util.Map">
select t.* from dlswj_info_day t
select t.create_time,cast(sum(cast(t.electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from dlswj_info_day t
where 1=1
<if test="params.resourceId!=null and params.resourceId!=''">
and t.resource_id = #{params.resourceId}
......@@ -58,6 +58,7 @@
<if test="params.endTime != null and params.endTime != ''">
and t.create_time &lt;= #{params.endTime}
</if>
group by t.create_time
<if test="params.sort != null and params.sort != '' and params.order != null and params.order != ''">
ORDER BY ${params.sort} ${params.order}
</if>
......@@ -67,7 +68,7 @@
</select>
<select id="queryListByParam" resultType="java.util.Map">
select create_time,sum(cast(electric_energy as decimal(10, 5))) as electric_energy
select create_time,cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy
from dlswj_info_day
where 1=1
<if test="(startTime == null or startTime == '') and (endTime == null or endTime == '')">
......
......@@ -44,7 +44,7 @@
</select>
<select id="queryPageListByParam" resultType="java.util.Map">
select t.* from dlswj_info_hour t
select t.create_time,cast(sum(cast(t.electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from dlswj_info_hour t
where 1=1
<if test="params.resourceId!=null and params.resourceId!=''">
and t.resource_id = #{params.resourceId}
......@@ -58,6 +58,7 @@
<if test="params.endTime != null and params.endTime != ''">
and t.create_time &lt;= #{params.endTime}
</if>
group by t.create_time
<if test="params.sort != null and params.sort != '' and params.order != null and params.order != ''">
ORDER BY ${params.sort} ${params.order}
</if>
......@@ -67,7 +68,7 @@
</select>
<select id="queryListByParam" resultType="java.util.Map">
select create_time,sum(cast(electric_energy as decimal(10, 5))) as electric_energy
select create_time,cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy
from dlswj_info_hour
where 1=1
<if test="(startTime == null or startTime == '') and (endTime == null or endTime == '')">
......
......@@ -44,7 +44,7 @@
</select>
<select id="queryPageListByParam" resultType="java.util.Map">
select t.* from dlswj_info_month t
select t.create_time,cast(sum(cast(t.electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from dlswj_info_month t
where 1=1
<if test="params.resourceId!=null and params.resourceId!=''">
and t.resource_id = #{params.resourceId}
......@@ -58,6 +58,7 @@
<if test="params.endTime != null and params.endTime != ''">
and t.create_time &lt;= #{params.endTime}
</if>
group by t.create_time
<if test="params.sort != null and params.sort != '' and params.order != null and params.order != ''">
ORDER BY ${params.sort} ${params.order}
</if>
......@@ -67,7 +68,7 @@
</select>
<select id="queryListByParam" resultType="java.util.Map">
select create_time,sum(cast(electric_energy as decimal(10, 5))) as electric_energy
select create_time,cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy
from dlswj_info_month
where 1=1
<if test="(startTime == null or startTime == '') and (endTime == null or endTime == '')">
......
......@@ -44,7 +44,7 @@
</select>
<select id="queryPageListByParam" resultType="java.util.Map">
select t.* from jfktp_info_day t
select t.create_time,cast(sum(cast(t.electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from jfktp_info_day t
where 1=1
<if test="params.resourceId!=null and params.resourceId!=''">
and t.resource_id = #{params.resourceId}
......@@ -58,6 +58,7 @@
<if test="params.endTime != null and params.endTime != ''">
and t.create_time &lt;= #{params.endTime}
</if>
group by t.create_time
<if test="params.sort != null and params.sort != '' and params.order != null and params.order != ''">
ORDER BY ${params.sort} ${params.order}
</if>
......@@ -67,7 +68,7 @@
</select>
<select id="queryListByParam" resultType="java.util.Map">
select create_time,sum(cast(electric_energy as decimal(10, 5))) as electric_energy
select create_time,cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy
from jfktp_info_day
where 1=1
<if test="(startTime == null or startTime == '') and (endTime == null or endTime == '')">
......
......@@ -44,7 +44,7 @@
</select>
<select id="queryPageListByParam" resultType="java.util.Map">
select t.* from jfktp_info_hour t
select t.create_time,cast(sum(cast(t.electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from jfktp_info_hour t
where 1=1
<if test="params.resourceId!=null and params.resourceId!=''">
and t.resource_id = #{params.resourceId}
......@@ -58,6 +58,7 @@
<if test="params.endTime != null and params.endTime != ''">
and t.create_time &lt;= #{params.endTime}
</if>
group by t.create_time
<if test="params.sort != null and params.sort != '' and params.order != null and params.order != ''">
ORDER BY ${params.sort} ${params.order}
</if>
......@@ -67,7 +68,7 @@
</select>
<select id="queryListByParam" resultType="java.util.Map">
select create_time,sum(cast(electric_energy as decimal(10, 5))) as electric_energy
select create_time,cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy
from jfktp_info_hour
where 1=1
<if test="(startTime == null or startTime == '') and (endTime == null or endTime == '')">
......
......@@ -44,7 +44,7 @@
</select>
<select id="queryPageListByParam" resultType="java.util.Map">
select t.* from jfktp_info_month t
select t.create_time,cast(sum(cast(t.electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from jfktp_info_month t
where 1=1
<if test="params.resourceId!=null and params.resourceId!=''">
and t.resource_id = #{params.resourceId}
......@@ -58,6 +58,7 @@
<if test="params.endTime != null and params.endTime != ''">
and t.create_time &lt;= #{params.endTime}
</if>
group by t.create_time
<if test="params.sort != null and params.sort != '' and params.order != null and params.order != ''">
ORDER BY ${params.sort} ${params.order}
</if>
......@@ -67,7 +68,7 @@
</select>
<select id="queryListByParam" resultType="java.util.Map">
select create_time,sum(cast(electric_energy as decimal(10, 5))) as electric_energy
select create_time,cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy
from jfktp_info_month
where 1=1
<if test="(startTime == null or startTime == '') and (endTime == null or endTime == '')">
......
......@@ -44,7 +44,7 @@
</select>
<select id="queryPageListByParam" resultType="java.util.Map">
select t.* from pfj_info_day t
select t.create_time,cast(sum(cast(t.electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from pfj_info_day t
where 1=1
<if test="params.resourceId!=null and params.resourceId!=''">
and t.resource_id = #{params.resourceId}
......@@ -58,6 +58,7 @@
<if test="params.endTime != null and params.endTime != ''">
and t.create_time &lt;= #{params.endTime}
</if>
group by t.create_time
<if test="params.sort != null and params.sort != '' and params.order != null and params.order != ''">
ORDER BY ${params.sort} ${params.order}
</if>
......@@ -67,7 +68,7 @@
</select>
<select id="queryListByParam" resultType="java.util.Map">
select create_time,sum(cast(electric_energy as decimal(10, 5))) as electric_energy
select create_time,cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy
from pfj_info_day
where 1=1
<if test="(startTime == null or startTime == '') and (endTime == null or endTime == '')">
......
......@@ -43,7 +43,7 @@
</if>
</select>
<select id="queryPageListByParam" resultType="java.util.Map">
select t.* from pfj_info_hour t
select t.create_time,cast(sum(cast(t.electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from pfj_info_hour t
where 1=1
<if test="params.resourceId!=null and params.resourceId!=''">
and t.resource_id = #{params.resourceId}
......@@ -57,6 +57,7 @@
<if test="params.endTime != null and params.endTime != ''">
and t.create_time &lt;= #{params.endTime}
</if>
group by t.create_time
<if test="params.sort != null and params.sort != '' and params.order != null and params.order != ''">
ORDER BY ${params.sort} ${params.order}
</if>
......@@ -66,7 +67,7 @@
</select>
<select id="queryListByParam" resultType="java.util.Map">
select create_time,sum(cast(electric_energy as decimal(10, 5))) as electric_energy
select create_time,cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy
from pfj_info_hour
where 1=1
<if test="(startTime == null or startTime == '') and (endTime == null or endTime == '')">
......
......@@ -44,7 +44,7 @@
</select>
<select id="queryPageListByParam" resultType="java.util.Map">
select t.* from pfj_info_month t
select t.create_time,cast(sum(cast(t.electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from pfj_info_month t
where 1=1
<if test="params.resourceId!=null and params.resourceId!=''">
and t.resource_id = #{params.resourceId}
......@@ -58,6 +58,7 @@
<if test="params.endTime != null and params.endTime != ''">
and t.create_time &lt;= #{params.endTime}
</if>
group by t.create_time
<if test="params.sort != null and params.sort != '' and params.order != null and params.order != ''">
ORDER BY ${params.sort} ${params.order}
</if>
......@@ -67,7 +68,7 @@
</select>
<select id="queryListByParam" resultType="java.util.Map">
select create_time,sum(cast(electric_energy as decimal(10, 5))) as electric_energy
select create_time,cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy
from pfj_info_month
where 1=1
<if test="(startTime == null or startTime == '') and (endTime == null or endTime == '')">
......
......@@ -67,7 +67,7 @@
</select>
<select id="queryListByParam" resultType="java.util.Map">
select create_time,sum(cast(electric_energy as decimal(10, 5))) as electric_energy
select create_time,cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy
from sljfg_info_hour
where 1=1
<if test="(startTime == null or startTime == '') and (endTime == null or endTime == '')">
......
......@@ -67,7 +67,7 @@
</select>
<select id="queryListByParam" resultType="java.util.Map">
select create_time,sum(cast(electric_energy as decimal(10, 5))) as electric_energy
select create_time,cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy
from sljfg_info_month
where 1=1
<if test="(startTime == null or startTime == '') and (endTime == null or endTime == '')">
......
......@@ -115,8 +115,8 @@
<select id="getParamGroupByRegion" resultType="java.util.Map">
select
cast(AVG(cast(temperature as decimal(10, 1))) as decimal(10, 1)) as temperature,
cast(AVG(cast(humidity as decimal(10, 2))) as decimal(10, 2)) as humidity,
cast(AVG(cast(carbon_dioxide as decimal(10, 2))) as decimal(10, 2)) as carbon_dioxide,
cast(AVG(cast(humidity as decimal(10, 1))) as decimal(10, 1)) as humidity,
cast(AVG(cast(carbon_dioxide as decimal(10, 0))) as decimal(10, 0)) as carbon_dioxide,
region
from snqxz_info_hour
where 1=1 and TO_DAYS(create_time) = TO_DAYS(NOW())
......
......@@ -51,6 +51,15 @@
</if>
order by create_time
</select>
<select id="totalDay" resultType="java.util.Map">
SELECT SUM(t.electric_energy) as electric_energy
from
(select cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from pfj_info_day where date_format(create_time,'%Y%m%d') = #{time} and type = #{type}
UNION ALL
select cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from dlswj_info_day where date_format(create_time,'%Y%m%d') = #{time} and type = #{type}
UNION ALL
select cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from jfktp_info_day where date_format(create_time,'%Y%m%d') = #{time} and type = #{type}) t
</select>
</mapper>
......
......@@ -51,6 +51,15 @@
</if>
order by create_time
</select>
<select id="totalMonth" resultType="java.util.Map">
SELECT SUM(t.electric_energy) as electric_energy
from
(select cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from pfj_info_month where date_format(create_time,'%Y%m') = #{time} and type = #{type}
UNION ALL
select cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from dlswj_info_month where date_format(create_time,'%Y%m') = #{time} and type = #{type}
UNION ALL
select cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from jfktp_info_month where date_format(create_time,'%Y%m') = #{time} and type = #{type}) t
</select>
</mapper>
......
......@@ -209,10 +209,12 @@
<select id="getTreeList" parameterType="Object" resultMap="BaseResultMap">
SELECT
li.*,
lis.`name` AS tierName
lis.`name` AS tierName,
sdb.name as brandName
FROM
li_resource li
LEFT JOIN li_station_map lis ON lis.id = li.tier_id
left join sys_dictionary sdb on sdb.id = li.brand
<include refid="queryPageByListClause2"></include>
ORDER BY li.create_time DESC
</select>
......
......@@ -62,7 +62,7 @@
</select>
<select id="getListGroupByResourceId" resultType="java.util.Map">
select lr.name as name,t.value from
select lr.name as name,t.value,lr.id as resource_id,lr.type as resource_type from
(select resource_id,count(1) as value from
sys_fault_alarm
where 1=1
......@@ -79,6 +79,22 @@
left join li_resource lr on lr.id = t.resource_id
order by t.value desc
</select>
<select id="getCountByResourceType" resultType="java.util.Map">
SELECT COUNT(1) as total,start_time
from sys_fault_alarm
where resource_type = #{resourceType}
<if test="(startTime == null or startTime == '') and (endTime == null or endTime == '')">
and TO_DAYS(start_time) = TO_DAYS(NOW())
</if>
<if test="startTime != null and startTime != ''">
and start_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and start_time &lt;= #{endTime}
</if>
GROUP BY date_format(start_time,'%Y%m%d%H')
order by start_time
</select>
</mapper>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment