Commit ade318ad authored by dxw's avatar dxw

设备代码调整

parent ac7f4095
...@@ -43,13 +43,13 @@ public class InitRunner implements CommandLineRunner { ...@@ -43,13 +43,13 @@ public class InitRunner implements CommandLineRunner {
System.err.println("定时任务启动失败!!"); System.err.println("定时任务启动失败!!");
} }
} }
// else if(sysSystemParams.getType() == 2 && timedTask.getBusinessType() == Constants.INT_3) { else if(sysSystemParams.getType() == 2 && timedTask.getBusinessType() == Constants.INT_3) {
// R r = equipmentController.timedTask(timedTask.getId(), timedTask.getStartTime(), timedTask.getEndTime(), Constants.INT_1, R r = equipmentController.timedTask(timedTask.getId(), timedTask.getStartTime(), timedTask.getEndTime(), Constants.INT_1,
// timedTask.getBusinessType(), timedTask.getType(), Constants.STRING_1); timedTask.getBusinessType(), timedTask.getType(), Constants.STRING_1);
// if (!Constants.STRING_0.equals(r.get(Constants.CODE_WORD).toString())) { if (!Constants.STRING_0.equals(r.get(Constants.CODE_WORD).toString())) {
// System.err.println("定时任务启动失败!!"); System.err.println("定时任务启动失败!!");
// } }
// } }
} }
} }
} catch (Exception e) { } catch (Exception e) {
......
package com.devplatform.admin.common.scheduling; package com.devplatform.admin.common.scheduling;
import com.alibaba.fastjson.JSONObject;
import com.devplatform.admin.common.utils.Constants; import com.devplatform.admin.common.utils.Constants;
import com.devplatform.admin.common.utils.TestClient;
import org.quartz.*; import org.quartz.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/** /**
* @author dxw * @author dxw
...@@ -22,12 +26,19 @@ public class SimpleJob implements Job { ...@@ -22,12 +26,19 @@ public class SimpleJob implements Job {
Integer status = (Integer) jobDataMap.get("status"); Integer status = (Integer) jobDataMap.get("status");
Integer type = (Integer) jobDataMap.get("type"); Integer type = (Integer) jobDataMap.get("type");
Integer businessType = (Integer) jobDataMap.get("businessType"); Integer businessType = (Integer) jobDataMap.get("businessType");
if(businessType == Constants.INT_1){
//status 1:开启设备 2: 关闭设备
if(status == Constants.INT_1){
}else{ Map<String, String> postParam = new HashMap<String, String>(10);
if(businessType == Constants.INT_1){
LOG.info("执行定时启停任务");
String postUrl = "http://localhost:8089/command/startOrStopTask";
postParam.put("params",status.toString());
postParam.put("actionType",Constants.STRING_1);
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);
} }
}else if(businessType == Constants.INT_2){ }else if(businessType == Constants.INT_2){
//type 1:上升 2:下降 //type 1:上升 2:下降
...@@ -38,6 +49,12 @@ public class SimpleJob implements Job { ...@@ -38,6 +49,12 @@ public class SimpleJob implements Job {
} }
}else if(businessType == Constants.INT_3){ }else if(businessType == Constants.INT_3){
LOG.info("执行节能任务"); LOG.info("执行节能任务");
String postUrl = "http://localhost:8089/command/energyTask";
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);
}
} }
} }
} }
...@@ -661,4 +661,41 @@ public class Constants { ...@@ -661,4 +661,41 @@ public class Constants {
*/ */
public static final String QUEUE_NAME = "zyd_message_"; public static final String QUEUE_NAME = "zyd_message_";
/**
* 左水泵1
*/
public static final String ID_SB_1 = "71ef34a9246945d6a446444b54856001";
/**
* 左水泵2
*/
public static final String ID_SB_2 = "71ef34a9246945d6a446444b54856002";
/**
* 右水泵1
*/
public static final String ID_SB_3 = "71ef34a9246945d6a446444b54856003";
/**
* 右水泵2
*/
public static final String ID_SB_4 = "71ef34a9246945d6a446444b54856004";
/**
* 左热泵主机1
*/
public static final String ID_FLRBJZ_1 = "21b83b939a3848ae8a38368a59ca0001";
/**
* 左热泵主机2
*/
public static final String ID_FLRBJZ_2 = "21b83b939a3848ae8a38368a59ca0002";
/**
* 右热泵主机1
*/
public static final String ID_FLRBJZ_3 = "21b83b939a3848ae8a38368a59ca0003";
/**
* 右热泵主机2
*/
public static final String ID_FLRBJZ_4 = "21b83b939a3848ae8a38368a59ca0004";
} }
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.devplatform.admin.common.scheduling.SimpleJob; import com.devplatform.admin.common.scheduling.SimpleJob;
import com.devplatform.admin.common.utils.AbstractController; import com.devplatform.admin.common.utils.AbstractController;
import com.devplatform.admin.common.utils.Constants; import com.devplatform.admin.common.utils.Constants;
import com.devplatform.admin.common.utils.DateUtil;
import com.devplatform.admin.common.utils.TestClient; import com.devplatform.admin.common.utils.TestClient;
import com.devplatform.admin.config.WebSocket; import com.devplatform.admin.config.WebSocket;
import com.devplatform.admin.modules.eq.bean.TimedTask; import com.devplatform.admin.modules.eq.bean.TimedTask;
...@@ -23,6 +24,7 @@ import com.devplatform.common.util.R; ...@@ -23,6 +24,7 @@ import com.devplatform.common.util.R;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.ToString;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.quartz.*; import org.quartz.*;
import org.quartz.impl.StdSchedulerFactory; import org.quartz.impl.StdSchedulerFactory;
...@@ -39,6 +41,7 @@ import java.util.Map; ...@@ -39,6 +41,7 @@ import java.util.Map;
* 设备控制 * 设备控制
* @author dxw * @author dxw
*/ */
@ToString
@Api(tags={"设备接口"}) @Api(tags={"设备接口"})
@RestController @RestController
@RequestMapping("/equipment") @RequestMapping("/equipment")
...@@ -117,24 +120,27 @@ public class EquipmentController extends AbstractController { ...@@ -117,24 +120,27 @@ public class EquipmentController extends AbstractController {
sysSystemRunningTimeService.save(temp); sysSystemRunningTimeService.save(temp);
if(type == Constants.INT_1){ if(type == Constants.INT_1){
// TimedTask timedTaskJn = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus,Constants.INT_1).eq(TimedTask::getBusinessType,Constants.INT_3).last("limit 1")); TimedTask timedTaskJn = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus,Constants.INT_1).eq(TimedTask::getBusinessType,Constants.INT_3).last("limit 1"));
// if(timedTaskJn != null){ if(timedTaskJn != null){
// this.timedTask(timedTaskJn.getId(),timedTaskJn.getStartTime(),timedTaskJn.getEndTime(),Constants.INT_2,Constants.INT_3,null,""); this.timedTask(timedTaskJn.getId(),timedTaskJn.getStartTime(),timedTaskJn.getEndTime(),Constants.INT_2,Constants.INT_3,null,"");
// } }
}else if(type == Constants.INT_2){//如果切换成节能模式,则关闭人工模式的定时任务,打开节能模式定时任务 }else if(type == Constants.INT_2){//如果切换成节能模式,则关闭人工模式的定时任务,打开节能模式定时任务
TimedTask timedTask = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus,Constants.INT_1) TimedTask timedTask = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus,Constants.INT_1)
// .eq(TimedTask::getBusinessType,Constants.INT_1) .eq(TimedTask::getBusinessType,Constants.INT_1)
.last("limit 1")); .last("limit 1"));
if(timedTask != null){ if(timedTask != null){
this.timedTask(timedTask.getId(),timedTask.getStartTime(),timedTask.getEndTime(),Constants.INT_2,1,null,""); this.timedTask(timedTask.getId(),timedTask.getStartTime(),timedTask.getEndTime(),Constants.INT_2,1,null,"");
} }
// TimedTask timedTaskJn = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus,Constants.INT_1).eq(TimedTask::getBusinessType,Constants.INT_3).last("limit 1")); TimedTask timedTaskJn = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus,Constants.INT_2).eq(TimedTask::getBusinessType,Constants.INT_3).last("limit 1"));
// if(timedTaskJn != null){ if(timedTaskJn != null){
// this.timedTask(timedTaskJn.getId(),timedTaskJn.getStartTime(),timedTaskJn.getEndTime(),Constants.INT_1,Constants.INT_3,null,""); this.timedTask(timedTaskJn.getId(), DateUtil.convertDateToMinute(time),timedTaskJn.getEndTime(),Constants.INT_1,Constants.INT_3,null,"");
// }else{ }else{
// this.timedTask("","30","",Constants.INT_1,Constants.INT_3,null,""); this.timedTask("",DateUtil.convertDateToMinute(time),"",Constants.INT_1,Constants.INT_3,null,"");
// } }
//执行节能任务
energyTask();
} }
Map<String,Object> list = equipmentService.getList(); Map<String,Object> list = equipmentService.getList();
...@@ -253,7 +259,13 @@ public class EquipmentController extends AbstractController { ...@@ -253,7 +259,13 @@ public class EquipmentController extends AbstractController {
String cron1 = ""; String cron1 = "";
if(businessType == Constants.INT_3){ if(businessType == Constants.INT_3){
cron1 = createCron2(startTime); int time = Integer.valueOf(startTime) + 30;
int time2 = time < 60 ? time : (time - 60);
if(Integer.valueOf(startTime).intValue() > time2){
cron1 = createCron2(String.valueOf(time2),startTime);
}else{
cron1 = createCron2(startTime,String.valueOf(time2));
}
}else{ }else{
cron1 = createCron(startTime); cron1 = createCron(startTime);
} }
...@@ -271,7 +283,13 @@ public class EquipmentController extends AbstractController { ...@@ -271,7 +283,13 @@ public class EquipmentController extends AbstractController {
String cron2 = ""; String cron2 = "";
if(businessType == Constants.INT_3){ if(businessType == Constants.INT_3){
cron2 = createCron2(endTime); int time = Integer.valueOf(endTime) + 30;
int time2 = time < 60 ? time : (time - 60);
if(Integer.valueOf(endTime).intValue() > time2){
cron2 = createCron2(String.valueOf(time2),endTime);
}else{
cron2 = createCron2(endTime,String.valueOf(time2));
}
}else{ }else{
cron2 = createCron(endTime); cron2 = createCron(endTime);
} }
...@@ -321,11 +339,11 @@ public class EquipmentController extends AbstractController { ...@@ -321,11 +339,11 @@ public class EquipmentController extends AbstractController {
* @param time 时间 * @param time 时间
* @return cron * @return cron
*/ */
public String createCron2(String time){ public String createCron2(String time,String time2){
//0 */1 * * * ? //0 26,29,33 * * * ?
StringBuilder sb = new StringBuilder() StringBuilder sb = new StringBuilder()
.append(0).append(" ") .append(0).append(" ")
.append("*/").append(time) .append(time).append(",").append(time2)
.append(" * * * ?"); .append(" * * * ?");
// System.out.println(sb.toString()); // System.out.println(sb.toString());
return sb.toString(); return sb.toString();
...@@ -417,13 +435,28 @@ public class EquipmentController extends AbstractController { ...@@ -417,13 +435,28 @@ public class EquipmentController extends AbstractController {
return onOrOff(model); return onOrOff(model);
} }
/**
* 执行节能任务
*/
private Map<String, Object> energyTask() {
// String postUrl = "http://192.168.0.222:8089/command/energyTask";
String postUrl = "http://localhost:8089/command/energyTask";
Map<String, String> postParam = new HashMap<String, String>(10);
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;
}
/** /**
* 根据选择人工模式,来控制资源点启停 * 根据选择人工模式,来控制资源点启停
* @param type 1=供暖模式,2=机械通风,3=自然通风 * @param type 1=供暖模式,2=机械通风,3=自然通风
* @param status 1=开启,2=关闭 * @param status 1=开启,2=关闭
*/ */
private Map<String, Object> checkModelOnOrOff(Integer type, Integer status) { private Map<String, Object> checkModelOnOrOff(Integer type, Integer status) {
String postUrl = "http://localhost:8089/command/operationType"; String postUrl = "http://192.168.0.222:8089/command/operationType";
Map<String, String> postParam = new HashMap<String, String>(10); Map<String, String> postParam = new HashMap<String, String>(10);
postParam.put("params",status==1 ? "1": "0"); postParam.put("params",status==1 ? "1": "0");
postParam.put("rgType", type.toString()); postParam.put("rgType", type.toString());
...@@ -439,10 +472,12 @@ public class EquipmentController extends AbstractController { ...@@ -439,10 +472,12 @@ public class EquipmentController extends AbstractController {
} }
private Map<String, Object> onOrOff(LiResourceModel model) { private Map<String, Object> onOrOff(LiResourceModel model) {
// String postUrl = "http://192.168.0.222:8089/command/operation";
String postUrl = "http://localhost:8089/command/operation"; String postUrl = "http://localhost:8089/command/operation";
Map<String, String> postParam = new HashMap<String, String>(10); Map<String, String> postParam = new HashMap<String, String>(10);
postParam.put("liResourceId", model.getId()); postParam.put("liResourceId", model.getId());
postParam.put("params", model.getStatus().toString()); postParam.put("params", (model.getActionType()==Constants.INT_5 || model.getActionType()==Constants.INT_6 || model.getActionType()==Constants.INT_7
|| model.getActionType()==Constants.INT_8|| model.getActionType()==Constants.INT_9) ? model.getParams() : model.getStatus().toString());
postParam.put("paramsName", model.getActionName()); postParam.put("paramsName", model.getActionName());
postParam.put("actionType", model.getActionType().toString()); postParam.put("actionType", model.getActionType().toString());
postParam.put("userId", getUserId()); postParam.put("userId", getUserId());
......
...@@ -9,6 +9,7 @@ import com.devplatform.admin.modules.eq.service.*; ...@@ -9,6 +9,7 @@ import com.devplatform.admin.modules.eq.service.*;
import com.devplatform.admin.modules.liresource.bean.LiResource; import com.devplatform.admin.modules.liresource.bean.LiResource;
import com.devplatform.admin.modules.liresource.service.LiResourceService; import com.devplatform.admin.modules.liresource.service.LiResourceService;
import com.devplatform.admin.modules.sys.bean.SysSystemParams; import com.devplatform.admin.modules.sys.bean.SysSystemParams;
import com.devplatform.admin.modules.sys.service.SysResourceRunningTimeTjService;
import com.devplatform.admin.modules.sys.service.SysSystemParamsService; import com.devplatform.admin.modules.sys.service.SysSystemParamsService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -45,6 +46,8 @@ public class AnalysisServiceImpl implements AnalysisService { ...@@ -45,6 +46,8 @@ public class AnalysisServiceImpl implements AnalysisService {
private LiResourceService liResourceService; private LiResourceService liResourceService;
@Autowired @Autowired
private SbInfoService sbInfoService; private SbInfoService sbInfoService;
@Autowired
private SysResourceRunningTimeTjService sysResourceRunningTimeTjService;
@Override @Override
public Map<String,Object> getSyParam(){ public Map<String,Object> getSyParam(){
...@@ -98,10 +101,16 @@ public class AnalysisServiceImpl implements AnalysisService { ...@@ -98,10 +101,16 @@ public class AnalysisServiceImpl implements AnalysisService {
Map<String, Object> dayMap2 = totalDayService.totalDay(time,Constants.INT_2); Map<String, Object> dayMap2 = totalDayService.totalDay(time,Constants.INT_2);
Map<String, Object> monthMap = totalMonthService.totalMonth(time2,Constants.INT_1); Map<String, Object> monthMap = totalMonthService.totalMonth(time2,Constants.INT_1);
Map<String, Object> monthMap2 = totalMonthService.totalMonth(time2,Constants.INT_2); Map<String, Object> monthMap2 = totalMonthService.totalMonth(time2,Constants.INT_2);
Map<String, Object> dayTotal = sysResourceRunningTimeTjService.totalDay(time);
Map<String, Object> monthTotal = sysResourceRunningTimeTjService.totalMonth(time2);
String sdEnergyDay = Constants.STRING_0; String sdEnergyDay = Constants.STRING_0;
String jnEnergyDay = Constants.STRING_0; String jnEnergyDay = Constants.STRING_0;
String sdEnergyMonth = Constants.STRING_0; String sdEnergyMonth = Constants.STRING_0;
String jnEnergyMonth = Constants.STRING_0; String jnEnergyMonth = Constants.STRING_0;
String totalEnergyDay = Constants.STRING_0;
String totalEnergyMonth = Constants.STRING_0;
if(dayMap != null && dayMap.size() >= 0){ if(dayMap != null && dayMap.size() >= 0){
if(dayMap.containsKey("electric_energy")){ if(dayMap.containsKey("electric_energy")){
sdEnergyDay = dayMap.get("electric_energy").toString(); sdEnergyDay = dayMap.get("electric_energy").toString();
...@@ -123,6 +132,18 @@ public class AnalysisServiceImpl implements AnalysisService { ...@@ -123,6 +132,18 @@ public class AnalysisServiceImpl implements AnalysisService {
} }
} }
if(dayTotal != null && dayTotal.size() >= 0){
if(dayTotal.containsKey("electric_energy")){
totalEnergyDay = dayTotal.get("electric_energy").toString();
}
}
if(monthTotal != null && monthTotal.size() >= 0){
if(monthTotal.containsKey("electric_energy")){
totalEnergyMonth = monthTotal.get("electric_energy").toString();
}
}
//当天 //当天
//手动运行时间-天 //手动运行时间-天
Integer sdHour = Integer.valueOf(sysSystemParams.getSdSystemRunningTimeDay())/(60*60); Integer sdHour = Integer.valueOf(sysSystemParams.getSdSystemRunningTimeDay())/(60*60);
...@@ -132,7 +153,7 @@ public class AnalysisServiceImpl implements AnalysisService { ...@@ -132,7 +153,7 @@ public class AnalysisServiceImpl implements AnalysisService {
energy.put("jnSystemRunningTimeDay",jnHour); energy.put("jnSystemRunningTimeDay",jnHour);
energy.put("sdEnergyDay",sdEnergyDay); energy.put("sdEnergyDay",sdEnergyDay);
energy.put("jnEnergyDay",jnEnergyDay); energy.put("jnEnergyDay",jnEnergyDay);
energy.put("totalEnergyDay",0); energy.put("totalEnergyDay",totalEnergyDay);
//当月 //当月
//手动运行时间-月 //手动运行时间-月
Integer sdHourM = Integer.valueOf(sysSystemParams.getSdSystemRunningTimeMonth())/(60*60); Integer sdHourM = Integer.valueOf(sysSystemParams.getSdSystemRunningTimeMonth())/(60*60);
...@@ -142,7 +163,7 @@ public class AnalysisServiceImpl implements AnalysisService { ...@@ -142,7 +163,7 @@ public class AnalysisServiceImpl implements AnalysisService {
energy.put("jnSystemRunningTimeMonth",jnHourM); energy.put("jnSystemRunningTimeMonth",jnHourM);
energy.put("sdEnergyMonth",sdEnergyMonth); energy.put("sdEnergyMonth",sdEnergyMonth);
energy.put("jnEnergyMonth",jnEnergyMonth); energy.put("jnEnergyMonth",jnEnergyMonth);
energy.put("totalEnergyMonth",0); energy.put("totalEnergyMonth",totalEnergyMonth);
map.put("energy",energy); map.put("energy",energy);
//能耗统计 //能耗统计
......
...@@ -65,8 +65,6 @@ public class EquipmentServiceImpl implements EquipmentService { ...@@ -65,8 +65,6 @@ public class EquipmentServiceImpl implements EquipmentService {
//室外气象站 //室外气象站
List<Map<String,Object>> swqxzList = swqxzInfoService.getList(); List<Map<String,Object>> swqxzList = swqxzInfoService.getList();
//多联新风处理机室内机 //多联新风处理机室内机
List<Map<String,Object>> dlxfsnjList = dlxfsnjInfoService.getList(); List<Map<String,Object>> dlxfsnjList = dlxfsnjInfoService.getList();
......
...@@ -17,7 +17,6 @@ import io.swagger.annotations.ApiOperation; ...@@ -17,7 +17,6 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -37,9 +36,6 @@ public class LiStationMapController extends AbstractController { ...@@ -37,9 +36,6 @@ public class LiStationMapController extends AbstractController {
@Autowired private LiResourceService liResourceService; @Autowired private LiResourceService liResourceService;
@Value("${upload.realBaseDir}")
private String realBaseDir;
/** /**
* 列表页面列表数据获取 * 列表页面列表数据获取
* *
...@@ -173,7 +169,6 @@ public class LiStationMapController extends AbstractController { ...@@ -173,7 +169,6 @@ public class LiStationMapController extends AbstractController {
liStationMapService.save(stationMap); liStationMapService.save(stationMap);
} }
} }
stationMap = liStationMapService.getById(stationMap.getId()); stationMap = liStationMapService.getById(stationMap.getId());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -164,4 +164,7 @@ public class LiResourceModel extends BaseModel { ...@@ -164,4 +164,7 @@ public class LiResourceModel extends BaseModel {
/** 操作名称*/ /** 操作名称*/
private String actionName; private String actionName;
/** 参数 */
private String params;
} }
package com.devplatform.admin.modules.sys.bean; package com.devplatform.admin.modules.sys.bean;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data @Data
@ApiModel(value="设备运行时间统计表对象",description="设备运行时间统计表对象") @ApiModel(value="设备运行时间统计表对象",description="设备运行时间统计表对象")
@TableName("sys_resource_running_time_tj") @TableName("sys_resource_running_time_tj")
...@@ -40,4 +39,10 @@ public class SysResourceRunningTimeTj implements Serializable { ...@@ -40,4 +39,10 @@ public class SysResourceRunningTimeTj implements Serializable {
/** 站点ID */ /** 站点ID */
@ApiModelProperty(value="站点ID",name="stationId") @ApiModelProperty(value="站点ID",name="stationId")
private java.lang.String stationId; private java.lang.String stationId;
/** 电能 */
@ApiModelProperty(value="电能",name="electricEnergy")
private String electricEnergy;
/** 电能 */
@ApiModelProperty(value="电能",name="electricEnergyDay")
private String electricEnergyDay;
} }
...@@ -6,6 +6,7 @@ import com.devplatform.admin.modules.sys.bean.SysResourceRunningTimeTj; ...@@ -6,6 +6,7 @@ import com.devplatform.admin.modules.sys.bean.SysResourceRunningTimeTj;
import com.devplatform.common.dao.MyBaseMapper; import com.devplatform.common.dao.MyBaseMapper;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* SysResourceRunningTimeTj Mapper * SysResourceRunningTimeTj Mapper
...@@ -29,4 +30,8 @@ public interface SysResourceRunningTimeTjDao extends MyBaseMapper<SysResourceRun ...@@ -29,4 +30,8 @@ public interface SysResourceRunningTimeTjDao extends MyBaseMapper<SysResourceRun
* @return * @return
*/ */
List<SysResourceRunningTimeTj> queryPageList(SysResourceRunningTimeTjModel model); List<SysResourceRunningTimeTj> queryPageList(SysResourceRunningTimeTjModel model);
Map<String, Object> totalDay(String time);
Map<String, Object> totalMonth(String time);
} }
...@@ -6,6 +6,7 @@ import com.devplatform.admin.modules.sys.bean.SysResourceRunningTimeTj; ...@@ -6,6 +6,7 @@ import com.devplatform.admin.modules.sys.bean.SysResourceRunningTimeTj;
import com.devplatform.admin.modules.sys.model.SysResourceRunningTimeTjModel; import com.devplatform.admin.modules.sys.model.SysResourceRunningTimeTjModel;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 设备运行时间统计表的service接口 * 设备运行时间统计表的service接口
...@@ -23,4 +24,7 @@ public interface SysResourceRunningTimeTjService extends MyBaseService<SysResour ...@@ -23,4 +24,7 @@ public interface SysResourceRunningTimeTjService extends MyBaseService<SysResour
List<SysResourceRunningTimeTj> queryPageList(SysResourceRunningTimeTjModel model); List<SysResourceRunningTimeTj> queryPageList(SysResourceRunningTimeTjModel model);
Map<String, Object> totalDay(String time);
Map<String, Object> totalMonth(String time);
} }
...@@ -8,6 +8,7 @@ import com.devplatform.common.service.impl.MyBaseServiceImpl; ...@@ -8,6 +8,7 @@ import com.devplatform.common.service.impl.MyBaseServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 设备运行时间统计表的service接口实现类 * 设备运行时间统计表的service接口实现类
...@@ -25,4 +26,14 @@ public class SysResourceRunningTimeTjServiceImpl extends MyBaseServiceImpl<SysRe ...@@ -25,4 +26,14 @@ public class SysResourceRunningTimeTjServiceImpl extends MyBaseServiceImpl<SysRe
return baseMapper.queryPageList(model); return baseMapper.queryPageList(model);
} }
@Override
public Map<String, Object> totalDay(String time) {
return baseMapper.totalDay(time);
}
@Override
public Map<String, Object> totalMonth(String time) {
return baseMapper.totalMonth(time);
}
} }
...@@ -31,6 +31,7 @@ warning: ...@@ -31,6 +31,7 @@ warning:
upload: upload:
realBaseDir: /usr/local/nginx/html/energy/dist/ realBaseDir: /usr/local/nginx/html/energy/dist/
# realBaseDir: D:/software/nginx-1.21.0/html/energy/dist/
--- ---
spring: spring:
profiles: test profiles: test
......
...@@ -58,7 +58,11 @@ ...@@ -58,7 +58,11 @@
UNION ALL 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} 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 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 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}
UNION ALL
select cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from flrb_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 sb_info_day where date_format(create_time,'%Y%m%d') = #{time} and type = #{type}) t
</select> </select>
</mapper> </mapper>
......
...@@ -58,7 +58,11 @@ ...@@ -58,7 +58,11 @@
UNION ALL 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} 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 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 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}
UNION ALL
select cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from flrb_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 sb_info_month where date_format(create_time,'%Y%m') = #{time} and type = #{type}) t
</select> </select>
</mapper> </mapper>
......
...@@ -11,11 +11,13 @@ ...@@ -11,11 +11,13 @@
<result column="update_user_id" property="updateUserId"/> <result column="update_user_id" property="updateUserId"/>
<result column="update_time" property="updateTime"/> <result column="update_time" property="updateTime"/>
<result column="station_id" property="stationId"/> <result column="station_id" property="stationId"/>
<result column="electric_energy" property="electricEnergy"/>
<result column="electric_energy_day" property="electricEnergyDay"/>
</resultMap> </resultMap>
<!-- sys_resource_running_time_tj table all fields --> <!-- sys_resource_running_time_tj table all fields -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id,resource_id,running_time_total,running_time_sd,running_time_jn,update_user_id,update_time,station_id id,resource_id,running_time_total,running_time_sd,running_time_jn,update_user_id,update_time,station_id,electric_energy,electric_energy_day
</sql> </sql>
<!-- 公共查询条件 --> <!-- 公共查询条件 -->
...@@ -29,6 +31,8 @@ ...@@ -29,6 +31,8 @@
<if test="updateUserId!=null and updateUserId!=''">and t.update_user_id = #{updateUserId}</if> <if test="updateUserId!=null and updateUserId!=''">and t.update_user_id = #{updateUserId}</if>
<if test="updateTime!=null ">and t.update_time = #{updateTime}</if> <if test="updateTime!=null ">and t.update_time = #{updateTime}</if>
<if test="stationId!=null and stationId!=''">and t.station_id = #{stationId}</if> <if test="stationId!=null and stationId!=''">and t.station_id = #{stationId}</if>
<if test="electricEnergy!=null and electricEnergy!=''">and t.electric_energy = #{electricEnergy}</if>
<if test="electricEnergyDay!=null and electricEnergyDay!=''">and t.electric_energy_day = #{electricEnergyDay}</if>
</sql> </sql>
<select id="queryPageByCount" parameterType="Object" resultType="java.lang.Integer"> <select id="queryPageByCount" parameterType="Object" resultType="java.lang.Integer">
...@@ -46,6 +50,16 @@ ...@@ -46,6 +50,16 @@
${pager.mysqlQueryCondition} ${pager.mysqlQueryCondition}
</if> </if>
</select> </select>
<select id="totalDay" resultType="java.util.Map">
SELECT SUM(cast(t.electric_energy_day as decimal(10, 2))) as electric_energy
from sys_resource_running_time_tj t
where date_format(t.update_time,'%Y%m%d') = #{time}
</select>
<select id="totalMonth" resultType="java.util.Map">
SELECT SUM(cast(t.electric_energy_day as decimal(10, 2))) as electric_energy
from sys_resource_running_time_tj t
where date_format(t.update_time,'%Y%m') = #{time}
</select>
</mapper> </mapper>
......
gC9aI5R30cnFGe7D/+dwS3pulJ24VBEHvEcO1zHCNEJetMODem5b2FiVbBEZTZ9NRALZH5WnuAEE VIx6DvrL+lr0iOR3NReoZLRGvK/lI9z9ImXrkSXkDjuAEfod5L6L9qlcFJb+yG6C/jJDVFN7h1hT
RdwR23kTrpTnyQpc2hoK4VtogpJZWX9FGRxMumEqz5itBMRRXb3sXis1BuR+URjAHPw0IjuDNMuQ Yf4rnVobFtCWSTwsvXU+xyGtMvYVt8tXobcCKrDT/tJuhFR+EwlgZ9w6xHKBLcbeDKgKMZ4/wbBg
EcEQi2/lYTQjf/zTAZ9sr1FQsgQ3qJzpLOhNTurjC0cUwYx2YR5aMlqB0WFbsA3St6TSOAjIBDaR j5tOg3DLI7v0h4UNO905ku9S9XjLpLqa12P5dv+fdZELb1TmZ4bd1bMXZe2gvKTwWg/hO5oqYSaN
CZIVwmNihvT6UpxlFZz2zcWIiyWFUHudCl38d98dHTaiTEdoYqb8hpfucIsjImEI4hr+xwjmmjpL bJ/tlcU2KOgkGclf/Ts+SdtjOKIRKP8Bt670OyEosKHdSELx7+kC6nsh/H6ptHYzxludIxsg4+qa
ge5h1kMCgqk5RGeV34Aa9cD1qWMG+Ikvk+J3PEZJ/GvE6IwHwx9+5nRLBXogxZGMq5dojh60qZcj RRH+7+1re66/hQJlHU8rtRejengc6dFTJXezCCASV+HJKWBm1MqRDePYvrD9rEO5Li6NRLDtBr2z
su9R/ug5OJrVhqvNZGQYZPLrGNVBHUOKg0wHnasjNJKoVjW/GcDaup9Ky46D38u/QHpAbrIE7XaH eKW1j+PsRWOr1LFRqN6dBVjJY0yGrJFIPonRMH7Bq8M1wcYpf6gWUFyiQ31mbRnnkrqlGF2urOHp
1tORlq6xDFxgb6XpmOu90hwYrRUIgBxQeUOor3kndJvrrZOeoHrm445ZxPdl8M8HtiuQGJikFo/P BrGbhVijgZKw6zDzzSXkFcYJfxjleqV3GggAYRr9l0QALMtgb5CHk4eaJQKCaCgcn0ARdWMSUYsy
vbQlKD0XWxzQ4H2FgcXPot3lJiZaEo6n5DPn5St3etc0/OWcieHYCQXsjwLN11yBSgj1kl8vzWr4 xG/Z2iiOG5PzW2RIPOMAJFc8/S4xffgkHmKFJTHZZnM69mvsFkGaikBcNMZvOoovfrPGDjcatyA9
JSTxHjZwST8jwxmv4gp4Tal9cOqf+4qAOEJ36XF6S6XRLupra4bKbBxHhPbJ/Cxt+AthZUAJbtY= Cl5umVXaXjJRv6bYAugwMQ0A2PXJV038A0M+8N4wC3A7WBKvoYZGYyg2BjfkKQIXCUlh8rNQ7jk=
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