change - 修改电实时、整点数据获取

master
yinq 4 weeks ago
parent ee0c2c36f9
commit f1795b5f63

@ -1,99 +0,0 @@
package com.hw.ems.base.controller;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.web.page.TableDataInfo;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.ems.base.domain.CbsMonitorReport;
import com.hw.ems.base.service.ICbsMonitorReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* CBSController
*
* @author YinQ
* @date 2023-10-20
*/
@RestController
@RequestMapping("/base/cbsMonitorReport")
public class CbsMonitorReportController extends BaseController
{
@Autowired
private ICbsMonitorReportService cbsMonitorReportService;
/**
* CBS
*/
@RequiresPermissions("base:cbsMonitorReport:list")
@GetMapping("/list")
public TableDataInfo list(CbsMonitorReport cbsMonitorReport)
{
startPage();
List<CbsMonitorReport> list = cbsMonitorReportService.selectCbsMonitorReportList(cbsMonitorReport);
return getDataTable(list);
}
/**
* CBS
*/
@RequiresPermissions("base:cbsMonitorReport:export")
@Log(title = "CBS抄报", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CbsMonitorReport cbsMonitorReport)
{
List<CbsMonitorReport> list = cbsMonitorReportService.selectCbsMonitorReportList(cbsMonitorReport);
ExcelUtil<CbsMonitorReport> util = new ExcelUtil<CbsMonitorReport>(CbsMonitorReport.class);
util.exportExcel(response, list, "CBS抄报数据");
}
/**
* CBS
*/
@RequiresPermissions("base:cbsMonitorReport:query")
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId)
{
return success(cbsMonitorReportService.selectCbsMonitorReportByObjId(objId));
}
/**
* CBS
*/
@RequiresPermissions("base:cbsMonitorReport:add")
@Log(title = "CBS抄报", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CbsMonitorReport cbsMonitorReport)
{
return toAjax(cbsMonitorReportService.insertCbsMonitorReport(cbsMonitorReport));
}
/**
* CBS
*/
@RequiresPermissions("base:cbsMonitorReport:edit")
@Log(title = "CBS抄报", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CbsMonitorReport cbsMonitorReport)
{
return toAjax(cbsMonitorReportService.updateCbsMonitorReport(cbsMonitorReport));
}
/**
* CBS
*/
@RequiresPermissions("base:cbsMonitorReport:remove")
@Log(title = "CBS抄报", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds)
{
return toAjax(cbsMonitorReportService.deleteCbsMonitorReportByObjIds(objIds));
}
}

@ -1,82 +0,0 @@
package com.hw.ems.base.mapper;
import com.hw.ems.base.domain.CbsMonitorReport;
import java.util.List;
/**
* CBSMapper
*
* @author YinQ
* @date 2023-10-20
*/
public interface CbsMonitorReportMapper
{
/**
* CBS
*
* @param objId CBS
* @return CBS
*/
public CbsMonitorReport selectCbsMonitorReportByObjId(Long objId);
/**
* CBS
*
* @param cbsMonitorReport CBS
* @return CBS
*/
public List<CbsMonitorReport> selectCbsMonitorReportList(CbsMonitorReport cbsMonitorReport);
/**
* CBS
*
* @param cbsMonitorReport CBS
* @return
*/
public int insertCbsMonitorReport(CbsMonitorReport cbsMonitorReport);
/**
* CBS
*
* @param cbsMonitorReport CBS
* @return
*/
public int updateCbsMonitorReport(CbsMonitorReport cbsMonitorReport);
/**
* CBS
*
* @param objId CBS
* @return
*/
public int deleteCbsMonitorReportByObjId(Long objId);
/**
* CBS
*
* @param objIds
* @return
*/
public int deleteCbsMonitorReportByObjIds(Long[] objIds);
// /**
// * 查询电实时数据
// *
// * @param emsApiVo CBS抄报
// * @return CBS抄报集合
// */
// public List<CbsMonitorReport> selectRealTimeMonitorList(EmsApiVo emsApiVo);
/**
* CBS
*
* @param cbsMonitorReport CBS
* @return CBS
*/
public CbsMonitorReport selectLastTimeCbsMonitorReport(CbsMonitorReport cbsMonitorReport);
}

@ -1,80 +0,0 @@
package com.hw.ems.base.service;
import com.hw.ems.base.domain.CbsMonitorReport;
import java.util.List;
/**
* CBSService
*
* @author YinQ
* @date 2023-10-20
*/
public interface ICbsMonitorReportService
{
/**
* CBS
*
* @param objId CBS
* @return CBS
*/
public CbsMonitorReport selectCbsMonitorReportByObjId(Long objId);
/**
* CBS
*
* @param cbsMonitorReport CBS
* @return CBS
*/
public List<CbsMonitorReport> selectCbsMonitorReportList(CbsMonitorReport cbsMonitorReport);
/**
* CBS
*
* @param cbsMonitorReport CBS
* @return
*/
public int insertCbsMonitorReport(CbsMonitorReport cbsMonitorReport);
/**
* CBS
*
* @param cbsMonitorReport CBS
* @return
*/
public int updateCbsMonitorReport(CbsMonitorReport cbsMonitorReport);
/**
* CBS
*
* @param objIds CBS
* @return
*/
public int deleteCbsMonitorReportByObjIds(Long[] objIds);
/**
* CBS
*
* @param objId CBS
* @return
*/
public int deleteCbsMonitorReportByObjId(Long objId);
// /**
// * 查询实时数据
// *
// * @param emsApiVo CBS抄报
// * @return CBS抄报集合
// */
// public List<CbsMonitorReport> selectRealTimeMonitorList(EmsApiVo emsApiVo);
/**
* CBS
*
* @param cbsMonitorReport CBS
* @return CBS
*/
public CbsMonitorReport selectLastTimeCbsMonitorReport(CbsMonitorReport cbsMonitorReport);
}

@ -1,132 +0,0 @@
package com.hw.ems.base.service.impl;
import com.hw.common.core.utils.DateUtils;
import com.hw.ems.base.domain.CbsMonitorReport;
import com.hw.ems.base.mapper.CbsMonitorReportMapper;
import com.hw.ems.base.service.ICbsMonitorReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* CBSService
*
* @author YinQ
* @date 2023-10-20
*/
@Service
public class CbsMonitorReportServiceImpl implements ICbsMonitorReportService
{
@Autowired
private CbsMonitorReportMapper cbsMonitorReportMapper;
/**
* CBS
*
* @param objId CBS
* @return CBS
*/
@Override
// @DS("#header.poolName")
public CbsMonitorReport selectCbsMonitorReportByObjId(Long objId)
{
return cbsMonitorReportMapper.selectCbsMonitorReportByObjId(objId);
}
/**
* CBS
*
* @param cbsMonitorReport CBS
* @return CBS
*/
@Override
// @DS("#header.poolName")
public List<CbsMonitorReport> selectCbsMonitorReportList(CbsMonitorReport cbsMonitorReport)
{
return cbsMonitorReportMapper.selectCbsMonitorReportList(cbsMonitorReport);
}
/**
* CBS
*
* @param cbsMonitorReport CBS
* @return
*/
@Override
// @DS("#header.poolName")
public int insertCbsMonitorReport(CbsMonitorReport cbsMonitorReport)
{
cbsMonitorReport.setCreateTime(DateUtils.getNowDate());
return cbsMonitorReportMapper.insertCbsMonitorReport(cbsMonitorReport);
}
/**
* CBS
*
* @param cbsMonitorReport CBS
* @return
*/
@Override
// @DS("#header.poolName")
public int updateCbsMonitorReport(CbsMonitorReport cbsMonitorReport)
{
cbsMonitorReport.setUpdateTime(DateUtils.getNowDate());
return cbsMonitorReportMapper.updateCbsMonitorReport(cbsMonitorReport);
}
/**
* CBS
*
* @param objIds CBS
* @return
*/
@Override
// @DS("#header.poolName")
public int deleteCbsMonitorReportByObjIds(Long[] objIds)
{
return cbsMonitorReportMapper.deleteCbsMonitorReportByObjIds(objIds);
}
/**
* CBS
*
* @param objId CBS
* @return
*/
@Override
// @DS("#header.poolName")
public int deleteCbsMonitorReportByObjId(Long objId)
{
return cbsMonitorReportMapper.deleteCbsMonitorReportByObjId(objId);
}
//
// /**
// * 查询实时数据
// * @param emsApiVo CBS抄报
// * @return
// */
// @Override
// @DS("#header.poolName")
// public List<CbsMonitorReport> selectRealTimeMonitorList(EmsApiVo emsApiVo)
// {
// return cbsMonitorReportMapper.selectRealTimeMonitorList(emsApiVo);
// }
/**
* CBS
*
* @param cbsMonitorReport CBS
* @return CBS
*/
@Override
// @DS("#header.poolName")
public CbsMonitorReport selectLastTimeCbsMonitorReport(CbsMonitorReport cbsMonitorReport)
{
return cbsMonitorReportMapper.selectLastTimeCbsMonitorReport(cbsMonitorReport);
}
}

@ -40,13 +40,6 @@ public class RecordDnbInstantController extends BaseController {
return prefix + "/dnbInstant";
}
/**
*
* */
@PostMapping("/getDnbInstant")
public void getDnbInstant(){
recordDnbInstantService.getDnbInstantByJob();
}
/**
*
* @return
@ -79,13 +72,11 @@ public class RecordDnbInstantController extends BaseController {
@RequiresPermissions("record:dnbInstant:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(@RequestBody RecordDnbInstant recordDnbInstant)
public TableDataInfo list(@RequestBody RecordDnbInstant recordDnbInstant)
{
startPage();
RecordDnbInstantDataVo recordDnbInstantDataVo = recordDnbInstantService.selectRecordDnbInstantList(recordDnbInstant);
List<RecordDnbInstant> records = recordDnbInstantDataVo.getRecordDnbInstants();
int count = recordDnbInstantDataVo.getCount();
return getDataTable(records,count);
List<RecordDnbInstant> list = recordDnbInstantService.selectRecordDnbInstantList(recordDnbInstant);
return getDataTable(list);
}
/**
@ -122,9 +113,8 @@ public class RecordDnbInstantController extends BaseController {
@ResponseBody
public void export(HttpServletResponse response,RecordDnbInstant recordDnbInstant)
{
RecordDnbInstantDataVo recordDnbInstantDataVo = recordDnbInstantService.selectRecordDnbInstantList(recordDnbInstant);
List<RecordDnbInstant> list = recordDnbInstantDataVo.getRecordDnbInstants();
ExcelUtil<RecordDnbInstant> util = new ExcelUtil<>(RecordDnbInstant.class);
List<RecordDnbInstant> list = recordDnbInstantService.selectRecordDnbInstantList(recordDnbInstant);
ExcelUtil<RecordDnbInstant> util = new ExcelUtil<RecordDnbInstant>(RecordDnbInstant.class);
util.exportExcel(response,list, "电实时数据数据");
}
@ -144,7 +134,7 @@ public class RecordDnbInstantController extends BaseController {
@Log(title = "电实时数据", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@RequestBody RecordDnbInstant recordDnbInstant)
public AjaxResult addSave(RecordDnbInstant recordDnbInstant)
{
return toAjax(recordDnbInstantService.insertRecordDnbInstant(recordDnbInstant));
}
@ -176,13 +166,11 @@ public class RecordDnbInstantController extends BaseController {
/**
*
*/
@RequiresPermissions("record:dnbInstant:remove")
@Log(title = "电实时数据", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
@GetMapping("/dnbRemove/{objids}")
public AjaxResult remove(@PathVariable Long[] objids)
{
return toAjax(recordDnbInstantService.deleteRecordDnbInstantByObjids(ids));
return toAjax(recordDnbInstantService.deleteRecordDnbInstantByObjids(objids));
}
/**
@ -207,5 +195,4 @@ public class RecordDnbInstantController extends BaseController {
public AjaxResult voltageCurrentCurve(RecordDnbInstant baseDnbInstant) {
return AjaxResult.success(recordDnbInstantService.voltageCurrentCurve(baseDnbInstant));
}
}

@ -31,16 +31,16 @@ public class RecordAlarmData extends BaseEntity
@Excel(name = "采集设备编号")
private String collectDeviceId;
/** 记录时间 */
/** 告警时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "告警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date collectTime;
/** 异常类型 */
/** 异常类型 (0-超过阈值1-设备离线2-瞬时流量告警3-线损告警4-日耗量告警5-表具离线) */
@Excel(name = "异常类型")
private Long alarmType;
/** 异常状态 */
/** 异常状态 0-已处理1-未处理2-已读未处理)*/
@Excel(name = "异常状态")
private Long alarmStatus;
@ -65,10 +65,62 @@ public class RecordAlarmData extends BaseEntity
@Excel(name = "通知用户")
private String notifyUser;
/** 园区编号 poolName */
private String parkName;
/** 权限标识(部门) */
@Excel(name = "权限标识", readConverterExp = "部=门")
private Long deptId;
/** 权限标识(用户) */
@Excel(name = "权限标识", readConverterExp = "用=户")
private Long userId;
/**
*
*/
private String batchId;
/**
*
*/
@Excel(name = "原因分析")
private String problemCauses;
/** 采集设备名称 */
private String collectDeviceName;
/** 安装位置 */
@Excel(name = "安装位置")
private String address;
private String alarmStatusName;
public String getAlarmStatusName() {
return alarmStatusName;
}
public void setAlarmStatusName(String alarmStatusName) {
this.alarmStatusName = alarmStatusName;
}
public String getCollectDeviceName() {
return collectDeviceName;
}
public void setCollectDeviceName(String collectDeviceName) {
this.collectDeviceName = collectDeviceName;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Long[] getObjIds() {
return objIds;
}
@ -77,9 +129,29 @@ public class RecordAlarmData extends BaseEntity
this.objIds = objIds;
}
/** 权限标识(用户) */
@Excel(name = "权限标识", readConverterExp = "用=户")
private Long userId;
public String getBatchId() {
return batchId;
}
public void setBatchId(String batchId) {
this.batchId = batchId;
}
public String getProblemCauses() {
return problemCauses;
}
public void setProblemCauses(String problemCauses) {
this.problemCauses = problemCauses;
}
public String getParkName() {
return parkName;
}
public void setParkName(String parkName) {
this.parkName = parkName;
}
public void setObjId(Long objId)
{
@ -210,23 +282,23 @@ public class RecordAlarmData extends BaseEntity
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("monitorId", getMonitorId())
.append("collectDeviceId", getCollectDeviceId())
.append("collectTime", getCollectTime())
.append("alarmType", getAlarmType())
.append("alarmStatus", getAlarmStatus())
.append("alarmData", getAlarmData())
.append("operationName", getOperationName())
.append("operationTime", getOperationTime())
.append("cause", getCause())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("notifyUser", getNotifyUser())
.append("deptId", getDeptId())
.append("userId", getUserId())
.toString();
.append("objId", getObjId())
.append("monitorId", getMonitorId())
.append("collectDeviceId", getCollectDeviceId())
.append("collectTime", getCollectTime())
.append("alarmType", getAlarmType())
.append("alarmStatus", getAlarmStatus())
.append("alarmData", getAlarmData())
.append("operationName", getOperationName())
.append("operationTime", getOperationTime())
.append("cause", getCause())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("notifyUser", getNotifyUser())
.append("deptId", getDeptId())
.append("userId", getUserId())
.toString();
}
}

@ -3,6 +3,7 @@ package com.hw.ems.record.mapper;
import com.hw.ems.record.domain.RecordDnbInstant;
import java.util.List;
import java.util.Map;
/**
@ -59,7 +60,7 @@ public interface RecordDnbInstantMapper
* @param objids
* @return
*/
public int deleteRecordDnbInstantByObjids(String[] objids);
public int deleteRecordDnbInstantByObjids(Long[] objids);
/**
*
@ -74,4 +75,18 @@ public interface RecordDnbInstantMapper
* @return
*/
List<RecordDnbInstant> selectRealTimeParentList(RecordDnbInstant baseDnbInstant);
/**
*
* @param paramMap
* @return
*/
List<RecordDnbInstant> tablewareDetailsInfo(Map paramMap);
/**
* 线
* @param recordDnbInstant
* @return
*/
List<RecordDnbInstant> offlineAlerts(RecordDnbInstant recordDnbInstant);
}

@ -29,7 +29,7 @@ public interface IRecordDnbInstantService {
* @param recordDnbInstant
* @return
*/
public RecordDnbInstantDataVo selectRecordDnbInstantList(RecordDnbInstant recordDnbInstant);
public List<RecordDnbInstant> selectRecordDnbInstantList(RecordDnbInstant recordDnbInstant);
/**
*
@ -53,7 +53,7 @@ public interface IRecordDnbInstantService {
* @param objids
* @return
*/
public int deleteRecordDnbInstantByObjids(String objids);
public int deleteRecordDnbInstantByObjids(Long[] objids);
/**
*
@ -88,9 +88,4 @@ public interface IRecordDnbInstantService {
RecordDnbInstant tablewareDetailsInfo(RecordDnbInstant dnbInstant);
List<RecordDnbInstant> voltageCurrentCurve(RecordDnbInstant baseDnbInstant);
/**
* tde
* */
void getDnbInstantByJob();
}

@ -1,34 +1,19 @@
package com.hw.ems.record.service.impl;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import com.alibaba.fastjson2.JSONObject;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.TdEngineConstants;
import com.hw.common.core.domain.R;
import com.hw.common.core.text.Convert;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.ems.base.domain.BaseEnergyType;
import com.hw.ems.base.domain.BaseMonitorInfo;
import com.hw.ems.base.service.IBaseEnergyTypeService;
import com.hw.ems.base.service.IBaseMonitorInfoService;
import com.hw.ems.record.domain.RecordDnbInstant;
import com.hw.ems.record.domain.vo.RecordDnbInstantDataVo;
import com.hw.ems.record.mapper.RecordDnbInstantMapper;
import com.hw.ems.record.service.IRecordDnbInstantService;
import com.hw.ems.report.domain.ReportPointDnb;
import com.hw.ems.report.service.IReportPointDnbService;
import com.hw.tdengine.api.RemoteTdEngineService;
import com.hw.tdengine.api.domain.*;
import com.hw.tdengine.api.domain.ems.TdSuperTableEmsSelectVo;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -46,15 +31,6 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
@Autowired
private IBaseMonitorInfoService baseMonitorInfoService;
@Autowired
private RemoteTdEngineService remoteTdEngineService;
@Autowired
private IBaseEnergyTypeService baseEnergyTypeService;
@Autowired
private IReportPointDnbService reportPointDnbService;
/**
*
*
@ -62,10 +38,8 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
* @return
*/
@Override
//@DS("#header.poolName")
public RecordDnbInstant selectRecordDnbInstantByObjid(Long objid) {
// return recordDnbInstantMapper.selectRecordDnbInstantByObjid(objid);
return new RecordDnbInstant();
return recordDnbInstantMapper.selectRecordDnbInstantByObjid(objid);
}
/**
@ -74,144 +48,9 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
* @param recordDnbInstant
* @return
*/
// @Override
// @DS("#header.poolName")
//// @DataScope(deptAlias = "null")
// public List<RecordDnbInstant> selectRecordDnbInstantList(RecordDnbInstant recordDnbInstant) {
// return recordDnbInstantMapper.selectRecordDnbInstantList(recordDnbInstant);
// }
@Override
//@DS("#header.poolName")
// @DataScope(deptAlias = "null")
public RecordDnbInstantDataVo selectRecordDnbInstantList(RecordDnbInstant recordDnbInstant) {
RecordDnbInstantDataVo recordDnbInstantDataVo = new RecordDnbInstantDataVo();
// recordDnbInstant.setMonitorId(recordDnbInstant.getMonitorSubset());
try {
// Integer pageNum = Integer.valueOf((String) recordDnbInstant.getParams().get("pageNum"));
Integer pageNum = null;
Integer pageSize = null;
if (recordDnbInstant.getParams().get("pageNum")!=null){
Object pageNum1 = recordDnbInstant.getParams().get("pageNum");
pageNum = Integer.valueOf(String.valueOf(pageNum1));
// pageNum = (Integer) recordDnbInstant.getParams().get("pageNum");
}
if (recordDnbInstant.getParams().get("pageSize")!=null){
//一步转出会导致导出时出现无法转换的错误
Object pageSize1 = recordDnbInstant.getParams().get("pageSize");
pageSize = Integer.valueOf(String.valueOf(pageSize1));
// pageSize = (Integer) recordDnbInstant.getParams().get("pageSize");
}
// Integer pageSize = Integer.valueOf((String) recordDnbInstant.getParams().get("pageSize"));
Integer offset = (pageNum - 1) * pageSize;
List<RecordDnbInstant> records = new ArrayList<RecordDnbInstant>();
BaseMonitorInfo queryMonitorInfo = new BaseMonitorInfo();
queryMonitorInfo.setMonitorId(recordDnbInstant.getMonitorId());
// List<BaseMonitorInfo> baseMonitorInfos = baseMonitorInfoService.selectBaseMonitorInfoList(queryMonitorInfo);
String stratTime = (String) recordDnbInstant.getParams().get("beginTime");
String endTime = (String) recordDnbInstant.getParams().get("endTime");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//todo 因为手动补录采集时间默认为空,且手动补录页面初始化需要展示出所有的历史数据
if (stratTime==null||stratTime == ""){
//开始事件设置的足够远,确保可以查询到所有数据
stratTime ="2023-01-01 00:00:00";
}
if (endTime==null || endTime == ""){
//结束事件设置为当前时间
endTime = sdf.format(new Date(System.currentTimeMillis()));
}
Date dateStrat = sdf.parse(stratTime);
Date dateEnd = sdf.parse(endTime);
TdSuperTableEmsSelectVo tdSuperTableCommonSelectVo = new TdSuperTableEmsSelectVo();
tdSuperTableCommonSelectVo.setDatabaseName("db_hwmes");
tdSuperTableCommonSelectVo.setSuperTableName("st_electricity");
tdSuperTableCommonSelectVo.setStartTime(dateStrat.getTime());
tdSuperTableCommonSelectVo.setEndTime(dateEnd.getTime());
tdSuperTableCommonSelectVo.setFirstFieldName("ts");
tdSuperTableCommonSelectVo.setOrderByFieldName("ts");
tdSuperTableCommonSelectVo.setSort("desc");
tdSuperTableCommonSelectVo.setOffset(offset);
tdSuperTableCommonSelectVo.setLimit(pageSize);
// Object monitorObjidValue = recordDnbInstant.getParams().get("monitorObjid");
Object monitorObjidValue = recordDnbInstant.getObjid();
if (monitorObjidValue != null&&monitorObjidValue !="") {
tdSuperTableCommonSelectVo.setMonitorObjid(Long.valueOf(String.valueOf(monitorObjidValue)));
}
TdReturnDataVo tdReturnDataVo = remoteTdEngineService.getSuperTableHistoryData(tdSuperTableCommonSelectVo, SecurityConstants.INNER).getData();
if (tdReturnDataVo == null) {
return recordDnbInstantDataVo;
}
List<Map<String, Object>> dataList = tdReturnDataVo.getDataList();
//用于记录返回条数来正确分页
Integer flag = 0;
for (Map<String, Object> data : dataList) {
RecordDnbInstant recordDnbInstant1 = new RecordDnbInstant();
recordDnbInstant1.setMonitorId(String.valueOf(data.get(TdEngineConstants.ST_TAG_EMS_MONITORID)));
recordDnbInstant1.setObjid(Long.valueOf(String.valueOf(data.get(TdEngineConstants.ST_TAG_EMS_MONITOROBJID))));
recordDnbInstant1.setMonitorName(String.valueOf(data.get(TdEngineConstants.ST_TAG_EMS_MONITORNAME)));
if (data.get("volatagea")!=null ){
recordDnbInstant1.setVA(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("volatagea")))));
}
if (data.get("volatageb")!=null ){
recordDnbInstant1.setVB(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("volatageb")))));
}
if (data.get("volatagec")!=null ){
recordDnbInstant1.setVC(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("volatagec")))));
}
if (data.get("currenta")!=null ){
recordDnbInstant1.setIA(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("currenta")))));
}
if (data.get("currentb")!=null ){
recordDnbInstant1.setIB(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("currentb")))));
}
if (data.get("currentc")!=null ){
recordDnbInstant1.setIC(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("currentc")))));
}
if (data.get("glys")!=null ){
recordDnbInstant1.setGlys(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("glys")))));
}
if (data.get("zxyg")!=null ){
recordDnbInstant1.setZxyg(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("zxyg")))));
}
if (data.get("activepower")!=null ){
recordDnbInstant1.setActivePower(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("activepower")))));
}
if (data.get("reactivepower")!=null ){
recordDnbInstant1.setReactivePower(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("reactivepower")))));
}
//调整时间格式
String substring = String.valueOf(data.get("ts")).replaceAll("T", " ").substring(0, 19);
recordDnbInstant1.setCollectTime(sdf.parse(substring));
// recordDnbInstant.setConsumption(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("consumption")))));
if (data.get("collecttype")!=null ){
recordDnbInstant1.setCollectType(Long.valueOf(String.valueOf(data.get("collecttype"))));
}
//从手动补录进入时,会传入一个参数,如果时从手动补录进入,就过滤自动的数据
//目前定义 状态为1是自动的其他都是手动
if (recordDnbInstant.getCollectType()!=null){
if (data.get("collecttype")!=null && recordDnbInstant.getCollectType()==0)
{
if (recordDnbInstant1.getCollectType()!=1){ records.add(recordDnbInstant1);flag+=1;}
}
}
else{
flag+=1;
records.add(recordDnbInstant1);
}
}
recordDnbInstantDataVo.setCount(flag);
recordDnbInstantDataVo.setRecordDnbInstants(records);
return recordDnbInstantDataVo;
} catch (ParseException e) {
e.printStackTrace();
}
return recordDnbInstantDataVo;
public List<RecordDnbInstant> selectRecordDnbInstantList(RecordDnbInstant recordDnbInstant) {
return recordDnbInstantMapper.selectRecordDnbInstantList(recordDnbInstant);
}
/**
@ -221,7 +60,6 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
* @return
*/
@Override
//@DS("#header.poolName")
public int insertRecordDnbInstant(RecordDnbInstant recordDnbInstant) {
/*if (StringUtils.isNotEmpty(recordDnbInstant.getMonitorId())){
RecordDnbInstant dnbInstant = new RecordDnbInstant();
@ -235,49 +73,9 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
}
}
}*/
BaseMonitorInfo baseMonitorInfo = new BaseMonitorInfo();
baseMonitorInfo.setMonitorId(recordDnbInstant.getMonitorId());
List<BaseMonitorInfo> baseMonitorInfos = baseMonitorInfoService.selectBaseMonitorInfoList(baseMonitorInfo);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date collectTime = recordDnbInstant.getCollectTime();
TdTableVo tdTableVo = new TdTableVo();
tdTableVo.setDatabaseName("db_hwmes");
tdTableVo.setSuperTableName("st_electricity");
tdTableVo.setTableName(TdEngineConstants.getEmsTableName(baseMonitorInfos.get(0).getMonitorId()));
List<TdField> fields = new ArrayList<TdField>();
List<TdField> field2s = new ArrayList<TdField>();
TdField field = new TdField();
TdField field2 = new TdField();
TdField field3 = new TdField();
TdField field4 = new TdField();
field.setFieldName(TdEngineConstants.ST_TAG_EMS_BUILDID);
field.setFieldValue(baseMonitorInfos.get(0).getBuildId());
field2.setFieldName(TdEngineConstants.ST_TAG_EMS_MONITORNAME);
field2.setFieldValue(baseMonitorInfos.get(0).getMonitorName());
field3.setFieldName(TdEngineConstants.ST_TAG_EMS_MONITOROBJID);
field3.setFieldValue(baseMonitorInfos.get(0).getObjid());
field4.setFieldName(TdEngineConstants.ST_TAG_EMS_MONITORID);
field4.setFieldValue(baseMonitorInfos.get(0).getMonitorId());
fields.add(field);
fields.add(field2);
fields.add(field3);
fields.add(field4);
tdTableVo.setTagsFieldValues(fields);
TdField field5 = new TdField();
TdField field6 = new TdField();
field5.setFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME);
field5.setFieldValue(sdf.format(collectTime));
field6.setFieldName("zxyg");
field6.setFieldValue(recordDnbInstant.getZxyg());
field2s.add(field5);
field2s.add(field6);
tdTableVo.setSchemaFields(field2s);
R<?> r = remoteTdEngineService.insertTable(tdTableVo, SecurityConstants.INNER);
// recordDnbInstant.setRecordTime(new Date());
// recordDnbInstant.setCollectType(0L);
// return recordDnbInstantMapper.insertRecordDnbInstant(recordDnbInstant);
return 1;
recordDnbInstant.setRecordTime(new Date());
recordDnbInstant.setCollectType(0L);
return recordDnbInstantMapper.insertRecordDnbInstant(recordDnbInstant);
}
/**
@ -287,7 +85,6 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
* @return
*/
@Override
//@DS("#header.poolName")
public int updateRecordDnbInstant(RecordDnbInstant recordDnbInstant) {
recordDnbInstant.setRecordTime(new Date());
return recordDnbInstantMapper.updateRecordDnbInstant(recordDnbInstant);
@ -300,9 +97,8 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
* @return
*/
@Override
//@DS("#header.poolName")
public int deleteRecordDnbInstantByObjids(String objids) {
return recordDnbInstantMapper.deleteRecordDnbInstantByObjids(Convert.toStrArray(objids));
public int deleteRecordDnbInstantByObjids(Long[] objids) {
return recordDnbInstantMapper.deleteRecordDnbInstantByObjids(objids);
}
/**
@ -312,7 +108,6 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
* @return
*/
@Override
//@DS("#header.poolName")
public int deleteRecordDnbInstantByObjid(Long objid) {
return recordDnbInstantMapper.deleteRecordDnbInstantByObjid(objid);
}
@ -324,19 +119,15 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
* @return
*/
@Override
//@DS("#header.poolName")
public List<RecordDnbInstant> instantList(RecordDnbInstant recordDnbInstant) {
//是空 直接添加
if (StringUtils.isEmpty(recordDnbInstant.getMonitorSubset())) {
return recordDnbInstantMapper.instantList(new RecordDnbInstant());
}
List<RecordDnbInstant> dnbInstantList = new ArrayList<>();
BaseMonitorInfo monitorInfo = new BaseMonitorInfo();
//查询子集加入到父id中
monitorInfo.setParentId(Long.valueOf(recordDnbInstant.getMonitorSubset()));
monitorInfo.setParams(null);
recordDnbInstant.setParams(null);
//查询id为getMonitorSubset的子集
List<BaseMonitorInfo> baseMonitorInfos = baseMonitorInfoService.selectBaseMonitorInfoList(monitorInfo);
for (BaseMonitorInfo baseMonitorInfo : baseMonitorInfos) {
RecordDnbInstant dnbInstant = new RecordDnbInstant();
@ -358,13 +149,11 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
/**
*
*
*
* @param baseDnbInstant
* @return
*/
@Override
//@DS("#header.poolName")
public List<RecordDnbInstant> selectRealTimeParentList(RecordDnbInstant baseDnbInstant) {
List<RecordDnbInstant> dnbInstantList = new ArrayList<>();
if (StringUtils.isEmpty(baseDnbInstant.getMonitorSubset())) {
@ -376,7 +165,6 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
baseDnbInstant.setParams(null);
List<BaseMonitorInfo> baseMonitorInfos = baseMonitorInfoService.selectBaseMonitorInfoList(monitorInfo);
if (baseMonitorInfos.size() > 0) {
List<RecordDnbInstant> dnbInstantListOld = recordDnbInstantMapper.instantList(baseDnbInstant);
dnbInstant.setMonitorId(baseMonitorInfos.get(0).getMonitorId());
dnbInstant.setMonitorName(baseMonitorInfos.get(0).getMonitorName());
@ -408,7 +196,6 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
* @return
*/
@Override
//@DS("#header.poolName")
public RecordDnbInstant tablewareDetailsInfo(RecordDnbInstant dnbInstant) {
if (StringUtils.isEmpty(dnbInstant.getMonitorId())) {
return null;
@ -421,12 +208,11 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
}
@Override
//@DS("#header.poolName")
public List<RecordDnbInstant> voltageCurrentCurve(RecordDnbInstant dnbInstant) {
if (StringUtils.isEmpty(dnbInstant.getMonitorId())) {
if (StringUtils.isEmpty(dnbInstant.getMonitorId())){
return null;
}
if (StringUtils.isEmpty(dnbInstant.getStartTime()) || StringUtils.isEmpty(dnbInstant.getEndTime())) {
if (StringUtils.isEmpty(dnbInstant.getStartTime()) || StringUtils.isEmpty(dnbInstant.getEndTime())){
String nowTime = DateUtils.getTime();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime modifiedDateTime = LocalDateTime.parse(nowTime, formatter).minusMinutes(30);
@ -437,82 +223,5 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
return recordDnbInstantMapper.selectRecordDnbInstantList(dnbInstant);
}
/**
*
*/
//todo 通过tde 将电实时数据存入到电整点数据中
@Override
public void getDnbInstantByJob() {
TdHistorySelectDto tdHistorySelectDto = new TdHistorySelectDto();
tdHistorySelectDto.setFirstFieldName("ts");
tdHistorySelectDto.setDatabaseName(TdEngineConstants.EMS_DATABASE_NAME);
List<BaseEnergyType> baseEnergyTypes = baseEnergyTypeService.selectBaseEnergyTypeList(new BaseEnergyType());
//获取当前时间与一小时前时间
long endTime = System.currentTimeMillis();
//从一小时前开始,十点的话就是从九点开始,不是九点零一,开始就
long startTime = System.currentTimeMillis() - 60 * 60 * 1000 - 10;
tdHistorySelectDto.setStartTime(startTime);
tdHistorySelectDto.setEndTime(endTime);
Date date = new Date();
int hours = date.getHours();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//获取所有的计量设备
List<BaseMonitorInfo> baseMonitorInfos = baseMonitorInfoService.selectBaseMonitorInfoList(new BaseMonitorInfo());
List<ReportPointDnb> reportPoints = new ArrayList<ReportPointDnb>();
//根据计量设备id获取能源表名称
if (!baseMonitorInfos.isEmpty()) {
for (BaseMonitorInfo baseMonitorInfo : baseMonitorInfos) {
try {
String emsTableName = TdEngineConstants.getEmsTableName(baseMonitorInfo.getMonitorId());
//获取当前数据以及一小时前的数据
tdHistorySelectDto.setTableName(emsTableName);
List<Map<String, Object>> dnbInstant = remoteTdEngineService.getHistoryData(tdHistorySelectDto, SecurityConstants.INNER).getData().getDataList();
if (dnbInstant.size()==0){
return;
}
R<TdReturnDataVo> historyData = remoteTdEngineService.getHistoryData(tdHistorySelectDto, SecurityConstants.INNER);
ReportPointDnb report = new ReportPointDnb();
report.setMonitorId(baseMonitorInfo.getMonitorId());
report.setMonitorName(baseMonitorInfo.getMonitorName());
report.setpMonitorId(String.valueOf(baseMonitorInfo.getParentId()));
report.setAddress(baseMonitorInfo.getMonitorAddr());
BigDecimal MaxZXYG = BigDecimal.valueOf(Double.valueOf(String.valueOf(dnbInstant.get(dnbInstant.size() - 1).get("zxyg"))));
BigDecimal MinZXYG = BigDecimal.valueOf(Double.valueOf(String.valueOf(dnbInstant.get(0).get("zxyg"))));
//pt ct值暂时无用默认为1 需要时从计量设备信息中根据id获取
int pt = 1;
int ct = 1;
//乘ct值和pt值
/**
* (MAX(ifnull(t1.zxyg,0)) - MIN(ifnull(t1.zxyg,0))) * ifnull(t2.pt,1) * ifnull(t2.ct,1)as expend,
* 0 as price,
* hour(date_sub(@nowDate, interval 1 hour)) as point_time,
* DATE_FORMAT(date_sub(@nowDate, interval 1 hour),'%Y-%m-%d %H:00:00') as begin_time,
* DATE_FORMAT(@nowDate,'%Y-%m-%d %H:00:00') as end_time,
* DATE_FORMAT(date_sub(@nowDate,interval 1 hour),'%Y-%m-%d %H:00:00') as record_time*/
report.setExpend(MaxZXYG.subtract(MinZXYG).multiply(new BigDecimal(pt)).multiply(new BigDecimal(ct)));
report.setPrice(new BigDecimal(0));
report.setPointTime(String.valueOf(hours - 1));
report.setMeterValue(MaxZXYG.subtract(MinZXYG));
report.setRecordTime(sdf.parse(sdf.format(startTime)));
report.setBeginTime(sdf.parse(sdf.format(startTime)));
report.setEndTime(sdf.parse(sdf.format(endTime)));
reportPoints.add(report);
} catch (ParseException e) {
e.printStackTrace();
}
}
}
//将获取到的数据存入到实时数据中
for (ReportPointDnb p : reportPoints) {
reportPointDnbService.insertReportPointDnb(p);
}
}
}

@ -5,68 +5,124 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.hw.ems.base.mapper.BaseLineMonitorMapper">
<resultMap type="BaseLineMonitor" id="BaseLineMonitorResult">
<result property="objid" column="objid" />
<result property="parentId" column="parent_id" />
<result property="monitorId" column="monitor_id" />
<result property="monitorName" column="monitor_name" />
<result property="monitorAddr" column="monitor_addr" />
<result property="monitorType" column="monitor_type" />
<result property="monitorStatus" column="monitor_status" />
<result property="collectDeviceId" column="collect_device_id" />
<result property="buildId" column="build_id" />
<result property="ancestors" column="ancestors" />
<result property="grade" column="grade" />
<result property="correctValue" column="correct_value" />
<result property="isAmmeter" column="is_ammeter" />
<result property="lineName" column="line_name" />
<result property="lineLength" column="line_length" />
<result property="lineStatus" column="line_status" />
<result property="powerCapacity" column="power_capacity" />
<result property="waterCapacity" column="water_capacity" />
<result property="deptId" column="dept_id" />
<result property="userId" column="user_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="objid" column="objid"/>
<result property="parentId" column="parent_id"/>
<result property="monitorId" column="monitor_id"/>
<result property="monitorName" column="monitor_name"/>
<result property="monitorAddr" column="monitor_addr"/>
<result property="monitorType" column="monitor_type"/>
<result property="monitorStatus" column="monitor_status"/>
<result property="collectDeviceId" column="collect_device_id"/>
<result property="buildId" column="build_id"/>
<result property="ancestors" column="ancestors"/>
<result property="grade" column="grade"/>
<result property="correctValue" column="correct_value"/>
<result property="isAmmeter" column="is_ammeter"/>
<result property="lineName" column="line_name"/>
<result property="lineLength" column="line_length"/>
<result property="lineStatus" column="line_status"/>
<result property="powerCapacity" column="power_capacity"/>
<result property="waterCapacity" column="water_capacity"/>
<result property="deptId" column="dept_id"/>
<result property="userId" column="user_id"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="relationId" column="relation_id"/>
</resultMap>
<sql id="selectBaseLineMonitorVo">
select objid, parent_id, monitor_id, monitor_name, monitor_addr, monitor_type, monitor_status, collect_device_id, build_id, ancestors, grade, correct_value, is_ammeter, line_name, line_length, line_status, power_capacity, water_capacity, dept_id, user_id, create_by, create_time, update_by, update_time from base_line_monitor
select blm.objid,
blm.parent_id,
blm.monitor_id,
bmi.monitor_name,
bmi.monitor_addr,
blm.monitor_type,
blm.monitor_status,
blm.collect_device_id,
blm.build_id,
blm.ancestors,
blm.grade,
blm.correct_value,
blm.is_ammeter,
blm.line_name,
blm.line_length,
blm.line_status,
blm.power_capacity,
blm.water_capacity,
blm.dept_id,
blm.user_id,
blm.create_by,
blm.create_time,
blm.update_by,
blm.update_time
from base_line_monitor blm
left join base_monitor_info bmi on blm.monitor_id = bmi.monitor_id
</sql>
<select id="selectBaseLineMonitorList" parameterType="BaseLineMonitor" resultMap="BaseLineMonitorResult">
<include refid="selectBaseLineMonitorVo"/>
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="monitorName != null and monitorName != ''"> and monitor_name like concat('%', #{monitorName}, '%')</if>
<if test="monitorAddr != null and monitorAddr != ''"> and monitor_addr = #{monitorAddr}</if>
<if test="monitorType != null "> and monitor_type = #{monitorType}</if>
<if test="monitorStatus != null "> and monitor_status = #{monitorStatus}</if>
<if test="collectDeviceId != null and collectDeviceId != ''"> and collect_device_id = #{collectDeviceId}</if>
<if test="buildId != null and buildId != ''"> and build_id = #{buildId}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
<if test="grade != null "> and grade = #{grade}</if>
<if test="correctValue != null "> and correct_value = #{correctValue}</if>
<if test="isAmmeter != null and isAmmeter != ''"> and is_ammeter = #{isAmmeter}</if>
<if test="lineName != null and lineName != ''"> and line_name like concat('%', #{lineName}, '%')</if>
<if test="lineLength != null "> and line_length = #{lineLength}</if>
<if test="lineStatus != null "> and line_status = #{lineStatus}</if>
<if test="powerCapacity != null "> and power_capacity = #{powerCapacity}</if>
<if test="waterCapacity != null "> and water_capacity = #{waterCapacity}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="parentId != null ">and blm.parent_id = #{parentId}</if>
<if test="monitorName != null and monitorName != ''">and blm.monitor_name like concat('%', #{monitorName},
'%')
</if>
<if test="monitorAddr != null and monitorAddr != ''">and blm.monitor_addr = #{monitorAddr}</if>
<if test="monitorId != null and monitorId != ''">and blm.monitor_id like concat('%', #{monitorId}, '%')</if>
<if test="monitorType != null ">and blm.monitor_type = #{monitorType}</if>
<if test="monitorStatus != null ">and blm.monitor_status = #{monitorStatus}</if>
<if test="collectDeviceId != null and collectDeviceId != ''">and blm.collect_device_id = #{collectDeviceId}
</if>
<if test="buildId != null and buildId != ''">and blm.build_id = #{buildId}</if>
<if test="ancestors != null and ancestors != ''">and blm.ancestors = #{ancestors}</if>
<if test="grade != null ">and blm.grade = #{grade}</if>
<if test="correctValue != null ">and blm.correct_value = #{correctValue}</if>
<if test="isAmmeter != null and isAmmeter != ''">and blm.is_ammeter = #{isAmmeter}</if>
<if test="lineName != null and lineName != ''">and blm.line_name like concat('%', #{lineName}, '%')</if>
<if test="lineLength != null ">and blm.line_length = #{lineLength}</if>
<if test="lineStatus != null ">and blm.line_status = #{lineStatus}</if>
<if test="powerCapacity != null ">and blm.power_capacity = #{powerCapacity}</if>
<if test="waterCapacity != null ">and blm.water_capacity = #{waterCapacity}</if>
<if test="deptId != null ">and blm.dept_id = #{deptId}</if>
<if test="userId != null ">and blm.user_id = #{userId}</if>
</where>
</select>
<select id="selectBaseLineMonitorByObjid" parameterType="Long" resultMap="BaseLineMonitorResult">
<include refid="selectBaseLineMonitorVo"/>
where objid = #{objid}
where blm.objid = #{objid}
</select>
<select id="selectBaseLineMonitorByMonitorId" resultMap="BaseLineMonitorResult">
select t.objid, t.parent_id, t.monitor_id, t.monitor_name, t.monitor_addr, t.monitor_type, t.monitor_status, t.collect_device_id, t.build_id, t.ancestors, t.grade, t.correct_value, t.is_ammeter, t.line_name, t.line_length, t.line_status, t.power_capacity, t.water_capacity, t.dept_id, t.user_id, t.create_by, t.create_time, t.update_by, t.update_time
select t.objid,
t.parent_id,
t.monitor_id,
t.monitor_name,
t.monitor_addr,
t.monitor_type,
t.monitor_status,
t.collect_device_id,
t.build_id,
t.ancestors,
t.grade,
t.correct_value,
t.is_ammeter,
t.line_name,
t.line_length,
t.line_status,
t.power_capacity,
t.water_capacity,
t.dept_id,
t.user_id,
t.create_by,
t.create_time,
t.update_by,
t.update_time
from base_line_monitor t
left join (select parent_id, count(*) sum from base_line_monitor group by parent_id) tp
on tp.parent_id = t.objid
where t.monitor_id = #{monitor_id}
order by tp.sum desc limit 1
</select>
<insert id="insertBaseLineMonitor" parameterType="BaseLineMonitor" useGeneratedKeys="true" keyProperty="objid">
insert into base_line_monitor
@ -94,7 +150,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="monitorId != null">#{monitorId},</if>
@ -119,7 +175,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</trim>
</insert>
<update id="updateBaseLineMonitor" parameterType="BaseLineMonitor">
@ -153,7 +209,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteBaseLineMonitorByObjid" parameterType="Long">
delete from base_line_monitor where objid = #{objid}
delete
from base_line_monitor
where objid = #{objid}
</delete>
<delete id="deleteBaseLineMonitorByObjids" parameterType="String">
@ -163,24 +221,68 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="selectLevelLineMonitor" parameterType="Long" resultType="com.hw.ems.report.domain.ExportReport">
select m1.monitor_id oneMonitorId,
m1.monitor_name oneMonitorName,
m2.monitor_id twoMonitorId,
m2.monitor_name twoMonitorName,
m3.monitor_id threeMonitorId,
m3.monitor_name threeMonitorName,
m4.monitor_id fourMonitorId,
m4.monitor_name fourMonitorName,
m5.monitor_id fiveMonitorId,
m5.monitor_name fiveMonitorName
<select id="selectLevelLineMonitor" parameterType="Long" resultType="ExportReport">
select m1.monitor_id oneMonitorId,
m1.monitor_name oneMonitorName,
m2.monitor_id twoMonitorId,
m2.monitor_name twoMonitorName,
m3.monitor_id threeMonitorId,
m3.monitor_name threeMonitorName,
m4.monitor_id fourMonitorId,
m4.monitor_name fourMonitorName,
m5.monitor_id fiveMonitorId,
m5.monitor_name fiveMonitorName
from base_line_monitor m1
left join base_line_monitor m2 on m2.parent_id = m1.objid
left join base_line_monitor m3 on m3.parent_id = m2.objid
left join base_line_monitor m4 on m4.parent_id = m3.objid
left join base_line_monitor m5 on m5.parent_id = m4.objid
left join base_line_monitor m2 on m2.parent_id = m1.objid
left join base_line_monitor m3 on m3.parent_id = m2.objid
left join base_line_monitor m4 on m4.parent_id = m3.objid
left join base_line_monitor m5 on m5.parent_id = m4.objid
where m1.grade = 1
<if test="monitorType != null "> and m1.monitor_type = #{monitorType}</if>
<if test="monitorType != null ">and m1.monitor_type = #{monitorType}</if>
order by oneMonitorName, twoMonitorName, threeMonitorName,fourMonitorName,fiveMonitorName
</select>
<select id="selectFixtureStatusLineMonitorList" parameterType="BaseLineMonitor" resultMap="BaseLineMonitorResult">
select blm.objid,
blm.parent_id,
blm.monitor_id,
bmi.monitor_name,
bmi.monitor_addr,
blm.monitor_type,
blm.monitor_status,
blm.collect_device_id,
blm.build_id,
blm.ancestors,
blm.grade,
blm.correct_value,
blm.is_ammeter,
blm.line_name,
blm.line_length,
blm.line_status,
blm.power_capacity,
blm.water_capacity,
bmi.fee_type,
blm.dept_id,
blm.user_id,
blm.create_by,
blm.create_time,
blm.update_by,
blm.update_time,
bt.relation_id
from base_line_monitor blm
left join base_monitor_info bmi on blm.monitor_id = bmi.monitor_id
left join (SELECT monitor_id, relation_id
FROM base_type_relation
where type = 3
and relation_id in (33, 34, 36)
group by monitor_id, relation_id) bt on bt.monitor_id = blm.monitor_id
<where>
<if test="parentId != null ">and blm.parent_id = #{parentId}</if>
<if test="monitorName != null and monitorName != ''">and blm.monitor_name like concat('%', #{monitorName},
'%')
</if>
<if test="monitorId != null and monitorId != ''">and blm.monitor_id = #{monitorId}</if>
<if test="monitorType != null ">and blm.monitor_type = #{monitorType}</if>
<if test="monitorStatus != null ">and blm.monitor_status = #{monitorStatus}</if>
</where>
</select>
</mapper>

@ -37,12 +37,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="roomCode" column="room_code" />
<result property="roomName" column="room_name" />
<result property="physicalCode" column="physical_code" />
<result property="feeType" column="fee_type" />
<result property="relationId" column="relation_id" />
<result property="submitFlag" column="submit_flag" />
</resultMap>
<sql id="selectBaseMonitorInfoVo">
select objid, parent_id, monitor_id, monitor_name, monitor_addr, monitor_type, monitor_status,
collect_device_id, ancestors, grade, build_id, subentry_id, business_id, meter_type_id,
meter_id, correct_value, pt, ct, is_ammeter, is_key_monitor, is_circuit, dept_id, user_id,
meter_id, correct_value, pt, ct, is_ammeter, is_key_monitor, is_circuit, dept_id, user_id,fee_type,
create_by, create_time, update_by, update_time, public_share_type,monitor_hierarchy,room_code,room_name,physical_code from base_monitor_info
</sql>
@ -51,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="monitorName != null and monitorName != ''"> and monitor_name like concat('%', #{monitorName}, '%')</if>
<if test="monitorId != null and monitorId != ''"> and monitor_id like concat('%', #{monitorId}, '%')</if>
<if test="monitorAddr != null and monitorAddr != ''"> and monitor_addr = #{monitorAddr}</if>
<if test="monitorType != null "> and monitor_type = #{monitorType}</if>
<if test="monitorStatus != null "> and monitor_status = #{monitorStatus}</if>
@ -61,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="subentryId != null and subentryId != ''"> and subentry_id = #{subentryId}</if>
<if test="businessId != null and businessId != ''"> and business_id = #{businessId}</if>
<if test="meterTypeId != null and meterTypeId != ''"> and meter_type_id = #{meterTypeId}</if>
<if test="feeType != null and feeType != ''"> and fee_type = #{feeType}</if>
<if test="meterId != null and meterId != ''"> and meter_id = #{meterId}</if>
<if test="correctValue != null "> and correct_value = #{correctValue}</if>
<if test="pt != null "> and pt = #{pt}</if>
@ -81,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectBaseMonitorInfoVo"/>
where objid = #{objid}
</select>
<select id="checkMonitorIdLegal" resultType="com.hw.ems.base.domain.BaseMonitorInfo">
<select id="checkMonitorIdLegal" resultType="BaseMonitorInfo">
select t.objid, t.parent_id, t.monitor_id, t.monitor_name, t.monitor_addr, t.monitor_type
from base_monitor_info t
<where>
@ -92,7 +97,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select * from base_monitor_info where find_in_set(#{monitorId}, ancestors)
</select>
<select id="selectBaseMonitorInfoByMonitorId" parameterType="String" resultMap="BaseMonitorInfoResult">
select * from base_monitor_info where monitor_id = #{monitorId}
select bmi.objid,
bmi.parent_id,
bmi.monitor_id,
bmi.monitor_name,
bmi.monitor_addr,
bmi.monitor_type,
bmi.monitor_status,
bmi.collect_device_id,
bmi.ancestors,
bmi.grade,
bmi.build_id,
bmi.subentry_id,
bmi.business_id,
bmi.meter_type_id,
bmi.meter_id,
bmi.correct_value,
bmi.pt,
bmi.ct,
bmi.is_ammeter,
bmi.is_key_monitor,
bmi.is_circuit,
bmi.dept_id,
bmi.user_id,
bmi.create_by,
bmi.create_time,
bmi.update_by,
bmi.update_time,
bmi.public_share_type,
bmi.monitor_hierarchy,
bmi.room_code,
bmi.room_name,
bmi.physical_code,
bmi.fee_type,
bt.relation_id
from base_monitor_info bmi
left join (SELECT monitor_id, relation_id
FROM base_type_relation
where type = 3
and relation_id in (33, 34, 36)
group by monitor_id, relation_id) bt on bt.monitor_id = bmi.monitor_id
where bmi.monitor_id = #{monitorId}
</select>
<update id="updateMonitorChildren" parameterType="java.util.List">
update base_monitor_info set ancestors =
@ -140,6 +185,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="roomCode != null">room_code,</if>
<if test="roomName != null">room_name,</if>
<if test="physicalCode != null">physical_code,</if>
<if test="feeType != null">fee_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
@ -173,6 +219,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="roomCode != null">#{roomCode},</if>
<if test="roomName != null">#{roomName},</if>
<if test="physicalCode != null">#{physicalCode},</if>
<if test="feeType != null">#{feeType},</if>
</trim>
</insert>
@ -206,10 +253,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="publicShareType != null">public_share_type = #{publicShareType},</if>
<if test="monitorHierarchy != null">monitor_hierarchy = #{monitorHierarchy},</if>
<if test="roomCode != null">room_code = #{roomCode},</if>
<if test="roomName != null">room_name = #{roomName},</if>
<if test="physicalCode != null">physical_code = #{physicalCode},</if>
<if test="feeType != null">fee_type = #{feeType},</if>
<if test="submitFlag != null">submit_flag = #{submitFlag},</if>
monitor_hierarchy = #{monitorHierarchy},
</trim>
where objid = #{objid}
</update>

@ -83,7 +83,6 @@
<if test="monitorId != null and monitorId != ''"> and t.monitor_id like concat('%', #{monitorId}, '%')</if>
</where>
</select>
<select id="selectChildrenMonitorById" parameterType="String" resultMap="BaseMonitorInfoResult">
select * from base_monitor_info where find_in_set(#{monitorId}, ancestors)
</select>

@ -110,7 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN base_monitor_info bmi ON bmp.monitor_id = bmi.monitor_id
where bpu.id = #{id}
</select>
<select id="selectlistChild" resultType="com.hw.ems.base.domain.vo.MonitorVo">
<select id="selectlistChild" resultType="MonitorVo">
SELECT bmp.monitor_id AS monitorId,
bmi.monitor_name AS monitorName,
bmp.public_share_type publicShareType

@ -44,12 +44,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="endTime != null "> and base_public_user_record.start_time &lt;= #{endTime}</if>
</where>
</select>
<select id="selectBasePublicUserRecordByObjid" parameterType="Long" resultMap="BasePublicUserRecordResult">
<include refid="selectBasePublicUserRecordVo"/>
where objid = #{objid}
</select>
<insert id="insertBasePublicUserRecord" parameterType="BasePublicUserRecord" useGeneratedKeys="true" keyProperty="objid">
insert into base_public_user_record
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -110,9 +110,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteBasePublicUserRecordByObjids" parameterType="String">
delete from base_public_user_record where objid in
delete from base_public_user_record where objid in
<foreach item="objid" collection="array" open="(" separator="," close=")">
#{objid}
</foreach>
</delete>
</mapper>
</mapper>

@ -35,12 +35,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
m.monitor_name,
case
when base_type_relation.type = 0 then bi.build_name
when base_type_relation.type = 1 then bt.business_name
when base_type_relation.type = 2 then st.subentry_name
end unit_name,
base_type_relation.rate, base_type_relation.formula_mode
from base_type_relation
left join base_monitor_info m on m.monitor_id = base_type_relation.monitor_id
left join base_build_info bi on base_type_relation.relation_id = bi.objid
</sql>
left join base_business_type bt on base_type_relation.relation_id = bt.objid
left join base_subentry_type st on base_type_relation.relation_id = st.objid
</sql>
<select id="selectBaseTypeRelationList" parameterType="BaseTypeRelation" resultMap="BaseTypeRelationResult">
<include refid="selectBaseTypeRelationVo"/>
@ -51,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="relationId != null and relationId != '' "> and base_type_relation.relation_id = #{relationId}</if>
<if test="monitorType != null and monitorType != ''"> and m.monitor_type = #{monitorType}</if>
</where>
order by base_type_relation.type, base_type_relation.relation_id, base_type_relation.monitor_id
</select>
<select id="selectBaseTypeRelationByObjid" parameterType="Long" resultMap="BaseTypeRelationResult">
@ -79,7 +84,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from base_type_relation btr
left join base_monitor_info m on m.monitor_id = btr.monitor_id
left join base_build_info bi on btr.relation_id = bi.objid and bi.parent_id = 1
) btr
left join base_business_type bt on btr.relation_id = bt.objid and bt.parent_id = 1
left join base_subentry_type st on btr.relation_id = st.objid and st.parent_id = 1
) btr
<where>
btr.unit_name is not null
<if test="monitorId != null and monitorId != ''"> and btr.monitor_id = #{monitorId}</if>

@ -1,212 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.ems.base.mapper.CbsMonitorReportMapper">
<resultMap type="CbsMonitorReport" id="CbsMonitorReportResult">
<result property="objId" column="obj_id" />
<result property="monitorId" column="monitor_id" />
<result property="monitorName" column="monitor_name" />
<result property="monitorType" column="monitor_type" />
<result property="publicShareType" column="public_share_type" />
<result property="roomCode" column="room_code" />
<result property="roomName" column="room_name" />
<result property="roomName" column="room_name" />
<result property="buildCode" column="build_code" />
<result property="buildName" column="build_name" />
<result property="isBind" column="is_bind" />
<result property="lastMonitorTime" column="last_monitor_time" />
<result property="lastMonitorExpend" column="last_monitor_expend" />
<result property="thisMonitorTime" column="this_monitor_time" />
<result property="thisMonitorExpend" column="this_monitor_expend" />
<result property="lastFlag" column="last_flag" />
<result property="thisFlag" column="this_flag" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="physicalCode" column="physical_code" />
<result property="loadingPosition" column="loadingPosition" />
</resultMap>
<sql id="selectCbsMonitorReportVo">
select obj_id, monitor_id, monitor_name, monitor_type, public_share_type,
room_code, room_name,physical_code, build_code, build_name, is_bind, last_monitor_time, last_monitor_expend, this_monitor_time, this_monitor_expend, last_flag, this_flag, remark, create_by, create_time, update_by, update_time from cbs_monitor_report
</sql>
<select id="selectCbsMonitorReportList" parameterType="CbsMonitorReport" resultMap="CbsMonitorReportResult">
<include refid="selectCbsMonitorReportVo"/>
<where>
<if test="monitorId != null and monitorId != ''"> and monitor_id = #{monitorId}</if>
<if test="monitorName != null and monitorName != ''"> and monitor_name like concat('%', #{monitorName}, '%')</if>
<if test="monitorType != null and monitorType != ''"> and monitor_type = #{monitorType}</if>
<if test="publicShareType != null and publicShareType != ''"> and public_share_type = #{publicShareType}</if>
<if test="roomName != null and roomName != ''"> and room_name like concat('%', #{roomName}, '%')</if>
<if test="buildCode != null and buildCode != ''"> and build_code = #{buildCode}</if>
<if test="buildName != null and buildName != ''"> and build_name like concat('%', #{buildName}, '%')</if>
<if test="isBind != null and isBind != ''"> and is_bind = #{isBind}</if>
<if test="lastMonitorTime != null "> and last_monitor_time = #{lastMonitorTime}</if>
<if test="lastMonitorExpend != null "> and last_monitor_expend = #{lastMonitorExpend}</if>
<if test="thisMonitorTime != null "> and this_monitor_time = #{thisMonitorTime}</if>
<if test="thisMonitorExpend != null "> and this_monitor_expend = #{thisMonitorExpend}</if>
<if test="lastFlag != null and lastFlag != ''"> and last_flag = #{lastFlag}</if>
<if test="thisFlag != null and thisFlag != ''"> and this_flag = #{thisFlag}</if>
<if test="roomCode != null and roomCode != '' ">
and room_code IN
<foreach collection="roomCode.split(',')" index="index" item="item" open="(" separator=","
close=")">
#{item}
</foreach>
</if>
</where>
order by create_time desc
</select>
<select id="selectCbsMonitorReportByObjId" parameterType="Long" resultMap="CbsMonitorReportResult">
<include refid="selectCbsMonitorReportVo"/>
where obj_id = #{objId}
</select>
<!-- <select id="selectRealTimeMonitorList" parameterType="EmsApiVo" resultMap="CbsMonitorReportResult">-->
<!-- SELECT bmi.monitor_id,-->
<!-- bmi.monitor_name,-->
<!-- bmi.monitor_type,-->
<!-- bmi.public_share_type,-->
<!-- bmi.room_code,-->
<!-- bmi.room_name,-->
<!-- bmi.physical_code,-->
<!-- bmi.monitor_addr loadingPosition,-->
<!-- '0' AS is_bind,-->
<!-- sysdate() AS this_monitor_time,-->
<!-- rdi.this_monitor_expend * IF(ISNULL(bmi.ct), 1, bmi.ct) * IF(ISNULL(bmi.pt), 1, bmi.pt) AS this_monitor_expend,-->
<!-- IF(rdi.this_monitor_expend IS NOT NULL, '0', '1') AS this_flag-->
<!-- FROM base_monitor_info bmi-->
<!-- LEFT JOIN (-->
<!-- SELECT t1.monitor_id, t1.water_flow AS this_monitor_expend-->
<!-- FROM record_water_instant t1-->
<!-- JOIN (-->
<!-- SELECT monitor_id, MAX(collect_time) AS max_time-->
<!-- FROM record_water_instant-->
<!-- <if test="meterReadingTime != null and meterReadingTime != ''">-->
<!-- where collect_time &lt; #{meterReadingTime}-->
<!-- </if>-->
<!-- GROUP BY monitor_id-->
<!-- ) t2 ON t1.monitor_id = t2.monitor_id AND t1.collect_time = t2.max_time-->
<!-- UNION ALL-->
<!-- SELECT t1.monitor_id, t1.zxyg AS this_monitor_expend-->
<!-- FROM record_dnb_instant t1-->
<!-- JOIN (-->
<!-- SELECT monitor_id, MAX(collect_time) AS max_time-->
<!-- FROM record_dnb_instant-->
<!-- <if test="meterReadingTime != null and meterReadingTime != ''">-->
<!-- where collect_time &lt; #{meterReadingTime}-->
<!-- </if>-->
<!-- GROUP BY monitor_id-->
<!-- ) t2 ON t1.monitor_id = t2.monitor_id AND t1.collect_time = t2.max_time-->
<!-- ) AS rdi ON rdi.monitor_id = bmi.monitor_id-->
<!-- WHERE bmi.room_code IS NOT NULL-->
<!-- <if test="monitorIdList != null and monitorIdList.size > 0">-->
<!-- and bmi.monitor_id IN-->
<!-- <foreach item="monitorId" collection="monitorIdList" open="(" separator="," close=")">-->
<!-- #{monitorId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- </select>-->
<!-- <select id="selectLastTimeCbsMonitorReport" parameterType="CbsMonitorReport" resultMap="CbsMonitorReportResult">-->
<!-- <include refid="selectCbsMonitorReportVo"/>-->
<!-- <if test="monitorId != null and monitorId != ''"> where monitor_id = #{monitorId}</if>-->
<!-- order by this_monitor_time desc-->
<!-- limit 1-->
<!-- </select>-->
<insert id="insertCbsMonitorReport" parameterType="CbsMonitorReport" useGeneratedKeys="true" keyProperty="objId">
insert into cbs_monitor_report
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="monitorId != null">monitor_id,</if>
<if test="monitorName != null">monitor_name,</if>
<if test="monitorType != null">monitor_type,</if>
<if test="publicShareType != null">public_share_type,</if>
<if test="roomCode != null">room_code,</if>
<if test="roomName != null">room_name,</if>
<if test="buildCode != null">build_code,</if>
<if test="buildName != null">build_name,</if>
<if test="isBind != null">is_bind,</if>
<if test="lastMonitorTime != null">last_monitor_time,</if>
<if test="lastMonitorExpend != null">last_monitor_expend,</if>
<if test="thisMonitorTime != null">this_monitor_time,</if>
<if test="thisMonitorExpend != null">this_monitor_expend,</if>
<if test="lastFlag != null">last_flag,</if>
<if test="thisFlag != null">this_flag,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="physicalCode != null">physical_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="monitorId != null">#{monitorId},</if>
<if test="monitorName != null">#{monitorName},</if>
<if test="monitorType != null">#{monitorType},</if>
<if test="publicShareType != null">#{publicShareType},</if>
<if test="roomCode != null">#{roomCode},</if>
<if test="roomName != null">#{roomName},</if>
<if test="buildCode != null">#{buildCode},</if>
<if test="buildName != null">#{buildName},</if>
<if test="isBind != null">#{isBind},</if>
<if test="lastMonitorTime != null">#{lastMonitorTime},</if>
<if test="lastMonitorExpend != null">#{lastMonitorExpend},</if>
<if test="thisMonitorTime != null">#{thisMonitorTime},</if>
<if test="thisMonitorExpend != null">#{thisMonitorExpend},</if>
<if test="lastFlag != null">#{lastFlag},</if>
<if test="thisFlag != null">#{thisFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="physicalCode != null">#{physicalCode},</if>
</trim>
</insert>
<update id="updateCbsMonitorReport" parameterType="CbsMonitorReport">
update cbs_monitor_report
<trim prefix="SET" suffixOverrides=",">
<if test="monitorId != null">monitor_id = #{monitorId},</if>
<if test="monitorName != null">monitor_name = #{monitorName},</if>
<if test="monitorType != null">monitor_type = #{monitorType},</if>
<if test="publicShareType != null">public_share_type = #{publicShareType},</if>
<if test="roomCode != null">room_code = #{roomCode},</if>
<if test="roomName != null">room_name = #{roomName},</if>
<if test="buildCode != null">build_code = #{buildCode},</if>
<if test="buildName != null">build_name = #{buildName},</if>
<if test="isBind != null">is_bind = #{isBind},</if>
<if test="lastMonitorTime != null">last_monitor_time = #{lastMonitorTime},</if>
<if test="lastMonitorExpend != null">last_monitor_expend = #{lastMonitorExpend},</if>
<if test="thisMonitorTime != null">this_monitor_time = #{thisMonitorTime},</if>
<if test="thisMonitorExpend != null">this_monitor_expend = #{thisMonitorExpend},</if>
<if test="lastFlag != null">last_flag = #{lastFlag},</if>
<if test="thisFlag != null">this_flag = #{thisFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="physicalCode != null">physical_code = #{physicalCode},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteCbsMonitorReportByObjId" parameterType="Long">
delete from cbs_monitor_report where obj_id = #{objId}
</delete>
<delete id="deleteCbsMonitorReportByObjIds" parameterType="String">
delete from cbs_monitor_report where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>

@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectSysDatasourceVo"/>
where id = #{id}
</select>
<select id="selectSysDatasourceByPoolName" resultType="com.hw.ems.base.domain.SysDatasource">
<select id="selectSysDatasourceByPoolName" resultType="SysDatasource">
select id, url, user_name, password, drive_class_name,
pool_name, status, del_flag, create_by, create_time,
update_by, update_time, remark, cbs_park_code, cbs_park_name

@ -23,6 +23,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deptId" column="dept_id" />
<result property="userId" column="user_id" />
<result property="monitorName" column="monitor_name" />
<result property="parkName" column="parkName" />
<result property="batchId" column="batch_id" />
<result property="problemCauses" column="problem_causes" />
</resultMap>
<sql id="selectRecordAlarmDataVo">
select record_alarm_data.objId,
@ -31,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
record_alarm_data.collect_device_id,collect_time,alarm_type,alarmStatus,
alarmData,operation_name,operation_time,cause,record_alarm_data.create_by,record_alarm_data.create_time,
record_alarm_data.update_by,record_alarm_data.update_time,notify_user,
record_alarm_data.dept_id,record_alarm_data.user_id
record_alarm_data.dept_id,record_alarm_data.user_id,record_alarm_data.batch_id,record_alarm_data.problem_causes
from record_alarm_data
left join base_monitor_info m on m.monitor_id = record_alarm_data.monitor_id
left join base_collect_device_info cdi on cdi.collect_device_id = record_alarm_data.collect_device_id
@ -40,9 +43,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRecordAlarmDataList" parameterType="RecordAlarmData" resultMap="RecordAlarmDataResult">
<include refid="selectRecordAlarmDataVo"/>
<where>
<if test="objId != null"> and record_alarm_data.objId = #{objId}</if>
<if test="monitorId != null and monitorId != ''"> and record_alarm_data.monitor_id = #{monitorId}</if>
<if test="collectDeviceId != null and collectDeviceId != ''"> and record_alarm_data.collect_device_id = #{collectDeviceId}</if>
<if test="collectTime != null "> and record_alarm_data.collect_time = #{collectTime}</if>
<if test="params.realBeginTime != null and params.realBeginTime != '' and params.realEndTime != null and params.realEndTime != ''">
and record_alarm_data.collect_time BETWEEN #{params.realBeginTime} AND #{params.realEndTime}
</if>
<if test="alarmType != null "> and alarm_type = #{alarmType}</if>
<if test="alarmStatus != null "> and alarmStatus = #{alarmStatus}</if>
<if test="alarmData != null and alarmData != ''"> and alarmData = #{alarmData}</if>
@ -53,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- <if test="deptId != null "> and dept_id = #{deptId}</if>-->
<!-- <if test="userId != null "> and user_id = #{userId}</if>-->
</where>
order by record_alarm_data.collect_time desc
</select>
<select id="selectRecordAlarmDataByObjId" parameterType="Long" resultMap="RecordAlarmDataResult">
@ -79,6 +86,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="notifyUser != null">notify_user,</if>
<if test="deptId != null">dept_id,</if>
<if test="userId != null">user_id,</if>
<if test="batchId != null">batch_id,</if>
<if test="problemCauses != null">problem_causes,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="monitorId != null">#{monitorId},</if>
@ -97,6 +106,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="notifyUser != null">#{notifyUser},</if>
<if test="deptId != null">#{deptId},</if>
<if test="userId != null">#{userId},</if>
<if test="batchId != null">#{batchId},</if>
<if test="problemCauses != null">#{problemCauses},</if>
</trim>
</insert>
@ -119,10 +130,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="notifyUser != null">notify_user = #{notifyUser},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="problemCauses != null">problem_causes = #{problemCauses},</if>
<if test="batchId != null">batch_id = #{batchId},</if>
</trim>
where objId = #{objId}
</update>
<update id="editAllReadStatus">
update record_alarm_data set alarmStatus = 2 where objId in
<foreach item="objid" collection="array" open="(" separator="," close=")">
#{objid}
</foreach>
</update>
<delete id="deleteRecordAlarmDataByObjId" parameterType="Long">
delete from record_alarm_data where objId = #{objId}
</delete>
@ -133,4 +153,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{objId}
</foreach>
</delete>
<select id="getSendMessagesPhoneNumber" parameterType="RecordAlarmData" resultType="java.util.HashMap">
select sd.pool_name, sd.park_name, su.user_name, su.phonenumber
from sys_datasource sd
join sys_user_datasource sud on sud.datasource_id = sd.id
join sys_user su on sud.user_id = su.user_id
join sys_user_role sur on sur.user_id = su.user_id
join sys_role sr on sr.role_id = sur.role_id AND sr.role_key = 'sf_massage'
where su.phonenumber IS NOT NULL
# and su.phonenumber != ''
and sd.pool_name = #{parkName}
group by sd.pool_name, sd.park_name, su.user_name, su.phonenumber
</select>
<select id="getSendMessagesUserNameList" resultType="java.util.HashMap">
select sd.pool_name, sd.park_name, su.user_name
from sys_datasource sd
join sys_user_datasource sud on sud.datasource_id = sd.id
join sys_user su on sud.user_id = su.user_id
where sud.message_flag = 1
and sd.pool_name = #{poolName}
</select>
<select id="selectRecoverAlarmDataList" parameterType="RecordAlarmData" resultMap="RecordAlarmDataResult">
<include refid="selectRecordAlarmDataVo"/>
<where>
alarmStatus != 0
<if test="alarmType != null "> and alarm_type = #{alarmType}</if>
</where>
</select>
</mapper>

@ -27,6 +27,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="userId" column="user_id" />
<result property="address" column="address" />
<result property="onlineState" column="onlineState" />
<result property="feeType" column="fee_type" />
<result property="relationId" column="relation_id" />
<result property="submitFlag" column="submit_flag" />
</resultMap>
<sql id="selectRecordDnbInstantVo">
@ -40,7 +43,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="monitorId != null and monitorId != ''"> and record_dnb_instant.monitor_id = #{monitorId}</if>
<if test="params.beginCollectTime != null and params.beginCollectTime != '' and params.endCollectTime != null and params.endCollectTime != ''">
and collect_time between #{params.beginCollectTime} and #{params.endCollectTime}
and record_dnb_instant.collect_time between #{params.beginCollectTime} and #{params.endCollectTime}
</if>
<if test="params.beginRecordTime != null and params.beginRecordTime != '' and params.endRecordTime != null and params.endRecordTime != ''">
and record_dnb_instant.record_time between #{params.beginRecordTime} and #{params.endRecordTime}
</if>
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''">
and record_dnb_instant.collect_time between #{beginTime} and #{endTime}
</if>
<if test="monitorSubset != null and monitorSubset != ''">
and (record_dnb_instant.monitor_id = #{monitorSubset} OR record_dnb_instant.monitor_id IN
@ -68,9 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectRecordDnbInstantVo"/>
where record_dnb_instant.objid = #{objid}
</select>
<!--先在子查询中查询出最新的一条数据并根据monitorid分组-->
<!-- 然后连表查询select * from 电实时数据 where id=子查询的id时间=子查询的时间-->
<!-- 子查询 select monitor_id,MAX(collect_time) from record_dnb_instant GROUP BY monitor_id-->
<select id="instantList" parameterType="RecordDnbInstant" resultMap="RecordDnbInstantResult">
select d.monitor_id, m.monitor_name, m.monitor_addr address,
d.collect_time, d.vA, d.vB, d.vC, d.iA, d.iB, d.iC, d.record_time, d.glys,
@ -78,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
pd.consumption consumption
from record_dnb_instant d
join (
select rdi.monitor_id, max(rdi.collect_time) collect_time
select rdi.monitor_id, max(rdi.objid) objid
from record_dnb_instant rdi
<where>
<if test="monitorId != null and monitorId != ''"> and rdi.monitor_id = #{monitorId}</if>
@ -93,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
</where>
group by rdi.monitor_id) md on md.monitor_id = d.monitor_id and md.collect_time = d.collect_time
group by rdi.monitor_id) md on md.objid = d.objid
left join base_monitor_info m on m.monitor_id = d.monitor_id
left join (select rpd.monitor_id, ifnull(sum(rpd.expend), 0) consumption
from report_point_dnb rpd
@ -123,6 +130,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="tablewareDetailsInfo" parameterType="RecordDnbInstant" resultMap="RecordDnbInstantResult">
select d.monitor_id,
m.monitor_name,
m.monitor_addr address,
m.fee_type,
d.collect_time,
d.vA,
d.vB,
d.vC,
d.iA,
d.iB,
d.iC,
d.record_time,
d.glys,
d.zxyg,
d.active_power,
d.reactive_power,
d.collect_type,
bcdi.online_state onlineState,
ifnull(pd.consumption,0) consumption,
bt.relation_id,
m.submit_flag
from record_dnb_instant d
join (select rdi.monitor_id, max(rdi.collect_time) collect_time
from record_dnb_instant rdi
where 1=1
<if test="monitorId != null and monitorId != ''">and rdi.monitor_id = #{monitorId}</if>
group by rdi.monitor_id) md on md.collect_time = d.collect_time and md.monitor_id = d.monitor_id
left join base_monitor_info m on m.monitor_id = d.monitor_id
left join (select rpd.monitor_id, ifnull(sum(rpd.expend), 0) consumption
from report_point_dnb rpd
where 1=1
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
and rpd.begin_time between #{beginCollectTime} and #{endCollectTime}
</if>
group by rpd.monitor_id) pd on pd.monitor_id = m.monitor_id
left join base_collect_device_info bcdi on bcdi.collect_device_id = m.collect_device_id
left join (SELECT monitor_id, relation_id
FROM base_type_relation
where type = 3
and relation_id in (33, 34, 37, 38, 39)
group by monitor_id, relation_id) bt on bt.monitor_id = m.monitor_id
</select>
<select id="offlineAlerts" parameterType="RecordDnbInstant" resultMap="RecordDnbInstantResult">
select d.monitor_id, m.monitor_name, d.zxyg, d.record_time
from (select max(objid) objid,
monitor_id
from record_dnb_instant
group by monitor_id) rdi
join record_dnb_instant d on d.objid = rdi.objid
join base_monitor_info m on m.monitor_id = rdi.monitor_id and m.monitor_status = 0 and m.is_ammeter = 'false'
where #{recordTime} > d.record_time
</select>
<insert id="insertRecordDnbInstant" parameterType="RecordDnbInstant" useGeneratedKeys="true" keyProperty="objid">
insert into record_dnb_instant
<trim prefix="(" suffix=")" suffixOverrides=",">

@ -35,6 +35,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and (record_water_instant.monitor_id = #{monitorSubset} OR record_water_instant.monitor_id IN
(SELECT t.monitor_id FROM base_monitor_info t WHERE FIND_IN_SET(#{monitorSubset}, ancestors)))
</if>
<if test="params.beginRecordTime != null and params.beginRecordTime != '' and params.endRecordTime != null and params.endRecordTime != ''">
and record_water_instant.record_time between #{params.beginRecordTime} and #{params.endRecordTime}
</if>
<if test="fluxFlow != null "> and flux_flow = #{fluxFlow}</if>
<if test="waterFlow != null "> and water_flow = #{waterFlow}</if>
<if test="recordTime != null "> and record_water_instant.record_time = #{recordTime}</if>
@ -54,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d.collect_time,d.flux_flow, d.water_flow, d.record_time,d.collect_type, pd.consumption consumption,bcdi.online_state onlineState
from record_water_instant d
join (
select rdi.monitor_id, max(rdi.collect_time) collect_time
select rdi.monitor_id, max(rdi.objid) objid
from record_water_instant rdi
<where>
<if test="monitorId != null and monitorId != ''"> and rdi.monitor_id = #{monitorId}</if>
@ -69,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
</where>
group by rdi.monitor_id) md on md.monitor_id = d.monitor_id and md.collect_time = d.collect_time
group by rdi.monitor_id) md on md.objid = d.objid
left join base_monitor_info m on m.monitor_id = d.monitor_id
left join (select rpd.monitor_id, ifnull(sum(rpd.expend), 0) consumption
from report_point_dnb rpd

@ -191,78 +191,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by ert.monitor_id, ert.monitor_name, ert.pointTime desc
</select>
<!-- <select id="energyStatisticsData" resultType="java.util.Map">-->
<!-- select m.parentMonitorId,-->
<!-- m.parentName,-->
<!-- m.is_ammeter,-->
<!-- rpd.monitor_id monitorId,-->
<!-- m.monitor_name monitorName,-->
<!-- m.monitor_addr address,-->
<!-- sum(if(rpd.expend is null, 0, rpd.expend)) expend,-->
<!-- max(rpd.meter_value) meterValue,-->
<!-- GROUP_CONCAT(DISTINCT bpu.user_name SEPARATOR ',') owningUser,-->
<!-- concat(#{beginCollectTime},' 至 ',#{endCollectTime}) timeRange,-->
<!-- m.monitor_hierarchy monitorHierarchy,-->
<!-- m.grade-->
<!-- from report_point_dnb rpd-->
<!-- left join (SELECT blm.monitor_id parentMonitorId,-->
<!-- blm.monitor_name parentName,-->
<!-- bmi.monitor_id,-->
<!-- bmi.monitor_name,-->
<!-- bmi.monitor_addr,-->
<!-- bmi.monitor_hierarchy,-->
<!-- bl.grade,-->
<!-- CASE WHEN bmi.is_ammeter = 'true' THEN '是' ELSE '否' END is_ammeter-->
<!-- FROM base_monitor_info bmi-->
<!-- LEFT JOIN base_line_monitor bl ON bl.monitor_id = bmi.monitor_id-->
<!-- LEFT JOIN base_line_monitor blm ON blm.objid = bl.parent_id) m-->
<!-- on m.monitor_id = rpd.monitor_id-->
<!-- left join base_monitor_public bmp on m.monitor_id = bmp.monitor_id-->
<!-- left join base_public_user bpu on bmp.public_share_id = bpu.id-->
<!-- <where>-->
<!-- <if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">-->
<!-- and left(rpd.begin_time,10) between #{beginCollectTime} and #{endCollectTime}-->
<!-- </if>-->
<!-- <if test="monitorIdList != null and monitorIdList.size > 0">-->
<!-- and rpd.monitor_id IN-->
<!-- <foreach item="monitorId" collection="monitorIdList" open="(" separator="," close=")">-->
<!-- #{monitorId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="publicShareType != null and publicShareType != ''"> and m.public_share_type = #{publicShareType}</if>-->
<!-- <if test="monitorHierarchy != null and monitorHierarchy != ''"> and m.monitor_hierarchy = #{monitorHierarchy}</if>-->
<!-- </where>-->
<!-- group by m.parentMonitorId, m.parentName, m.is_ammeter,-->
<!-- rpd.monitor_id, m.monitor_name, m.monitor_addr, m.monitor_hierarchy, m.grade-->
<!-- order by m.parentName, m.monitor_name-->
<!-- </select>-->
<!-- todo 因为缺少公摊表所以替换sql为如下-->
<select id="energyStatisticsData" resultType="java.util.Map">
select m.parentMonitorId,
m.parentName,
m.is_ammeter,
rpd.monitor_id monitorId,
m.monitor_name monitorName,
m.monitor_addr address,
sum(if(rpd.expend is null, 0, rpd.expend)) expend,
max(rpd.meter_value) meterValue,
concat(#{beginCollectTime},' 至 ',#{endCollectTime}) as timeRange,
m.monitor_hierarchy monitorHierarchy,
m.grade
from report_point_dnb rpd
left join (SELECT blm.monitor_id parentMonitorId,
blm.monitor_name parentName,
m.parentName,
m.is_ammeter,
rpd.monitor_id monitorId,
m.monitor_name monitorName,
m.monitor_addr address,
sum(if(rpd.expend is null, 0, rpd.expend)) expend,
max(rpd.meter_value) meterValue,
GROUP_CONCAT(DISTINCT bpu.user_name SEPARATOR ',') owningUser,
concat(#{beginCollectTime},' 至 ',#{endCollectTime}) timeRange,
m.public_share_type publicShareType,
m.monitor_hierarchy monitorHierarchy,
m.room_code roomCode,
m.room_name roomName,
m.grade
from (SELECT blm.monitor_id parentMonitorId,
blm.monitor_name parentName,
bmi.monitor_id,
bmi.monitor_name,
bmi.monitor_addr,
bmi.monitor_hierarchy,
bmi.public_share_type,
bmi.room_code,
bmi.room_name,
bl.grade,
CASE WHEN bmi.is_ammeter = 'true' THEN '是' ELSE '否' END is_ammeter
CASE WHEN bmi.is_ammeter = 'true' THEN '是' ELSE '否' END is_ammeter
FROM base_monitor_info bmi
LEFT JOIN base_line_monitor bl ON bl.monitor_id = bmi.monitor_id
LEFT JOIN base_line_monitor blm ON blm.objid = bl.parent_id) m
on m.monitor_id = rpd.monitor_id
left join report_point_dnb rpd on m.monitor_id = rpd.monitor_id
left join base_monitor_public bmp on m.monitor_id = bmp.monitor_id
left join base_public_user bpu on bmp.public_share_id = bpu.id
<where>
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
and left(rpd.begin_time,10) between #{beginCollectTime} and #{endCollectTime}
@ -277,8 +238,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="monitorHierarchy != null and monitorHierarchy != ''"> and m.monitor_hierarchy = #{monitorHierarchy}</if>
</where>
group by m.parentMonitorId, m.parentName, m.is_ammeter,
rpd.monitor_id, m.monitor_name, m.monitor_addr, m.monitor_hierarchy, m.grade
order by m.parentName, m.monitor_name
rpd.monitor_id, m.monitor_name, m.monitor_addr, m.public_share_type, m.monitor_hierarchy, m.grade, m.room_code, m.room_name
order by m.parentName, m.monitor_name, m.monitor_hierarchy, m.public_share_type
</select>
<insert id="insertReportPointDnb" parameterType="ReportPointDnb">
@ -363,4 +324,78 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="dailyLossReport" resultType="java.util.Map">
select left(rpd.begin_time, 10) beginTime,
ifnull(rpd.expend, 0) pExpend,
ifnull(u.expend, 0) cExpend,
CONCAT(case
when rpd.expend = 0 then 0
else round((rpd.expend - u.expend) / rpd.expend * 100, 2) end, '%') rate
from (
select left(rpd.begin_time, 10) begin_time, ifnull(sum(rpd.expend), 0) expend
from report_point_dnb rpd
where 1=1
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
and left(rpd.begin_time,10) between #{beginCollectTime} and #{endCollectTime}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
and rpd.begin_time between #{startTime} and #{endTime}
</if>
<if test="inMonitor != null and inMonitor.size > 0">
and monitor_id IN
<foreach item="monitorId" collection="inMonitor" open="(" separator="," close=")">
#{monitorId}
</foreach>
</if>
group by left(rpd.begin_time, 10)
) rpd
left join (
select left(rpd.begin_time, 10) beginTime, ifnull(sum(rpd.expend), 0) expend
from report_point_dnb rpd
where 1=1
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
and rpd.begin_time between #{startTime} and #{endTime}
</if>
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
and left(rpd.begin_time,10) between #{beginCollectTime} and #{endCollectTime}
</if>
<if test="outMonitor != null and outMonitor.size > 0">
and monitor_id IN
<foreach item="monitorId" collection="outMonitor" open="(" separator="," close=")">
#{monitorId}
</foreach>
</if>
group by left(rpd.begin_time, 10)
) u on left(rpd.begin_time, 10) = u.beginTime
</select>
<select id="timeOfUseConsumptionByTime" resultType="java.util.Map">
select pointTime, priceType, ifnull(sum(expend), 0) expend
from (select left(rpd.begin_time, #{timeSub}) pointTime,
rpd.expend,
case
when bsp.price_type = 0 then '尖峰用量'
when bsp.price_type = 1 then '高峰用量'
when bsp.price_type = 2 then '平段用量'
when bsp.price_type = 3 then '低谷用量'
when bsp.price_type = 4 then '深谷用量' END priceType
from report_point_dnb rpd
join base_share_price bsp
on left(rpd.begin_time, 7) = bsp.year_month_date
and right(rpd.begin_time, 8) >= bsp.start_hour
and bsp.end_hour &lt; right(rpd.begin_time, 8)
where 1=1
<!-- <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">-->
<!-- and rpd.begin_time between #{startTime} and #{endTime}-->
<!-- </if>-->
<if test="monitorIdList != null and monitorIdList.size > 0">
and rpd.monitor_id IN
<foreach item="monitorId" collection="monitorIdList" open="(" separator="," close=")">
#{monitorId}
</foreach>
</if>
) ert
group by pointTime, priceType
</select>
</mapper>

@ -204,24 +204,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
max(rpd.meter_value) meterValue,
GROUP_CONCAT(DISTINCT bpu.user_name SEPARATOR ',') owningUser,
concat(#{beginCollectTime},' 至 ',#{endCollectTime}) timeRange,
m.public_share_type publicShareType,
m.monitor_hierarchy monitorHierarchy,
m.room_code roomCode,
m.room_name roomName,
m.grade
from report_point_water rpd
left join (SELECT blm.monitor_id parentMonitorId,
from (SELECT blm.monitor_id parentMonitorId,
blm.monitor_name parentName,
bmi.monitor_id,
bmi.monitor_name,
bmi.monitor_addr,
bmi.public_share_type,
bmi.monitor_hierarchy,
bmi.room_code,
bmi.room_name,
bl.grade,
CASE WHEN bmi.is_ammeter = 'true' THEN '是' ELSE '否' END is_ammeter
FROM base_monitor_info bmi
LEFT JOIN base_line_monitor bl ON bl.monitor_id = bmi.monitor_id
LEFT JOIN base_line_monitor blm ON blm.objid = bl.parent_id) m
on m.monitor_id = rpd.monitor_id
left join report_point_water rpd on m.monitor_id = rpd.monitor_id
left join base_monitor_public bmp on m.monitor_id = bmp.monitor_id
left join base_public_user bpu on bmp.public_share_id = bpu.id
<where>
m.monitor_name is not null
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
and left(rpd.begin_time,10) between #{beginCollectTime} and #{endCollectTime}
</if>
@ -235,8 +241,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="monitorHierarchy != null and monitorHierarchy != ''"> and m.monitor_hierarchy = #{monitorHierarchy}</if>
</where>
group by m.parentMonitorId, m.parentName, m.is_ammeter,
rpd.monitor_id, m.monitor_name, m.monitor_addr, m.monitor_hierarchy, m.grade
order by m.parentName, m.monitor_name
rpd.monitor_id, m.monitor_name, m.monitor_addr, m.public_share_type, m.monitor_hierarchy, m.grade, m.room_code, m.room_name
order by m.parentName, m.monitor_name, m.monitor_hierarchy, m.public_share_type
</select>
<insert id="insertReportPointWater" parameterType="ReportPointWater">
@ -333,4 +339,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="dailyLossReport" resultType="java.util.Map">
select left(rpd.begin_time, 10) beginTime,
ifnull(rpd.expend, 0) pExpend,
ifnull(u.expend, 0) cExpend,
CONCAT(case
when rpd.expend = 0 then 0
else round((rpd.expend - u.expend) / rpd.expend * 100, 2) end, '%') rate
from (
select left(rpd.begin_time, 10) begin_time, ifnull(sum(rpd.expend), 0) expend
from report_point_water rpd
where 1=1
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
and left(rpd.begin_time, 13) between #{beginCollectTime} and #{endCollectTime}
</if>
<if test="inMonitor != null and inMonitor.size > 0">
and monitor_id IN
<foreach item="monitorId" collection="inMonitor" open="(" separator="," close=")">
#{monitorId}
</foreach>
</if>
group by left(rpd.begin_time, 10)
) rpd
left join (
select left(rpd.begin_time, 10) beginTime, ifnull(sum(rpd.expend), 0) expend
from report_point_dnb rpd
where 1=1
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
and left(rpd.begin_time, 13) between #{beginCollectTime} and #{endCollectTime}
</if>
<if test="outMonitor != null and outMonitor.size > 0">
and monitor_id IN
<foreach item="monitorId" collection="outMonitor" open="(" separator="," close=")">
#{monitorId}
</foreach>
</if>
group by left(rpd.begin_time, 10)
) u on left(rpd.begin_time, 10) = u.beginTime
</select>
</mapper>

@ -0,0 +1,50 @@
import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";
import qs from 'qs';
// 查询用户列表1
export function listUser(data) {
return request({
url: '/ems/report/preview/consumptionReport/2',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
})
}
export function consumptionAll(data) {
return request({
url: '/ems/report/preview/consumptionAll/2',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
})
}
// 查询部门下拉树结构
export function deptTreeSelect() {
return request({
url: '/ems/base/monitorInfo/treeData/2',
method: 'get'
})
}
// 真查询部门下拉树结构 建筑
export function treeDat() {
return request({
url: '/ems/buildInfo/treeData',
method: 'get'
})
}
//业态
export function treeDattwo() {
return request({
url: '/ems/businessType/treeData',
method: 'get'
})
}
//分页
export function treeDatthree() {
return request({
url: '/ems/subentryType/treeData',
method: 'get'
})
}

@ -0,0 +1,55 @@
import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";
import qs from 'qs';
// 查询用户列表
export function listUser(data) {
return request({
url: '/ems/report/analysis/emsStatisticsData',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
//formdata:true,
})
}
// 查询底部列表
export function instantLis(data) {
return request({
url: '/ems/record/dnbInstant/instantList',
method: 'get',
params: data
})
}
// 真查询部门下拉树结构
export function treeDat() {
return request({
url: '/ems/base/monitorInfo/treeData/2',
method: 'get'
})
}
//
// // 一键秒表
// export function editMeterReading(data) {
// return request({
// url: '/ems/config/editMeterReading',
// method: 'post',
// data: data,
// //contentType:'application/x-www-form-urlencoded',
// })
// }
export function previewPolyline(params) {
return request({
url: '/ems/report/board/previewPolyline',
method: 'get',
params: params
})
}
export function dailyLossReport(params) {
return request({
url: '/ems/report/board/dailyLossReport',
method: 'get',
params: params
})
}

@ -0,0 +1,26 @@
import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";
import qs from 'qs';
// 查询用户列表1
export function listUser(data) {
return request({
url: '/ems/record/dnbInstant/list',
method: 'post',
data: data,
})
}
// 查询部门下拉树结构
export function treeDat() {
return request({
url: '/ems/base/monitorInfo/treeData/2',
method: 'get'
})
}
// 删除电实时数据
export function delDnbRemoveInstant(objid) {
return request({
url: '/ems/record/dnbInstant/dnbRemove/' + objid,
method: 'get'
})
}

@ -0,0 +1,51 @@
import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";
import qs from 'qs';
// 查询用户列表
export function listUser(data) {
return request({
url: '/ems/record/dnbInstant/selectRealTimeList',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
timeout: 1000 * 60,
//formdata:true,
})
}
// 查询底部列表
export function instantLis(data) {
return request({
url: '/ems/record/dnbInstant/instantList',
method: 'get',
params: data,
timeout: 1000 * 60,
})
}
// 真查询部门下拉树结构
export function treeDat() {
return request({
url: '/ems/base/monitorInfo/treeData/2',
method: 'get'
})
}
//
// 一键秒表
export function editMeterReading(data) {
return request({
url: '/ems/config/editMeterReading',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
})
}
// 一键秒表
export function voltageCurrentCurve(data) {
return request({
url: '/ems/record/dnbInstant/voltageCurrentCurve',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
})
}

@ -0,0 +1,19 @@
import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";
// 柱状图1
export function dnbCountingData(query) {
return request({
url: '/ems/report/analysis/emsMomAnalysisData',
method: 'get',
params: query
})
}
// 查询部门下拉树结构
export function deptTreeSelect() {
return request({
url: '/ems/base/monitorInfo/treeData/2',
method: 'get'
})
}

@ -0,0 +1,45 @@
import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";
import qs from 'qs';
// 查询列表1
export function listUser(data) {
return request({
url: '/ems/report/pointDnb/list',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
})
}
//日月年列表查询接口
export function listUser2(data) {
return request({
url: '/ems/report/pointDnb/datePointDnbList',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
})
}
// 柱状图1
export function dnbCountingData(query) {
return request({
url: '/ems/report/board/dnbCountingData',
method: 'get',
params: query
})
}
// 真查询部门下拉树结构
export function treeDat() {
return request({
url: '/ems/base/monitorInfo/treeData/2',
method: 'get'
})
}
// 查询部门下拉树结构
export function deptTreeSelect() {
return request({
url: '/system/user/deptTree',
method: 'get'
})
}

@ -0,0 +1,61 @@
import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";
import qs from 'qs';
// 查询用户列表
export function listUser(data) {
return request({
url: '/ems/record/dnbInstant/list',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
})
}
// 新增
export function addUser(data) {
return request({
url: '/ems/record/dnbInstant/add',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
})
}
// 修改
export function updateUser(data) {
return request({
url: '/ems/record/dnbInstant/edit',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
})
}
// 删除用户
export function delUser(data) {
return request({
url: '/ems/record/dnbInstant/remove',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
})
}
// 查询部门下拉树结构
export function deptTreeSelect() {
return request({
url: '/ems/base/monitorInfo/treeData/2',
method: 'get'
})
}
// 新增光伏发电整点数据
export function addReportPointDnb(data) {
return request({
url: '/ems/report/pointDnb/addPhotovoltaicPower',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
})
}

@ -0,0 +1,27 @@
import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";
import qs from 'qs';
// 查询用户列表1
export function listUser(data) {
return request({
url: '/ems/record/dnbInstant/list',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
})
}
// 柱状图1
export function dnbCountingData(query) {
return request({
url: '/report/board/dnbCountingData',
method: 'get',
params: query
})
}
// 查询部门下拉树结构
export function deptTreeSelect() {
return request({
url: '/ems/base/monitorInfo/treeData/2',
method: 'get'
})
}

@ -0,0 +1,19 @@
import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";
// 柱状图1
export function dnbCountingData(query) {
return request({
url: '/ems/report/analysis/emsYoyAnalysisData',
method: 'get',
params: query
})
}
// 查询部门下拉树结构
export function deptTreeSelect() {
return request({
url: '/ems/base/monitorInfo/treeData/2',
method: 'get'
})
}

@ -0,0 +1,28 @@
import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";
import qs from 'qs';
// 查询用户列表1
export function listUser(data) {
return request({
url: '/ems/report/analysis/lineLossAnalysisData',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
})
}
// 查询部门下拉树结构
export function treeDat() {
return request({
url: '/ems/base/monitorInfo/treeData/2',
method: 'get'
})
}
//report/analysis/lineLossAnalysisDetailsData
export function listUser2(data) {
return request({
url: '/ems/report/analysis/lineLossAnalysisDetailsData',
method: 'post',
data: qs.stringify(data),
contentType:'application/x-www-form-urlencoded',
})
}

@ -5,25 +5,25 @@
<el-col :span="6" :xs="24">
<div class="head-container">
<el-input
v-model="deptName"
placeholder="请输入计量设备名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
v-model="deptName"
placeholder="请输入计量设备名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container tree">
<el-tree
:data="deptOptions"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
default-expand-all
highlight-current
@node-click="handleNodeClick"
:data="deptOptions"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
:default-expanded-keys="[deptOptions[0].id]"
highlight-current
@node-click="handleNodeClick"
/>
</div>
</el-col>
@ -33,86 +33,110 @@
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="采集时间">
<el-date-picker
v-model="dateRangeone"
style="width: 240px"
type="datetime"
placeholder="选择日期时间"
value-format="yyyy-MM-dd HH:mm:ss"
:clearable="false"
v-model="dateRangeone"
style="width: 240px"
type="datetime"
placeholder="选择日期时间"
value-format="yyyy-MM-dd HH:mm:ss"
></el-date-picker>
</el-form-item>
<el-form-item><div>-</div></el-form-item>
<el-form-item><el-date-picker
v-model="dateRangetwo"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 240px"
type="datetime"
placeholder="选择日期时间"
:clearable="false"
v-model="dateRangetwo"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 240px"
type="datetime"
placeholder="选择日期时间"
></el-date-picker></el-form-item>
<!--el-form-item label="采集方式" prop="status">
<el-form-item label="采集方式" prop="status">
<el-select
v-model="queryParams.collectType"
placeholder="请选择"
clearable
style="width: 240px"
v-model="queryParams.collectType"
placeholder="请选择"
clearable
style="width: 240px"
>
<el-option
v-for="dict in dict"
:key="dict.value"
:label="dict.label"
:value="dict.value"
v-for="dict in dict"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item-->
</el-form-item>
<el-form-item label="记录时间">
<el-date-picker
v-model="daterangeRecordTime"
style="width: 340px"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetimerange"
range-separator="-"
start-placeholder="开始时间"
end-placeholder="结束时间"
></el-date-picker>
</el-form-item>
<!-- 搜索重置按钮 -->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<!-- 新增等功能按钮 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['record:dnbInstant:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<!-- 用户表格 -->
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="计量设备编号" align="center" key="monitorId" prop="monitorId" v-if="columns[0].visible" />
<el-table-column label="计量设备名称" align="center" key="monitorName" prop="monitorName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="采集时间" align="center" key="collectTime" prop="collectTime" v-if="columns[2].visible" />
<el-table-column label="A项电压(V)" align="center" key="va" prop="va" v-if="columns[3].visible" />
<el-table-column label="B项电压(V)" align="center" key="vb" prop="vb" v-if="columns[4].visible" />
<el-table-column label="C项电压(V)" align="center" key="vc" prop="vc" v-if="columns[5].visible" />
<el-table-column label="A项电流(A)" align="center" key="ia" prop="ia" v-if="columns[6].visible" />
<el-table-column label="B项电流(A)" align="center" key="ib" prop="ib" v-if="columns[7].visible" />
<el-table-column label="C项电流(A)" align="center" key="ic" prop="ic" v-if="columns[8].visible" />
<el-table-column label="功率因数" align="center" key="glys" prop="glys" v-if="columns[9].visible" />
<el-table-column label="仪表值(kW·h)" align="center" key="zxyg" prop="zxyg" v-if="columns[10].visible" />
<el-table-column label="计量设备编号" align="center" key="monitorId" prop="monitorId" v-if="columns[0].visible" width="100"/>
<el-table-column label="计量设备名称" align="center" key="monitorName" prop="monitorName" v-if="columns[1].visible" width="100" :show-overflow-tooltip="true" />
<el-table-column label="采集时间" align="center" key="collectTime" prop="collectTime" v-if="columns[2].visible" width="160"/>
<el-table-column label="A项电压(V)" align="center" key="va" prop="va" v-if="columns[3].visible" width="90"/>
<el-table-column label="B项电压(V)" align="center" key="vb" prop="vb" v-if="columns[4].visible" width="90"/>
<el-table-column label="C项电压(V)" align="center" key="vc" prop="vc" v-if="columns[5].visible" width="90"/>
<el-table-column label="A项电流(A)" align="center" key="ia" prop="ia" v-if="columns[6].visible" width="90"/>
<el-table-column label="B项电流(A)" align="center" key="ib" prop="ib" v-if="columns[7].visible" width="90"/>
<el-table-column label="C项电流(A)" align="center" key="ic" prop="ic" v-if="columns[8].visible" width="90"/>
<el-table-column label="功率因数" align="center" key="glys" prop="glys" v-if="columns[9].visible" width="90"/>
<el-table-column label="仪表值(kW·h)" align="center" key="zxyg" prop="zxyg" v-if="columns[10].visible" width="100"/>
<el-table-column label="采集方式" align="center" key="collectType" prop="collectType" v-if="columns[11].visible" :show-overflow-tooltip="true" >
<template slot-scope="scope1">
<div>{{scope1.row.collectType==0?'手动':(scope1.row.collectType==1?'自动':'抄表') }}</div>
</template>
</el-table-column>
<el-table-column label="记录时间" align="center" prop="recordTime" v-if="columns[12].visible" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.recordTime) }}</span>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.params.pageNum"
:limit.sync="queryParams.params.pageSize"
@pagination="getList"
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
@ -120,10 +144,11 @@
</template>
<script>
import {listHistory,treeDat} from "@/api/ems/base/emsRecord";
import { listUser, treeDat,delDnbRemoveInstant,deptTreeSelect } from "@/api/ems/powerUse/HistoryElectricity";
import { getToken } from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import * as echarts from 'echarts';
@ -150,7 +175,7 @@ export default {
//
title: "",
//
deptOptions: undefined,
deptOptions: [{id: 2}],
//
open: false,
//
@ -188,13 +213,18 @@ export default {
},
//
queryParams: {
pageNum: 1,
pageSize: 10,
orderByColumn: 'collectTime',
isAsc: 'desc',
collectType: '',
objid:"",
monitorSubset:'',
params:{
pageNum: 1,
pageSize: 10,
beginCollectTime:'',
endCollectTime:''
}
},
daterangeRecordTime: [],
//
columns: [
{ key: 0, label: `计量设备编号`, visible: true },
@ -208,7 +238,8 @@ export default {
{ key: 8, label: `C项电流(A)`, visible: true },
{ key: 9, label: `功率因数`, visible: true },
{ key: 10, label: `仪表值(kW·h)`, visible: true },
{ key: 11, label: `采集方式`, visible: true }
{ key: 11, label: `采集方式`, visible: true },
{ key: 12, label: `记录时间`, visible: true }
],
//
@ -241,6 +272,7 @@ export default {
},
//
dict:[
{label:'手动',value:'0'},
{label:'自动',value:'1'},
{label:'抄表',value:'2'},
],
@ -253,49 +285,50 @@ export default {
}
},
created() {
this.setDataRange();
this.dateRangeone=new Date(new Date().setHours(0, 0, 0, 0));
var d = new Date(this.dateRangeone);
let m = ('0'+(d.getMonth()+1)).slice(-2);;
let tian = ('0'+d.getDate()).slice(-2);
let h = ('0'+d.getHours()).slice(-2);
let M = ('0'+d.getMinutes()).slice(-2);
let s = ('0'+d.getSeconds()).slice(-2);
console.log('d',d)
this.dateRangeone = d.getFullYear()+ '-'+m+ '-'+tian+ ' '+ h+ ':'+M+':'+s;
this.dateRangetwo=new Date(new Date().setHours(0, 0, 0, 0) + 24 * 60 * 60 * 1000 - 1);
var d1 = new Date(this.dateRangetwo);
let m1 = ('0'+(d1.getMonth()+1)).slice(-2);
let tian1 = ('0'+d1.getDate()).slice(-2);
let h1 = ('0'+d1.getHours()).slice(-2);
let M1 = ('0'+d1.getMinutes()).slice(-2);
let s1 = ('0'+d1.getSeconds()).slice(-2);
console.log('tian1.length',tian1)
this.dateRangetwo = d1.getFullYear()+ '-'+m1+ '-'+tian1+ ' '+ h1+ ':'+M1+':'+s1;
//this.dateRangetwo = d1.getFullYear()+ '-'+m1+ '-'+tian1+ ' '+ h1+ ':'+M1+':'+s1;
this.getList();
this.getDeptTree();
},
mounted() {
},
methods: {
setDataRange(){
this.dateRangeone=new Date(new Date().setHours(0, 0, 0, 0));
var d = new Date(this.dateRangeone);
let m = ('0'+(d.getMonth()+1)).slice(-2);;
let tian = ('0'+d.getDate()).slice(-2);
let h = ('0'+d.getHours()).slice(-2);
let M = ('0'+d.getMinutes()).slice(-2);
let s = ('0'+d.getSeconds()).slice(-2);
console.log('d',d)
this.dateRangeone = d.getFullYear()+ '-'+m+ '-'+tian+ ' '+ h+ ':'+M+':'+s;
this.dateRangetwo=new Date(new Date().setHours(0, 0, 0, 0) + 24 * 60 * 60 * 1000 - 1);
var d1 = new Date(this.dateRangetwo);
let m1 = ('0'+(d1.getMonth()+1)).slice(-2);
let tian1 = ('0'+d1.getDate()).slice(-2);
let h1 = ('0'+d1.getHours()).slice(-2);
let M1 = ('0'+d1.getMinutes()).slice(-2);
let s1 = ('0'+d1.getSeconds()).slice(-2);
console.log('tian1.length',tian1)
this.dateRangetwo = d1.getFullYear()+ '-'+m1+ '-'+tian1+ ' '+ h1+ ':'+M1+':'+s1;
//this.dateRangetwo = d1.getFullYear()+ '-'+m1+ '-'+tian1+ ' '+ h1+ ':'+M1+':'+s1;
},
/** 查询用户列表 */
getList() {
this.loading = true;
//this.queryParams.params.beginCollectTime = this.dateRangeone;
// this.queryParams.params.endCollectTime = this.dateRangetwo;
this.dateRange[0] = this.dateRangeone;
this.dateRange[1] = this.dateRangetwo;
listHistory(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.userList = response.rows;
this.total = response.total;
this.loading = false;
}
this.queryParams.params = {};
this.queryParams.params.beginCollectTime = this.dateRangeone;
this.queryParams.params.endCollectTime = this.dateRangetwo;
if (null != this.daterangeRecordTime && '' != this.daterangeRecordTime) {
this.queryParams.params["beginRecordTime"] = this.daterangeRecordTime[0];
this.queryParams.params["endRecordTime"] = this.daterangeRecordTime[1];
}
console.log('this.datatimeone',this.queryParams)
listUser(this.queryParams).then(response => {
this.userList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
//
@ -334,12 +367,10 @@ export default {
treeDat().then(response => {
response.map((item,index)=>{
item,
item.oid=item.id,
item.lable = item.name
item.oid=item.id,
item.lable = item.name
})
this.deptOptions = this.tranListToTreeData(response);
console.log(this.deptOptions)
//this.deptOptions = response.data;
});
},
//
@ -349,7 +380,7 @@ export default {
},
//
handleNodeClick(data) {
this.queryParams.objid = data.id;
this.queryParams.monitorSubset = data.monitorId;
this.getList();
},
//
@ -357,6 +388,18 @@ export default {
this.open = false;
this.reset();
},
/** 删除按钮操作 */
handleDelete(row) {
const objids = row.objid || this.ids;
this.$modal.confirm('是否确认删除电实时数据编号为"' + objids + '"的数据项?').then(function() {
return delDnbRemoveInstant(objids)
}) .then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
}).catch(() => {
})
},
//
reset() {
this.form = {
@ -377,32 +420,25 @@ export default {
},
/** 搜索按钮操作 */
handleQuery() {
if(this.dateRangeone == null || this.dateRangeone == undefined || this.dateRange == ''){
this.$modal.msgWarning("请选择采集开始时间");
return;
}
if(this.dateRangetwo == null || this.dateRangetwo == undefined || this.dateRangetwo == ''){
this.$modal.msgWarning("请选择采集结束时间");
return;
}
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.objid = '';
//this.dateRange = [];
this.queryParams.collectType = '';
this.dateRangeone = '';
this.dateRangetwo = '';
this.setDataRange();
this.resetForm("queryForm");
//this.queryParams.deptId = undefined;
//this.$refs.tree.setCurrentKey(null);
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.userId);
this.single = selection.length != 1;
this.multiple = !selection.length;
this.ids = selection.map(item => item.objid)
this.single = selection.length!==1
this.multiple = !selection.length
},
//
handleCommand(command, row) {
@ -418,24 +454,15 @@ export default {
}
},
/** 导出按钮操作 */
handleExport() {
this.download('ems/record/dnbInstant/export', {
...this.queryParams
let paramsexport = JSON.parse(JSON.stringify(this.queryParams));
delete paramsexport.pageSize;
delete paramsexport.pageNum;
this.download('/energy/record/dnbInstant/export', {
...paramsexport
}, `user_${new Date().getTime()}.xlsx`)
},
/** 导出按钮操作 */
// handleExport() {
// let paramsexport = JSON.parse(JSON.stringify(this.queryParams));
// delete paramsexport.pageSize;
// delete paramsexport.pageNum;
// this.download('/energy/record/dnbInstant/export', {
// ...paramsexport
// }, `user_${new Date().getTime()}.xlsx`)
// },
}
};
</script>

Loading…
Cancel
Save