!63 !62 综合能耗日月年
Merge pull request !63 from letsgocoding/develop1.0
已修改34个文件
已添加62个文件
已删除7个文件
| | |
| | | package com.zhitan.web.controller.common; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import com.zhitan.common.config.BaseConfig; |
| | | import com.zhitan.common.constant.Constants; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.common.utils.file.FileUploadUtils; |
| | | import com.zhitan.common.utils.file.FileUtils; |
| | | import com.zhitan.framework.config.ServerConfig; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.http.MediaType; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.zhitan.common.config.BaseConfig; |
| | | import com.zhitan.common.constant.Constants; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.common.utils.file.FileUploadUtils; |
| | | import com.zhitan.common.utils.file.FileUtils; |
| | | import com.zhitan.framework.config.ServerConfig; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * éç¨è¯·æ±å¤ç |
| | |
| | | private ServerConfig serverConfig; |
| | | |
| | | private static final String FILE_DELIMETER = ","; |
| | | |
| | | @Resource |
| | | private BaseConfig baseConfig; |
| | | |
| | | /** |
| | | * éç¨ä¸è½½è¯·æ± |
| | |
| | | String filePath = BaseConfig.getUploadPath(); |
| | | // ä¸ä¼ å¹¶è¿åæ°æä»¶åç§° |
| | | String fileName = FileUploadUtils.upload(filePath, file); |
| | | String url = serverConfig.getUrl() + fileName; |
| | | String url = baseConfig.getDomainName() + fileName; |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("url", url); |
| | | ajax.put("fileName", fileName); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.comprehensivestatistics; |
| | | |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.utils.poi.ExcelUtil; |
| | | import com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive; |
| | | import com.zhitan.comprehensivestatistics.service.ImonthlyComprehensive; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.service.IModelNodeService; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.text.DateFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * electricityPriceController |
| | | * |
| | | * @author sys |
| | | * @date 2020-02-18 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/comprehensive/monthlyComprehensive") |
| | | @Api(value = "ç»¼åææ åæï¼æï¼controller",tags = {"ç»¼åææ åæ"}) |
| | | public class MonthlyComprehensiveController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IModelNodeService modelNodeService; |
| | | @Autowired |
| | | private ImonthlyComprehensive monthlyComprehensive; |
| | | |
| | | /*å
¨åè½èç»è®¡*/ |
| | | @ApiOperation(value = "è·åç»¼åææ åæï¼æï¼å表") |
| | | @GetMapping("/list") |
| | | public AjaxResult list(DataItem dataItem) { |
| | | try { |
| | | |
| | | Map tableColumn =new HashMap<>();//è¡¨æ°æ® |
| | | List<MonthlyComprehensive> dataList=new ArrayList<>(); |
| | | DateFormat df = new SimpleDateFormat("yyyy-MM"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa= df.format(dataItem.getDataTime()); |
| | | String bb=""; |
| | | int i = 1; |
| | | String beginTime=aa+"-01 00:00:00"; |
| | | dataItem.setBeginTime(sf.parse(beginTime)); |
| | | String endTime=aa+"-"+Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length()-2))+" 00:00:00"; |
| | | dataItem.setEndTime(sf.parse(endTime)); |
| | | while (i <= Integer.parseInt(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2))) { |
| | | if (i > 9) { |
| | | bb = aa + "-" + i + " 00:00:00"; |
| | | } else { |
| | | bb = aa + "-0" + i + " 00:00:00"; |
| | | } |
| | | MonthlyComprehensive report = new MonthlyComprehensive(); |
| | | report.setDataTime(sf.parse(bb)); |
| | | report.setValue("value" + i); |
| | | dataList.add(report); |
| | | tableColumn.put("value" + i, String.valueOf(i) + "æ¥"); |
| | | i++; |
| | | } |
| | | |
| | | MonthlyComprehensive reportList = new MonthlyComprehensive(); |
| | | List<Map> table = new ArrayList<>(); |
| | | table.add(tableColumn); |
| | | reportList.setTablehead(table); |
| | | |
| | | ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(dataItem.getIndexCode()); |
| | | if (ObjectUtils.isEmpty(modelNode)) { |
| | | return AjaxResult.success(reportList); |
| | | } |
| | | List<MonthlyComprehensive> list = monthlyComprehensive.getMonthlyComprehensiveList(modelNode.getNodeId(), |
| | | dataList, dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(), dataItem.getIndexStorageId()); |
| | | int count = Integer.parseInt(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2)); |
| | | list.forEach(monthlyReport -> monthlyReport.setCount(count)); |
| | | reportList.setTabledata(list); |
| | | |
| | | return AjaxResult.success(reportList); |
| | | } catch (Exception ex) { |
| | | logger.error("è·ååºéï¼", ex); |
| | | return AjaxResult.error("è·ååºé!"); |
| | | } |
| | | } |
| | | /**/ |
| | | /** |
| | | * å
¨å综åè½èç»è®¡å¾ |
| | | */ |
| | | @GetMapping("/listChart") |
| | | @ApiOperation(value = "è·åç»¼åææ åæå¾è¡¨ï¼æï¼æ°æ®") |
| | | public AjaxResult listChart(DataItem dataItem) throws ParseException { |
| | | DateFormat df = new SimpleDateFormat("yyyy-MM"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa= df.format(dataItem.getDataTime()); |
| | | String beginTime=aa+"-01 00:00:00"; |
| | | dataItem.setBeginTime(sf.parse(beginTime)); |
| | | String endTime=aa+"-"+Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length()-2))+" 00:00:00"; |
| | | dataItem.setEndTime(sf.parse(endTime)); |
| | | List<MonthlyComprehensive> list = monthlyComprehensive.getListChart(dataItem.getIndexId(),dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId()); |
| | | return AjaxResult.success(list); |
| | | } |
| | | public static String getLastDayOfMonth(String yearMonth) { |
| | | int year = Integer.parseInt(yearMonth.split("-")[0]); //å¹´ |
| | | int month = Integer.parseInt(yearMonth.split("-")[1]); //æ |
| | | Calendar cal = Calendar.getInstance(); |
| | | // 设置年份 |
| | | cal.set(Calendar.YEAR, year); |
| | | // 设置æä»½ |
| | | // cal.set(Calendar.MONTH, month - 1); |
| | | cal.set(Calendar.MONTH, month); //设置å½åæçä¸ä¸ä¸ªæ |
| | | // è·åæææå¤§å¤©æ° |
| | | //int lastDay = cal.getActualMaximum(Calendar.DATE); |
| | | int lastDay = cal.getMinimum(Calendar.DATE); //è·åæä»½ä¸çæå°å¼ï¼å³ç¬¬ä¸å¤© |
| | | // 设置æ¥å䏿份çæå¤§å¤©æ° |
| | | //cal.set(Calendar.DAY_OF_MONTH, lastDay); |
| | | cal.set(Calendar.DAY_OF_MONTH, lastDay - 1); //䏿ç第ä¸å¤©åå»1å°±æ¯å½æçæåä¸å¤© |
| | | // æ ¼å¼åæ¥æ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | return sdf.format(cal.getTime()); |
| | | } |
| | | /*ç»¼åææ¥è¡¨å¯¼åº*/ |
| | | // @Log(title = "ç»¼åææ¥è¡¨å¯¼åº", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | @ApiOperation(value = "ç»¼åææ¥è¡¨å¯¼åº") |
| | | public AjaxResult export(DataItem dataItem) { |
| | | try { |
| | | |
| | | Map tableColumn =new HashMap<>();//è¡¨æ°æ® |
| | | List<MonthlyComprehensive> dataList=new ArrayList<>(); |
| | | DateFormat df = new SimpleDateFormat("yyyy-MM"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa= df.format(dataItem.getDataTime()); |
| | | String bb=""; |
| | | int i = 1; |
| | | String beginTime=aa+"-01 00:00:00"; |
| | | dataItem.setBeginTime(sf.parse(beginTime)); |
| | | String endTime=aa+"-"+Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length()-2))+" 00:00:00"; |
| | | dataItem.setEndTime(sf.parse(endTime)); |
| | | while (i <= Integer.parseInt(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2))) { |
| | | if (i > 9) { |
| | | bb = aa + "-" + i + " 00:00:00"; |
| | | } else { |
| | | bb = aa + "-0" + i + " 00:00:00"; |
| | | } |
| | | MonthlyComprehensive report = new MonthlyComprehensive(); |
| | | report.setDataTime(sf.parse(bb)); |
| | | report.setValue("value" + i); |
| | | dataList.add(report); |
| | | tableColumn.put("value" + i, i + "æ¥"); |
| | | i++; |
| | | } |
| | | |
| | | MonthlyComprehensive reportList = new MonthlyComprehensive(); |
| | | List<Map> table = new ArrayList<>(); |
| | | table.add(tableColumn); |
| | | reportList.setTablehead(table); |
| | | |
| | | ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(dataItem.getIndexCode()); |
| | | if (ObjectUtils.isEmpty(modelNode)) { |
| | | return AjaxResult.success(reportList); |
| | | } |
| | | List<MonthlyComprehensive> list = monthlyComprehensive.getMonthlyComprehensiveList(modelNode.getNodeId(), dataList, |
| | | dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(), dataItem.getIndexStorageId()); |
| | | int count = Integer.parseInt(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2)); |
| | | list.forEach(monthlyReport -> monthlyReport.setCount(count)); |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | list.forEach(this::valueRep); |
| | | } |
| | | ExcelUtil<MonthlyComprehensive> util = new ExcelUtil<>(MonthlyComprehensive.class); |
| | | return util.exportExcel(list, "ç»¼åææ åææ"); |
| | | } catch (Exception ex) { |
| | | logger.error("è·ååºéï¼", ex); |
| | | return AjaxResult.error("è·ååºé!"); |
| | | } |
| | | } |
| | | public void valueRep(Object dr){ |
| | | Field[] fields = dr.getClass().getDeclaredFields(); |
| | | for(Field field:fields){ |
| | | field.setAccessible(true); |
| | | Object obj = field.getType(); |
| | | if(field.getType().getName().equals("java.lang.Double")){ |
| | | String name = field.getName(); |
| | | try { |
| | | if(ObjectUtils.isEmpty(field.get(dr))) |
| | | { |
| | | field.set(dr,0.00); |
| | | } |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.comprehensivestatistics; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.enums.BusinessType; |
| | | import com.zhitan.common.utils.poi.ExcelUtil; |
| | | import com.zhitan.comprehensivestatistics.domain.YearComperhensive; |
| | | import com.zhitan.comprehensivestatistics.service.IyearComprehensive; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.service.IModelNodeService; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * electricityPriceController |
| | | * |
| | | * @author sys |
| | | * @date 2020-02-18 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/comprehensive/yearComprehensive") |
| | | @Api(value = "ç»¼åææ åæï¼å¹´ï¼controller",tags = {"ç»¼åææ åæ"}) |
| | | public class YearComprehensiveController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IModelNodeService modelNodeService; |
| | | @Autowired |
| | | private IyearComprehensive yearComprehensive; |
| | | |
| | | /*å
¨åè½èç»è®¡*/ |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "è·åç»¼åææ åæï¼å¹´ï¼å表") |
| | | public AjaxResult list(DataItem dataItem) { |
| | | try { |
| | | ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(dataItem.getIndexCode()); |
| | | if (ObjectUtils.isEmpty(modelNode)) { |
| | | return AjaxResult.success("ææ æ°æ®"); |
| | | } |
| | | List<YearComperhensive> dataList = new ArrayList<>(); |
| | | |
| | | dataItem.setBeginTime(DateUtil.beginOfYear(dataItem.getDataTime())); |
| | | dataItem.setEndTime(DateUtil.endOfYear(dataItem.getDataTime())); |
| | | |
| | | DateFormat df = new SimpleDateFormat("yyyy"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa = df.format(dataItem.getDataTime()); |
| | | String bb = ""; |
| | | int i = 1; |
| | | while (i <= 12) { |
| | | if(i > 9){ |
| | | bb = aa + "-" + i + "-01 00:00:00"; |
| | | }else{ |
| | | bb = aa + "-0" + i + "-01 00:00:00"; |
| | | } |
| | | YearComperhensive report = new YearComperhensive(); |
| | | report.setDataTime(sf.parse(bb)); |
| | | report.setValue("value" + i); |
| | | dataList.add(report); |
| | | i++; |
| | | } |
| | | List<YearComperhensive> list = yearComprehensive.getYearComprehensiveList(modelNode.getNodeId(), |
| | | dataList,dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId()); |
| | | return AjaxResult.success(list); |
| | | } catch (Exception ex) { |
| | | logger.error("è·ååºéï¼", ex); |
| | | return AjaxResult.error("è·ååºé!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å
¨å综åè½èç»è®¡å¾ |
| | | */ |
| | | @GetMapping("/listChart") |
| | | @ApiOperation(value = "è·åç»¼åææ åæå¾è¡¨ï¼å¹´ï¼æ°æ®") |
| | | public AjaxResult listChart(DataItem dataItem){ |
| | | |
| | | dataItem.setBeginTime(DateUtil.beginOfYear(dataItem.getDataTime())); |
| | | dataItem.setEndTime(DateUtil.endOfYear(dataItem.getDataTime())); |
| | | |
| | | List<YearComperhensive> list = yearComprehensive.getListChart(dataItem.getIndexId(),dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId()); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | /** |
| | | * 导åºå·¥åºåèç»è®¡ææ 设置åè½å表 |
| | | */ |
| | | @Log(title = "ç»¼åæ¥è¡¨", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | @ApiOperation(value = "综åå¹´æ¥è¡¨å¯¼åº") |
| | | public AjaxResult export(DataItem dataItem) { |
| | | try { |
| | | ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(dataItem.getIndexCode()); |
| | | if (ObjectUtils.isEmpty(modelNode)) { |
| | | return AjaxResult.success("ææ æ°æ®"); |
| | | } |
| | | List<YearComperhensive> dataList = new ArrayList<>(); |
| | | DateFormat df = new SimpleDateFormat("yyyy"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa = df.format(dataItem.getBeginTime()); |
| | | String bb = ""; |
| | | int i = 1; |
| | | while (i <= 12) { |
| | | if(i>9){ |
| | | bb=aa+"-"+i+"-01 00:00:00"; |
| | | }else{ |
| | | bb=aa+"-0"+i+"-01 00:00:00"; |
| | | } |
| | | YearComperhensive report=new YearComperhensive(); |
| | | report.setDataTime(sf.parse(bb)); |
| | | report.setValue("value"+i); |
| | | dataList.add(report); |
| | | i++; |
| | | } |
| | | List<YearComperhensive> list = yearComprehensive.getYearComprehensiveList(modelNode.getNodeId(), |
| | | dataList,dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId()); |
| | | if(CollectionUtils.isNotEmpty(list)){ |
| | | list.forEach(this::valueRep); |
| | | } |
| | | ExcelUtil<YearComperhensive> util = new ExcelUtil<>(YearComperhensive.class); |
| | | return util.exportExcel(list, "ç»¼åææ åæå¹´"); |
| | | } catch (Exception ex) { |
| | | logger.error("è·ååºéï¼", ex); |
| | | return AjaxResult.error("è·ååºé!"); |
| | | } |
| | | } |
| | | |
| | | public void valueRep(Object dr){ |
| | | Field[] fields = dr.getClass().getDeclaredFields(); |
| | | for(Field field:fields){ |
| | | field.setAccessible(true); |
| | | Object obj = field.getType(); |
| | | if(field.getType().getName().equals("java.lang.Double")){ |
| | | String name = field.getName(); |
| | | try { |
| | | if(ObjectUtils.isEmpty(field.get(dr))) |
| | | { |
| | | field.set(dr,0.00); |
| | | } |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zhitan.web.controller.energyMonitor; |
| | | |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.constant.CommonConst; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.energyMonitor.service.IEnergyUnitToDeviceService; |
| | | import com.zhitan.energyMonitor.domain.vo.ListElectricLoadVO; |
| | | import com.zhitan.energyMonitor.service.IElectricLoadService; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.service.IEnergyIndexService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | @Slf4j |
| | | public class ElectricLoadController extends BaseController { |
| | | @Autowired |
| | | private IEnergyUnitToDeviceService energyUnitToDeviceService; |
| | | // @Autowired |
| | | // private IElectricLoadService electricLoadService; |
| | | private IElectricLoadService electricLoadService; |
| | | @Autowired |
| | | private IEnergyIndexService energyIndexService; |
| | | |
| | | /** |
| | | * æ ¹æ®çµè¡¨idè·åè´è·åææ°æ® |
| | | * |
| | | * @param energyUnitId ç¨è½åå
id |
| | | * @param meterId çµè¡¨id |
| | | * @param timeType æ¶é´ç±»å DAY/MONTH/YEAR |
| | | * @param timeCode æ¶é´å¼ 䏿¶é´ç±»å对åºï¼2022-03-21/2022-03/2022 |
| | | * @return |
| | | * @param nodeId ç¨è½åå
id |
| | | * @param meterId çµè¡¨id |
| | | * @param timeType æ¶é´ç±»å DAY/MONTH/YEAR |
| | | * @param timeCode æ¶é´å¼ 䏿¶é´ç±»å对åºï¼2022-03-21/2022-03/2022 |
| | | */ |
| | | @Log(title = "æ ¹æ®çµè¡¨idè·åè´è·åææ°æ®") |
| | | @ApiOperation(value = "æ ¹æ®çµè¡¨idè·åè´è·åææ°æ®", notes = "æ ¹æ®çµè¡¨idè·åè´è·åææ°æ®") |
| | | @GetMapping(value = "/detail") |
| | | public AjaxResult list(@RequestParam(name = "energyUnitId") String energyUnitId, |
| | | public AjaxResult list(@RequestParam(name = "nodeId") String nodeId, |
| | | @RequestParam(name = "meterId") String meterId, |
| | | @RequestParam(name = "timeType") String timeType, |
| | | @RequestParam(name = "timeCode") String timeCode) { |
| | | // EnergyIndex energyIndex = energyIndexService.getDeviceIndexByCode(energyUnitId, meterId, CommonConst.TAG_CODE_ZYGGL); |
| | | // |
| | | // EnergyUnitToDevice energyUnitToDevice = energyUnitToDeviceService.getEnergyUnitToDeviceById(energyUnitId, meterId); |
| | | // ListElectricLoadVO lsvo = electricLoadService.list(timeType, timeCode, energyIndex, energyUnitToDevice); |
| | | return AjaxResult.success(null); |
| | | EnergyIndex energyIndex = energyIndexService.getDeviceIndexByCode(nodeId, meterId, CommonConst.TAG_CODE_ZYGGL); |
| | | |
| | | ListElectricLoadVO vo = electricLoadService.list(timeType, timeCode, energyIndex); |
| | | return AjaxResult.success(vo); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.energyMonitor; |
| | | |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.constant.CommonConst; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.energyMonitor.service.IElectricPowerFactorService; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.service.IEnergyIndexService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @Description: åçå æ° |
| | | * @Author: yxw |
| | | * @Date: 2022-04-24 |
| | | * @Version: V1.2 |
| | | */ |
| | | @Api(tags = "åçå æ°") |
| | | @RestController |
| | | @RequestMapping("/powerFactorAnalysis") |
| | | @Slf4j |
| | | public class ElectricPowerFactorController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IElectricPowerFactorService electricPowerFactorService; |
| | | |
| | | @Autowired |
| | | private IEnergyIndexService energyIndexService; |
| | | |
| | | /** |
| | | * æ ¹æ®çµè¡¨idè·ååçå æ°æ°æ® |
| | | * |
| | | * @param nodeId èç¹id |
| | | * @param meterId çµè¡¨id |
| | | * @param timeCode æ¶é´å¼ 䏿¶é´ç±»å对åºï¼2022-03-21 |
| | | */ |
| | | @Log(title = "æ ¹æ®çµè¡¨idè·ååçå æ°æ°æ®") |
| | | @ApiOperation(value = "æ ¹æ®çµè¡¨idè·ååçå æ°æ°æ®", notes = "æ ¹æ®çµè¡¨idè·ååçå æ°æ°æ®") |
| | | @GetMapping(value = "/detail") |
| | | public AjaxResult list(@RequestParam(name = "nodeId") String nodeId, |
| | | @RequestParam(name = "meterId") String meterId, |
| | | @RequestParam(name = "timeCode") String timeCode) { |
| | | EnergyIndex energyIndex = energyIndexService.getDeviceIndexByCode(nodeId, meterId, CommonConst.TAG_CODE_GLYS); |
| | | |
| | | return AjaxResult.success(electricPowerFactorService.list(timeCode, energyIndex)); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.energyMonitor; |
| | | |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.energyMonitor.service.IElectricThreePhaseService; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.service.IEnergyIndexService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: ä¸ç¸ä¸å¹³è¡¡ |
| | | * @Author: yxw |
| | | * @Date: 2022-04-24 |
| | | * @Version: V1.2 |
| | | */ |
| | | @Api(tags = "ä¸ç¸ä¸å¹³è¡¡") |
| | | @RestController |
| | | @RequestMapping("/threePhaseUnbalanceAnalysis") |
| | | @Slf4j |
| | | public class ElectricThreePhaseController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IElectricThreePhaseService electricThreePhaseService; |
| | | @Autowired |
| | | private IEnergyIndexService energyIndexService; |
| | | |
| | | /** |
| | | * è·åç¨è½åå
ä¸çæä¸ªçµè¡¨çä¸ç¸ä¸å¹³è¡¡æ°æ® |
| | | * |
| | | * @param nodeId èç¹id |
| | | * @param meterId çµè¡¨id |
| | | * @param timeType æ¶é´ç±»å DAY/MONTH/YEAR |
| | | * @param timeCode æ¶é´å¼ 䏿¶é´ç±»å对åºï¼2022-03-21/2022-03/2022 |
| | | * @param requestType 请æ±ç±»åï¼0.çµåï¼1.çµæµ |
| | | * @return |
| | | */ |
| | | @Log(title = "æ ¹æ®çµè¡¨idæ¥è¯¢ä¸ç¸ä¸å¹³è¡¡æ°æ®") |
| | | @ApiOperation(value = "æ ¹æ®çµè¡¨idæ¥è¯¢ä¸ç¸ä¸å¹³è¡¡æ°æ®", notes = "æ ¹æ®çµè¡¨idæ¥è¯¢ä¸ç¸ä¸å¹³è¡¡æ°æ®") |
| | | @GetMapping(value = "/detail") |
| | | public AjaxResult list(@RequestParam(name = "nodeId") String nodeId, |
| | | @RequestParam(name = "meterId") String meterId, |
| | | @RequestParam(name = "timeType") String timeType, |
| | | @RequestParam(name = "timeCode") String timeCode, |
| | | @RequestParam(name = "requestType") String requestType) { |
| | | if (ObjectUtils.isEmpty(meterId)){ |
| | | return AjaxResult.error("çµè¡¨idä¸è½ä¸ºç©º"); |
| | | } |
| | | List<EnergyIndex> energyIndexList = energyIndexService.listDeviceIndex(nodeId, meterId); |
| | | |
| | | return AjaxResult.success(electricThreePhaseService.list(timeType, timeCode, energyIndexList, requestType, meterId)); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zhitan.web.controller.keyequipment; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.core.page.TableDataInfo; |
| | | import com.zhitan.comprehensivestatistics.domain.YearComperhensive; |
| | | import com.zhitan.keyequipment.domain.YearKeyEquipment; |
| | | import com.zhitan.keyequipment.service.IYearKeyEquipmentService; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | |
| | | } |
| | | List<String> indexIds = energyList.stream().map(EnergyIndex::getIndexId).collect(Collectors.toList()); |
| | | List<YearKeyEquipment> dataList=new ArrayList<>(); |
| | | |
| | | dataItem.setBeginTime(DateUtil.beginOfYear(dataItem.getDataTime())); |
| | | dataItem.setEndTime(DateUtil.endOfYear(dataItem.getDataTime())); |
| | | |
| | | DateFormat df = new SimpleDateFormat("yyyy"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa= df.format(dataItem.getBeginTime()); |
| | | String aa= df.format(dataItem.getDataTime()); |
| | | String bb=""; |
| | | int i = 1; |
| | | while (i <= 12) { |
| | |
| | | @GetMapping("/listChart") |
| | | @ApiOperation(value = "éç¹è®¾å¤è½èç»è®¡ï¼å¹´ï¼å¾è¡¨") |
| | | public AjaxResult listChart(DataItem dataItem){ |
| | | |
| | | List<YearKeyEquipment> list = yearKeyEquipmentService.getListChart(dataItem.getIndexId(),dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId()); |
| | | return AjaxResult.success(list); |
| | | } |
| | |
| | | @ApiOperation(value = "è·åå°å³°å¹³è°·åæ¶ç»è®¡") |
| | | public AjaxResult segmentAnalysisDay(PeakValleyDTO dto) { |
| | | return AjaxResult.success(rulesService.segmentAnalysisDay(dto)); |
| | | // return AjaxResult.success(rulesService.segmentAnalysisDayCustomize(dto)); |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.statisticalAnalysis; |
| | | |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.dataitem.service.IDataItemService; |
| | | import com.zhitan.statisticalAnalysis.domain.dto.FlowChartsDTO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | |
| | | /** |
| | | * è½èç»è®¡åæ |
| | | */ |
| | | @Api(tags = "è½èç»è®¡åæ") |
| | | @RestController |
| | | @RequestMapping("/statisticsAnalysis") |
| | | public class EnergyDataItemController { |
| | | |
| | | @Autowired |
| | | private IDataItemService dataItemService; |
| | | |
| | | /** |
| | | * è·åè½æµå¾å½¢åæ |
| | | * |
| | | * @param dto 请æ±åæ° |
| | | * @return ç»æ |
| | | */ |
| | | @Log(title = "è·åè½æµå¾å½¢åæ") |
| | | @ApiOperation(value = "è·åè½æµå¾å½¢åæ", notes = "è·åè½æµå¾å½¢åæ") |
| | | @GetMapping(value = "/getFlowCharts") |
| | | public AjaxResult getFlowCharts(@Validated FlowChartsDTO dto) { |
| | | return AjaxResult.success(dataItemService.getFlowCharts(dto)); |
| | | } |
| | | } |
| | |
| | | addressEnabled: true |
| | | # éªè¯ç ç±»å math æ°åè®¡ç® char å符éªè¯ |
| | | captchaType: math |
| | | # ååå°å |
| | | domainName: https://demo-ems.zhitancloud.com/prod-api |
| | | |
| | | # å¼åç¯å¢é
ç½® |
| | | server: |
| | |
| | | /** éªè¯ç ç±»å */ |
| | | private static String captchaType; |
| | | |
| | | /** |
| | | * æä»¶å°ååå |
| | | */ |
| | | private String domainName; |
| | | |
| | | |
| | | public String getName() |
| | | { |
| | | return name; |
| | |
| | | public static String getConfigurePath() { |
| | | return getProfile() + "/configure"; |
| | | } |
| | | |
| | | public String getDomainName() { |
| | | return domainName; |
| | | } |
| | | |
| | | public void setDomainName(String domainName) { |
| | | this.domainName = domainName; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.common.utils; |
| | | |
| | | |
| | | import com.zhitan.common.constant.CommonConst; |
| | | import com.zhitan.common.constant.TimeTypeConst; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: ç»è®¡å¾ç¸å
³æ°æ®å·¥å
·ç±» |
| | | * @author: yxw |
| | | * @date: 2022å¹´04æ28æ¥ 15:29 |
| | | */ |
| | | public class ChartUtils { |
| | | |
| | | /** |
| | | * æé æ¥æå表 |
| | | * |
| | | * @param timeType |
| | | * @param timeCode |
| | | * @param dateList |
| | | */ |
| | | public static void generateDateList(String timeType, String timeCode, List<Date> dateList) { |
| | | Date now = new Date(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | if (!timeCode.contains(CommonConst.SINGLE_MINUS_SIGN)) { |
| | | timeCode = DateTimeUtil.toDateTimeStr(timeCode, DateTimeUtil.COMMON_PATTERN_DAY, DateTimeUtil.COMMON_PATTERN_TO_DAY); |
| | | } |
| | | int hour = 23; |
| | | for (int i = CommonConst.DIGIT_0; i <= hour; i++) { |
| | | String tempCode = timeCode + " 0" + i; |
| | | if (i > 9) { |
| | | tempCode = timeCode + " " + i; |
| | | } |
| | | Date tempD = DateTimeUtil.toDateTime(tempCode, DateTimeUtil.COMMON_PATTERN_TO_HOUR); |
| | | dateList.add(tempD); |
| | | } |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | if (!timeCode.contains(CommonConst.SINGLE_MINUS_SIGN)) { |
| | | timeCode = DateTimeUtil.toDateTimeStr(timeCode, DateTimeUtil.COMMON_PATTERN_MONTH, DateTimeUtil.COMMON_PATTERN_TO_MONTH); |
| | | } |
| | | int max = DateTimeUtil.getDateTimeLastDay(DateTimeUtil.toDateTime(timeCode, DateTimeUtil.COMMON_PATTERN_TO_MONTH)); |
| | | |
| | | for (int i = CommonConst.DIGIT_1; i <= max; i++) { |
| | | String tempCode = timeCode + "-0" + i; |
| | | if (i > 9) { |
| | | tempCode = timeCode + "-" + i; |
| | | } |
| | | Date tempD = DateTimeUtil.toDateTime(tempCode, DateTimeUtil.COMMON_PATTERN_TO_DAY); |
| | | dateList.add(tempD); |
| | | } |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | int monthMax = 12; |
| | | for (int i = CommonConst.DIGIT_1; i <= monthMax; i++) { |
| | | String tempCode = timeCode + "-0" + i; |
| | | if (i > 9) { |
| | | tempCode = timeCode + "-" + i; |
| | | } |
| | | Date tempD = DateTimeUtil.toDateTime(tempCode, DateTimeUtil.COMMON_PATTERN_TO_MONTH); |
| | | dateList.add(tempD); |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·å对åºçç»ææ¶é´ |
| | | * |
| | | * @param timeType |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static Date getEndTime(String timeType, Date date) { |
| | | Date d1 = new Date(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | d1 = DateTimeUtil.addDays(date, CommonConst.DIGIT_1); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | d1 = DateTimeUtil.addMonths(date, CommonConst.DIGIT_1); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | d1 = DateTimeUtil.addYears(date, CommonConst.DIGIT_1); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return d1; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¥ææ¾ç¤ºå符 |
| | | * |
| | | * @param timeType |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static String getTimeCode(String timeType, Date date) { |
| | | String str = CommonConst.EMPTY; |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | str = DateTimeUtil.getDateTime(date, DateTimeUtil.COMMON_PATTERN_TO_HOUR); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | str = DateTimeUtil.getDateTime(date, DateTimeUtil.COMMON_PATTERN_TO_DAY); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | str = DateTimeUtil.getDateTime(date, DateTimeUtil.COMMON_PATTERN_TO_MONTH); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¥ææ¾ç¤ºå符 |
| | | * |
| | | * @param timeType |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static String getTimeCodeChart(String timeType, Date date) { |
| | | String str = CommonConst.EMPTY; |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | str = DateTimeUtil.getDateTime(date, DateTimeUtil.COMMON_PATTERN_HOUR_MINUTE); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | str = DateTimeUtil.getDateTime(date, DateTimeUtil.COMMON_PATTERN_MONTH_DAY); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | str = DateTimeUtil.getDateTime(date, DateTimeUtil.COMMON_PATTERN_TO_MONTH); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¥ææ¾ç¤ºå符 |
| | | * |
| | | * @param timeType |
| | | * @param timeCode |
| | | * @return |
| | | */ |
| | | public static Date getDateTime(String timeType, String timeCode) { |
| | | Date d1 = new Date(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | if (!timeCode.contains(CommonConst.SINGLE_MINUS_SIGN)) { |
| | | timeCode = DateTimeUtil.toDateTimeStr(timeCode, DateTimeUtil.COMMON_PATTERN_DAY, DateTimeUtil.COMMON_PATTERN_TO_DAY); |
| | | } |
| | | d1 = DateTimeUtil.toDateTime(timeCode, DateTimeUtil.COMMON_PATTERN_TO_DAY); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | if (!timeCode.contains(CommonConst.SINGLE_MINUS_SIGN)) { |
| | | timeCode = DateTimeUtil.toDateTimeStr(timeCode, DateTimeUtil.COMMON_PATTERN_MONTH, DateTimeUtil.COMMON_PATTERN_TO_MONTH); |
| | | } |
| | | d1 = DateTimeUtil.toDateTime(timeCode, DateTimeUtil.COMMON_PATTERN_TO_MONTH); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | d1 = DateTimeUtil.toDateTime(timeCode, DateTimeUtil.COMMON_PATTERN_YEAR); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return d1; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.common.utils; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.zhitan.common.constant.CommonConst; |
| | | import com.zhitan.common.constant.TimeTypeConst; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.GregorianCalendar; |
| | | |
| | | /** |
| | | * @Description: æ¶é´å·¥å
·ç±» |
| | | * @author: yxw |
| | | * @date: 2022å¹´02æ02æ¥ 12:23 |
| | | */ |
| | | @Slf4j |
| | | public class DateTimeUtil { |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ |
| | | */ |
| | | public static final String COMMON_PATTERN = "yyyy-MM-dd HH:mm:ss"; |
| | | /** |
| | | * æ ¼å¼åæ¥æå°åé |
| | | */ |
| | | public static final String COMMON_PATTERN_END_WITH_MINUTE = "yyyy-MM-dd HH:mm"; |
| | | /** |
| | | * æ¥ææ ¼å¼ - å°æ¶:åé |
| | | */ |
| | | public static final String COMMON_PATTERN_HOUR_MINUTE = "HH:mm"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - 年份 |
| | | */ |
| | | public static final String COMMON_PATTERN_YEAR = "yyyy"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - æä¸å¹´, |
| | | */ |
| | | public static final String COMMON_PATTERN_CERTAIN_YEAR = "yy"; |
| | | |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - æä»½ |
| | | */ |
| | | public static final String COMMON_PATTERN_MONTH = "yyyyMM"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - æä»½ |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_MONTH = "yyyy-MM"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - æä»½ |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_MONTH_WORD = "yyyy-MMæ"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - æä»½ |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_MONTH_ZH = "yyyyå¹´MMæ"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - 天 |
| | | */ |
| | | public static final String COMMON_PATTERN_DAY = "yyyyMMdd"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - 天 |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_DAY = "yyyy-MM-dd"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - 天 |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_DAY_WORD = "yyyy-MM-ddæ¥"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - ææ¥ |
| | | */ |
| | | public static final String COMMON_PATTERN_MONTH_DAY = "MM-dd"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - 天æä¸å¤©, |
| | | */ |
| | | public static final String COMMON_PATTERN_DAY_OF_MONTH = "dd"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - å°æ¶ |
| | | */ |
| | | public static final String COMMON_PATTERN_HOUR = "yyyyMMddHH"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - å°æ¶ |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_HOUR = "yyyy-MM-dd HH"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - å°æ¶ |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_HOUR_WORD = "yyyy-MM-dd HHæ¶"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - å°æ¶ |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_HOUR_TEXT = "yyyyå¹´MMæddæ¥ HHæ¶"; |
| | | |
| | | /** |
| | | * è·åå½åæ¶é´,æ¶é´æ ¼å¼ï¼yyyy-MM-dd HH:mm:ss |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getNowDateTime() { |
| | | return getNowDateTime(COMMON_PATTERN); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæ¶é´ |
| | | * |
| | | * @param pattern æ¶é´æ ¼å¼ |
| | | * @return |
| | | */ |
| | | public static String getNowDateTime(String pattern) { |
| | | //è®¾ç½®æ¥ææ ¼å¼ |
| | | SimpleDateFormat df = new SimpleDateFormat(pattern); |
| | | String dateTime = df.format(new Date()); |
| | | return dateTime; |
| | | } |
| | | |
| | | /** |
| | | * è·åä»å¹´çå¹´ä»½å¼ |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getNowYear() { |
| | | return getNowDateTime(COMMON_PATTERN_YEAR); |
| | | } |
| | | |
| | | /** |
| | | * è·åä»å¹´çæä»½å¼ |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getNowMonth() { |
| | | return getNowDateTime(COMMON_PATTERN_MONTH); |
| | | } |
| | | |
| | | /** |
| | | * åç¬¦ä¸²è½¬ææ¶é´ç±»å,é»è®¤æ ¼å¼ï¼yyyy-MM-dd HH:mm:ss |
| | | * |
| | | * @param dateTimeStr |
| | | * @return |
| | | */ |
| | | public static Date toDateTime(String dateTimeStr) { |
| | | DateTime dt = null; |
| | | try { |
| | | dt = DateTime.of(dateTimeStr, COMMON_PATTERN); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * åç¬¦ä¸²è½¬ææ¶é´ç±»å |
| | | * |
| | | * @param dateTimeStr |
| | | * @return |
| | | */ |
| | | public static Date toDateTime(String dateTimeStr, String pattern) { |
| | | DateTime dt = null; |
| | | try { |
| | | dt = DateTime.of(dateTimeStr, pattern); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * å符串转æç¹å®æ ¼å¼çæ¶é´å符串类å |
| | | * |
| | | * @param dateTimeStr æ¶é´å符串 |
| | | * @param sourcePattern å符串æ¶é´æ ¼å¼ |
| | | * @param toPattern è¦è½¬æä»ä¹æ ¼å¼çæ¶é´ |
| | | * @return |
| | | */ |
| | | public static String toDateTimeStr(String dateTimeStr, String sourcePattern, String toPattern) { |
| | | String str = CommonConst.EMPTY; |
| | | try { |
| | | DateTime dt = DateTime.of(dateTimeStr, sourcePattern); |
| | | str = getDateTime(dt, toPattern); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´è½¬ææå®çæ ¼å¼ |
| | | * |
| | | * @param pattern æ¶é´æ ¼å¼ |
| | | * @return |
| | | */ |
| | | public static String getDateTime(Date dt, String pattern) { |
| | | //è®¾ç½®æ¥ææ ¼å¼ |
| | | SimpleDateFormat df = new SimpleDateFormat(pattern); |
| | | return df.format(dt); |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´è½¬æyyyy-MM-dd HH:mm:ssæ ¼å¼ |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getDateTime(Date dt) { |
| | | if (ObjectUtil.isEmpty(dt)) { |
| | | return CommonConst.EMPTY; |
| | | } |
| | | return getDateTime(dt, COMMON_PATTERN); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæ¶é´æå±æä»½çæåä¸å¤© |
| | | * |
| | | * @return |
| | | */ |
| | | public static int getDateTimeLastDay(Date dt) { |
| | | String month = getMonth(dt); |
| | | String firstDate = month + "01"; |
| | | Date nextMonthFirstDate = addMonths(toDateTime(firstDate, COMMON_PATTERN_DAY), CommonConst.DIGIT_1); |
| | | Date currentMonthLastDate = addDays(nextMonthFirstDate, CommonConst.DIGIT_MINUS_1); |
| | | int day = IntegerUtil.toInt(getDateTime(currentMonthLastDate, COMMON_PATTERN_DAY_OF_MONTH)); |
| | | return day; |
| | | } |
| | | |
| | | /** |
| | | * è·åå¹´ä»½å¼ |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getYear(Date dt) { |
| | | return getDateTime(dt, COMMON_PATTERN_YEAR); |
| | | } |
| | | |
| | | /** |
| | | * è·åæä»½å¼ 202202 |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getMonth(Date dt) { |
| | | return getDateTime(dt, COMMON_PATTERN_MONTH); |
| | | } |
| | | |
| | | /** |
| | | * è·å天,æ ¼å¼ï¼yyyyMMdd |
| | | * |
| | | * @return |
| | | */ |
| | | public static String toDay(Date dt) { |
| | | return getDateTime(dt, COMMON_PATTERN_DAY); |
| | | } |
| | | |
| | | /** |
| | | * è·åå°æ¶:yyyyMMddHH |
| | | * |
| | | * @return |
| | | */ |
| | | public static String toHour(Date dt) { |
| | | return getDateTime(dt, COMMON_PATTERN_HOUR); |
| | | } |
| | | |
| | | /** |
| | | * 转æå符串类åå¼ |
| | | * |
| | | * @return |
| | | */ |
| | | public static String toString(Date dt) { |
| | | return getDateTime(dt, COMMON_PATTERN); |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´å¢å 对åºçå¹´æ° |
| | | * |
| | | * @param dateTime |
| | | * @param years |
| | | * @return |
| | | */ |
| | | public static Date addYears(Date dateTime, int years) { |
| | | return calcDate(dateTime, years, Calendar.YEAR); |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´å¢å 对åºçææ° |
| | | * |
| | | * @param dateTime |
| | | * @param months |
| | | * @return |
| | | */ |
| | | public static Date addMonths(Date dateTime, int months) { |
| | | return calcDate(dateTime, months, Calendar.MONTH); |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´å¢å 对åºçå¤©æ° |
| | | * |
| | | * @param dateTime |
| | | * @param days |
| | | * @return |
| | | */ |
| | | public static Date addDays(Date dateTime, int days) { |
| | | return calcDate(dateTime, days, Calendar.DATE); |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´å¢å 对åºçå°æ¶æ° |
| | | * |
| | | * @param dateTime |
| | | * @param hours |
| | | * @return |
| | | */ |
| | | public static Date addHours(Date dateTime, int hours) { |
| | | return calcDate(dateTime, hours, Calendar.HOUR); |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´å¢å 对åºçåéæ° |
| | | * |
| | | * @param dateTime |
| | | * @param minutes |
| | | * @return |
| | | */ |
| | | public static Date addMinutes(Date dateTime, int minutes) { |
| | | return calcDate(dateTime, minutes, Calendar.MINUTE); |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´å¢å 对åºçå°æ¶æ° |
| | | * |
| | | * @param dateTime |
| | | * @param seconds |
| | | * @return |
| | | */ |
| | | public static Date addSeconds(Date dateTime, int seconds) { |
| | | return calcDate(dateTime, seconds, Calendar.SECOND); |
| | | } |
| | | |
| | | /** |
| | | * è®¡ç®æ¥æéç¨æ¹æ³ |
| | | * |
| | | * @param dateTime |
| | | * @param addValue |
| | | * @param calendarType 计ç®ç±»åï¼Calendar.YEARï¼Calendar.MONTH,Calendar.DAY |
| | | * @return |
| | | */ |
| | | private static Date calcDate(Date dateTime, int addValue, int calendarType) { |
| | | Date dt = null; |
| | | try { |
| | | Calendar calendar = new GregorianCalendar(); |
| | | calendar.setTime(dateTime); |
| | | //ææ¥æå¾åå¢å ä¸å¹´ï¼æ´æ°å¾åæ¨ï¼è´æ°å¾åç§» |
| | | calendar.add(calendarType, addValue); |
| | | // è·åç¸å æè
ç¸åä¹åçæ¶é´å¼ |
| | | Date tempDt = calendar.getTime(); |
| | | // ææ¶é´è½¬ææéè¦çæ ¼å¼ |
| | | String temp = getDateTime(tempDt, COMMON_PATTERN); |
| | | dt = toDateTime(temp); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * è·å该æ¶é´å±äºå½å¤©ç第å ä¸ªå°æ¶ |
| | | * |
| | | * @param dateTime |
| | | * @return |
| | | */ |
| | | public static int getHourOfDay(Date dateTime) { |
| | | return getDateValue(dateTime, Calendar.HOUR_OF_DAY); |
| | | } |
| | | |
| | | /** |
| | | * è·å该æ¶é´å±äºå½æç第å 天 |
| | | * |
| | | * @param dateTime |
| | | * @return |
| | | */ |
| | | public static int getDayOfMonth(Date dateTime) { |
| | | return getDateValue(dateTime, Calendar.DAY_OF_MONTH); |
| | | } |
| | | |
| | | /** |
| | | * è·å该æ¶é´å±äºå½å¨ç第å 天 |
| | | * ä¸å¨ç第ä¸å¤©æ¯å¨æ¥ |
| | | * |
| | | * @param dateTime |
| | | * @return |
| | | */ |
| | | public static int getDayOfWeek(Date dateTime) { |
| | | return getDateValue(dateTime, Calendar.DAY_OF_WEEK); |
| | | } |
| | | |
| | | /** |
| | | * è·å该æ¶é´å±äºå¹´ç第å 个æ |
| | | * æä»½å¼+1æ¯çå®çå½åæ |
| | | * |
| | | * @param dateTime |
| | | * @return å·²ç»å¨ç³»ç»ä¸è·åå¼çåºç¡ä¸å 1äºï¼ç°å¨æ¯çå®çå½åæä»½å¼ |
| | | */ |
| | | public static int getMonthOfYear(Date dateTime) { |
| | | return getDateValue(dateTime, Calendar.MONTH) + 1; |
| | | } |
| | | |
| | | /** |
| | | * è·åå½å¤©ç第å ä¸ªå°æ¶/彿ç第å 天/å½å¹´ç第å 个æ |
| | | * |
| | | * @param dateTime 妿æ¶é´å¼ä¸ºç©ºï¼é»è®¤å½åæ¶é´ |
| | | * @param calendarType |
| | | * @return |
| | | */ |
| | | private static int getDateValue(Date dateTime, int calendarType) { |
| | | int value = 0; |
| | | try { |
| | | if (ObjectUtil.isEmpty(dateTime)) { |
| | | dateTime = new Date(); |
| | | } |
| | | Calendar calendar = new GregorianCalendar(); |
| | | calendar.setTime(dateTime); |
| | | value = calendar.get(calendarType); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return value; |
| | | } |
| | | |
| | | /** |
| | | * 对æ¯time1 å time2 çå¤§å° |
| | | * |
| | | * @param time1 |
| | | * @param time2 |
| | | * @return -1:time1å°äºtime2;0:time1çäºtime2;1:time1大äºtime2; |
| | | */ |
| | | public static int compareDateDiff(Date time1, Date time2) { |
| | | long diff = time1.getTime() - time2.getTime(); |
| | | int res = 0; |
| | | if (diff > 0) { |
| | | res = 1; |
| | | } else if (diff < 0) { |
| | | res = -1; |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¥è¯¢data_itemæéè¦çtimecodeå¼ |
| | | * |
| | | * @param timeType æ¥æç±»å |
| | | * @param date æ¶é´ |
| | | * @return |
| | | */ |
| | | public static String getTimeCode(String timeType, Date date) { |
| | | String timeCode = CommonConst.EMPTY; |
| | | if (ObjectUtil.isEmpty(date)) { |
| | | date = new Date(); |
| | | } |
| | | timeType = StringUtil.ifEmptyOrNullReturnValue(timeType).toUpperCase(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | timeCode = CommonConst.WORD_H + getDateTime(date, COMMON_PATTERN_HOUR); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | timeCode = CommonConst.WORD_D + getDateTime(date, COMMON_PATTERN_DAY); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | timeCode = CommonConst.WORD_M + getDateTime(date, COMMON_PATTERN_MONTH); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | timeCode = CommonConst.WORD_Y + getDateTime(date, COMMON_PATTERN_YEAR); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return timeCode; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¥è¯¢æ¥æå¹´æ¥è¡¨æéè¦çtimecodeå¼ |
| | | * |
| | | * @param timeType æ¥æç±»å |
| | | * @param date æ¶é´ |
| | | * @return |
| | | */ |
| | | public static String getReportTimeCode(String timeType, Date date) { |
| | | String timeCode = CommonConst.EMPTY; |
| | | if (ObjectUtil.isEmpty(date)) { |
| | | date = new Date(); |
| | | } |
| | | timeType = StringUtil.ifEmptyOrNullReturnValue(timeType).toUpperCase(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | timeCode = getDateTime(date, COMMON_PATTERN_TO_HOUR); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | timeCode = getDateTime(date, COMMON_PATTERN_TO_DAY); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | timeCode = getDateTime(date, COMMON_PATTERN_TO_MONTH); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | timeCode = getDateTime(date, COMMON_PATTERN_YEAR); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return timeCode; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¶é´å¯¹åºçç¯æ¯æ¶é´ |
| | | * |
| | | * @param timeType HOUR/DAY/MONTH/YEAR |
| | | * @param date æ¶é´å¼ |
| | | * @return |
| | | */ |
| | | public static Date getLoopTime(String timeType, Date date) { |
| | | Date dt = null; |
| | | if (ObjectUtil.isEmpty(date)) { |
| | | date = new Date(); |
| | | } |
| | | timeType = StringUtil.ifEmptyOrNullReturnValue(timeType).toUpperCase(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | dt = addHours(date, CommonConst.DIGIT_MINUS_1); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | dt = addDays(date, CommonConst.DIGIT_MINUS_1); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | dt = addMonths(date, CommonConst.DIGIT_MINUS_1); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | dt = addYears(date, CommonConst.DIGIT_MINUS_1); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ´ç¹æ¶é´ |
| | | * |
| | | * @param timeType HOUR/DAY/MONTH/YEAR |
| | | * @param date æ¶é´å¼ |
| | | * @return |
| | | */ |
| | | public static Date getHourTime(String timeType, Date date) { |
| | | Date dt = null; |
| | | if (ObjectUtil.isEmpty(date)) { |
| | | date = new Date(); |
| | | } |
| | | String tempStr = null; |
| | | timeType = StringUtil.ifEmptyOrNullReturnValue(timeType).toUpperCase(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | tempStr = getDateTime(date, COMMON_PATTERN_TO_HOUR); |
| | | dt = toDateTime(tempStr, COMMON_PATTERN_TO_HOUR); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | tempStr = getDateTime(date, COMMON_PATTERN_TO_DAY); |
| | | dt = toDateTime(tempStr, COMMON_PATTERN_TO_DAY); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | tempStr = getDateTime(date, COMMON_PATTERN_TO_MONTH); |
| | | dt = toDateTime(tempStr, COMMON_PATTERN_TO_MONTH); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | tempStr = getDateTime(date, COMMON_PATTERN_YEAR); |
| | | dt = toDateTime(tempStr, COMMON_PATTERN_YEAR); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * 计ç®ä¸¤ä¸ªæ¶é´é´é天æ°ï¼æ¥ææ ¼å¼æ¯è¾ï¼ |
| | | * |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public static int daysBetween(Date beginTime, Date endTime) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(beginTime); |
| | | long beginStamp = calendar.getTimeInMillis(); |
| | | calendar.setTime(endTime); |
| | | long endStamp = calendar.getTimeInMillis(); |
| | | long betweenDays = (endStamp - beginStamp) / (1000 * 3600 * 24); |
| | | return Integer.parseInt(String.valueOf(betweenDays)); |
| | | } |
| | | |
| | | /** |
| | | * 计ç®ä¸¤ä¸ªæ¶é´é´é天æ°ï¼åç¬¦ä¸²æ ¼å¼æ¯è¾ï¼ |
| | | * |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public static int daysBetween(String beginTime, String endTime) { |
| | | try { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date begin = format.parse(beginTime); |
| | | Date end = format.parse(endTime); |
| | | return daysBetween(begin, end); |
| | | } catch (ParseException exception) { |
| | | log.error("计ç®ä¸¤ä¸ªæ¶é´é´é天æ°" + exception.getMessage()); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æ¶é´ç±»åæå符串转æå¯¹åºçæ¶é´ |
| | | * |
| | | * @param timeType æ¶é´ç±»å |
| | | * @param time æ¶é´å符串 |
| | | * @return |
| | | */ |
| | | public static Date getTime(String timeType, String time) { |
| | | Date dt = null; |
| | | timeType = StringUtil.ifEmptyOrNullReturnValue(timeType).toUpperCase(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | dt = toDateTime(time, COMMON_PATTERN_TO_HOUR); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | dt = toDateTime(time, COMMON_PATTERN_TO_DAY); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | dt = toDateTime(time, COMMON_PATTERN_TO_MONTH); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | dt = toDateTime(time, COMMON_PATTERN_YEAR); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æ¶é´ç±»åæè¿ç»çæ¥æå符串转æå¯¹åºçæ¶é´ ï¼202303ã20230303ã2023030301ã202303030101ï¼ |
| | | * |
| | | * @param timeType æ¶é´ç±»å |
| | | * @param time æ¶é´å符串 |
| | | * @return |
| | | */ |
| | | public static Date getTimeByContinuousTimeCode(String timeType, String time) { |
| | | Date dt = null; |
| | | timeType = StringUtil.ifEmptyOrNullReturnValue(timeType).toUpperCase(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | dt = toDateTime(time, COMMON_PATTERN_HOUR); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | dt = toDateTime(time, COMMON_PATTERN_DAY); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | dt = toDateTime(time, COMMON_PATTERN_MONTH); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | dt = toDateTime(time, COMMON_PATTERN_YEAR); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æ¶é´ç±»åè¿å天ãæãå¹´æåçæ¶é´ |
| | | * |
| | | * @param timeType æ¶é´ç±»å |
| | | * @param time æ¶é´ |
| | | * @return |
| | | */ |
| | | public static Date getEndTimeByType(String timeType, Date time) { |
| | | Date dt = null; |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | dt = DateUtil.endOfDay(time); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | dt = DateUtil.endOfMonth(time); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | dt = DateUtil.endOfYear(time); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å¨æç±»å对çäº§å¨æè¿è¡å åè®¡ç® |
| | | * å¡«æ¥å¨æç±»åï¼HOURå°æ¶ãDAY天ãMONTHæãYEARå¹´ï¼ |
| | | * |
| | | * @param date çäº§å¨æ |
| | | * @param cycleType çäº§å¨æç±»å |
| | | * @param cycleType çäº§å¨æç±»å |
| | | * @param val 计ç®å¼ |
| | | * @return |
| | | */ |
| | | public static Date productionCycleCal(Date date, String cycleType,int val) { |
| | | Date momDate = date; |
| | | switch (cycleType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | momDate = DateUtils.addHours(date, val); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | momDate = DateUtils.addDays(date, val); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | momDate = DateUtils.addMonths(date, val); |
| | | break; |
| | | } |
| | | return momDate; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å¨æç±»å对çäº§å¨æè¿è¡å åè®¡ç® å¹¶ä¸è¿ä½ ä¾å¦ï¼ HOUR +1è¿ä½å°±æ¯ å ä¸å¤© |
| | | * å¡«æ¥å¨æç±»åï¼HOURå°æ¶ãDAY天ãMONTHæãYEARå¹´ï¼ |
| | | * |
| | | * @param date çäº§å¨æ |
| | | * @param cycleType çäº§å¨æç±»å |
| | | * @param val 计ç®å¼ |
| | | * @return |
| | | */ |
| | | public static Date productionCycleCalCarry(Date date, String cycleType,int val) { |
| | | Date momDate = date; |
| | | switch (cycleType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | momDate = DateUtils.addDays(date, val); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | momDate = DateUtils.addMonths(date, val); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | momDate = DateUtils.addYears(date, val); |
| | | break; |
| | | } |
| | | return momDate; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.common.utils; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | |
| | | /** |
| | | * @Description: æ°åå·¥å
·ç±» |
| | | * @author: yxw |
| | | * @date: 2022å¹´02æ07æ¥ 15:03 |
| | | */ |
| | | public class DoubleUtil { |
| | | public static double toDouble(String str) { |
| | | double d = 0; |
| | | try { |
| | | d = Double.parseDouble(str); |
| | | } catch (Exception e) { |
| | | d = 0; |
| | | } |
| | | return d; |
| | | } |
| | | |
| | | /** |
| | | * long 转æ doubleç±»å |
| | | * |
| | | * @param l |
| | | * @return |
| | | */ |
| | | public static double toDouble(long l) { |
| | | return toDouble(l + ""); |
| | | } |
| | | |
| | | /** |
| | | * long 转æ doubleç±»å |
| | | * |
| | | * @param l |
| | | * @return |
| | | */ |
| | | public static double toDouble(Object l) { |
| | | return toDouble(l + ""); |
| | | } |
| | | |
| | | /** |
| | | * int 转æ doubleç±»å |
| | | * |
| | | * @param i |
| | | * @return |
| | | */ |
| | | public static double toDouble(int i) { |
| | | return toDouble(i + ""); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ ¼å¼åå°æ°ä¸ºæå®ä½æ°çå°æ°å符串 |
| | | * |
| | | * @param value |
| | | * @return |
| | | */ |
| | | public static String formatDoubleToStr(Double value, int format) { |
| | | if (ObjectUtil.isEmpty(value)) { |
| | | value = 0.00; |
| | | } |
| | | String str = String.format("%." + format + "f", value).toString(); |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * æ ¼å¼åå°æ°ä¸ºæå®ä½æ°çå°æ°å符串,é»è®¤æ ¼å¼å为2ä½å°æ° |
| | | * |
| | | * @param value |
| | | * @return |
| | | */ |
| | | public static String formatDoubleToStr(Double value) { |
| | | return formatDoubleToStr(value, 2); |
| | | } |
| | | |
| | | /** |
| | | * æ ¼å¼åå°æ°ä¸ºæå®ä½æ°çå°æ° |
| | | * |
| | | * @param value |
| | | * @param format |
| | | * @return |
| | | */ |
| | | public static double formatDouble(Double value, int format) { |
| | | if (ObjectUtil.isEmpty(value)) { |
| | | return 0D; |
| | | } |
| | | String str = formatDoubleToStr(value, format); |
| | | return toDouble(str); |
| | | } |
| | | |
| | | /** |
| | | * æ ¼å¼åå°æ°ä¸º2使°çå°æ° |
| | | * |
| | | * @param value |
| | | * @return |
| | | */ |
| | | public static double formatDouble(Double value) { |
| | | if (ObjectUtil.isEmpty(value)) { |
| | | return 0D; |
| | | } |
| | | return formatDouble(value, 2); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.common.utils; |
| | | |
| | | /** |
| | | * @Description: æ´æ°ç¸å
³å·¥å
·ç±» |
| | | * @author: yxw |
| | | * @date: 2022å¹´03æ10æ¥ 17:31 |
| | | */ |
| | | public class IntegerUtil { |
| | | /** |
| | | * å符串转æintç±»å |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static int toInt(String str) { |
| | | int d = 0; |
| | | try { |
| | | d = Integer.parseInt(str); |
| | | } catch (Exception e) { |
| | | d = 0; |
| | | } |
| | | return d; |
| | | } |
| | | |
| | | /** |
| | | * long转æintç±»å |
| | | * |
| | | * @param l |
| | | * @return |
| | | */ |
| | | public static int toInt(long l) { |
| | | int d = 0; |
| | | try { |
| | | d = (int) l; |
| | | } catch (Exception e) { |
| | | d = 0; |
| | | } |
| | | return d; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.common.utils; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.zhitan.common.constant.CommonConst; |
| | | |
| | | /** |
| | | * @Description: å符串工å
·ç±» |
| | | * @author: yxw |
| | | * @date: 2022å¹´02æ02æ¥ 12:27 |
| | | */ |
| | | public class StringUtil { |
| | | /** |
| | | * 夿å符串æ¯å¦ä¸ºç©ºå符串æè
Null |
| | | * |
| | | * @param str éè¦å¤æçå符串 |
| | | * @return |
| | | */ |
| | | public static boolean isEmptyOrNull(String str) { |
| | | if (str == null || CommonConst.EMPTY.equals(str)) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * åç¬¦ä¸²å¦æä¸ºç©ºå符串æè
Nullè¿å空å符串ï¼å¦åè¿åå符串æ¬èº«çå¼ |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String ifEmptyOrNullReturnValue(String str) { |
| | | if (isEmptyOrNull(str)) { |
| | | return CommonConst.EMPTY; |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 对象转æjsonå符串 |
| | | * |
| | | * @param obj |
| | | * @return |
| | | */ |
| | | public static String toJson(Object obj) { |
| | | return JSONObject.toJSONString(obj); |
| | | } |
| | | |
| | | /** |
| | | * 对象转æJSONObject |
| | | * |
| | | * @param obj |
| | | * @return |
| | | */ |
| | | public static JSONObject toJsonObject(Object obj) { |
| | | return JSONObject.parseObject(toJson(obj)); |
| | | } |
| | | |
| | | /** |
| | | * é¦åæ¯å¤§å |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String captureWord(String str) { |
| | | str = str.toLowerCase(); |
| | | char[] cs = str.toCharArray(); |
| | | cs[0] -= 32; |
| | | return String.valueOf(cs); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.domain; |
| | | |
| | | |
| | | import com.zhitan.common.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | public class DailyReport implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | private String indexId; |
| | | @Excel(name = "ææ åç§°") |
| | | private String indexName; |
| | | private String value; |
| | | private Date dataTime; |
| | | private String timeType; |
| | | @Excel(name = "0æ¶") |
| | | private Double value0; |
| | | @Excel(name = "1æ¶") |
| | | private Double value1; |
| | | @Excel(name = "2æ¶") |
| | | private Double value2; |
| | | @Excel(name = "3æ¶") |
| | | private Double value3; |
| | | @Excel(name = "4æ¶") |
| | | private Double value4; |
| | | @Excel(name = "5æ¶") |
| | | private Double value5; |
| | | @Excel(name = "6æ¶") |
| | | private Double value6; |
| | | @Excel(name = "7æ¶") |
| | | private Double value7; |
| | | @Excel(name = "8æ¶") |
| | | private Double value8; |
| | | @Excel(name = "9æ¶") |
| | | private Double value9; |
| | | @Excel(name = "10æ¶") |
| | | private Double value10; |
| | | @Excel(name = "11æ¶") |
| | | private Double value11; |
| | | @Excel(name = "12æ¶") |
| | | private Double value12; |
| | | @Excel(name = "13æ¶") |
| | | private Double value13; |
| | | @Excel(name = "14æ¶") |
| | | private Double value14; |
| | | @Excel(name = "15æ¶") |
| | | private Double value15; |
| | | @Excel(name = "16æ¶") |
| | | private Double value16; |
| | | @Excel(name = "17æ¶") |
| | | private Double value17; |
| | | @Excel(name = "18æ¶") |
| | | private Double value18; |
| | | @Excel(name = "19æ¶") |
| | | private Double value19; |
| | | @Excel(name = "20æ¶") |
| | | private Double value20; |
| | | @Excel(name = "21æ¶") |
| | | private Double value21; |
| | | @Excel(name = "22æ¶") |
| | | private Double value22; |
| | | @Excel(name = "23æ¶") |
| | | private Double value23; |
| | | private List<Map> tablehead =new ArrayList<>(); |
| | | private List<DailyReport> tabledata =new ArrayList<>(); |
| | | public String getIndexId() { |
| | | return indexId; |
| | | } |
| | | |
| | | public void setIndexId(String indexId) { |
| | | this.indexId = indexId; |
| | | } |
| | | |
| | | public String getIndexName() { |
| | | return indexName; |
| | | } |
| | | |
| | | public void setIndexName(String indexName) { |
| | | this.indexName = indexName; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getTimeType() { |
| | | return timeType; |
| | | } |
| | | |
| | | public void setTimeType(String timeType) { |
| | | this.timeType = timeType; |
| | | } |
| | | |
| | | public Date getDataTime() { |
| | | return dataTime; |
| | | } |
| | | |
| | | public void setDataTime(Date dataTime) { |
| | | this.dataTime = dataTime; |
| | | } |
| | | |
| | | public Double getValue1() { |
| | | return value1; |
| | | } |
| | | |
| | | public void setValue1(Double value1) { |
| | | this.value1 = value1; |
| | | } |
| | | |
| | | public Double getValue2() { |
| | | return value2; |
| | | } |
| | | |
| | | public void setValue2(Double value2) { |
| | | this.value2 = value2; |
| | | } |
| | | |
| | | public Double getValue3() { |
| | | return value3; |
| | | } |
| | | |
| | | public void setValue3(Double value3) { |
| | | this.value3 = value3; |
| | | } |
| | | |
| | | public Double getValue4() { |
| | | return value4; |
| | | } |
| | | |
| | | public void setValue4(Double value4) { |
| | | this.value4 = value4; |
| | | } |
| | | |
| | | public Double getValue5() { |
| | | return value5; |
| | | } |
| | | |
| | | public void setValue5(Double value5) { |
| | | this.value5 = value5; |
| | | } |
| | | |
| | | public Double getValue6() { |
| | | return value6; |
| | | } |
| | | |
| | | public void setValue6(Double value6) { |
| | | this.value6 = value6; |
| | | } |
| | | |
| | | public Double getValue7() { |
| | | return value7; |
| | | } |
| | | |
| | | public void setValue7(Double value7) { |
| | | this.value7 = value7; |
| | | } |
| | | |
| | | public Double getValue8() { |
| | | return value8; |
| | | } |
| | | |
| | | public void setValue8(Double value8) { |
| | | this.value8 = value8; |
| | | } |
| | | |
| | | public Double getValue9() { |
| | | return value9; |
| | | } |
| | | |
| | | public void setValue9(Double value9) { |
| | | this.value9 = value9; |
| | | } |
| | | |
| | | public Double getValue10() { |
| | | return value10; |
| | | } |
| | | |
| | | public void setValue10(Double value10) { |
| | | this.value10 = value10; |
| | | } |
| | | |
| | | public Double getValue11() { |
| | | return value11; |
| | | } |
| | | |
| | | public void setValue11(Double value11) { |
| | | this.value11 = value11; |
| | | } |
| | | |
| | | public Double getValue12() { |
| | | return value12; |
| | | } |
| | | |
| | | public void setValue12(Double value12) { |
| | | this.value12 = value12; |
| | | } |
| | | |
| | | public Double getValue13() { |
| | | return value13; |
| | | } |
| | | |
| | | public void setValue13(Double value13) { |
| | | this.value13 = value13; |
| | | } |
| | | |
| | | public Double getValue14() { |
| | | return value14; |
| | | } |
| | | |
| | | public void setValue14(Double value14) { |
| | | this.value14 = value14; |
| | | } |
| | | |
| | | public Double getValue15() { |
| | | return value15; |
| | | } |
| | | |
| | | public void setValue15(Double value15) { |
| | | this.value15 = value15; |
| | | } |
| | | |
| | | public Double getValue16() { |
| | | return value16; |
| | | } |
| | | |
| | | public void setValue16(Double value16) { |
| | | this.value16 = value16; |
| | | } |
| | | |
| | | public Double getValue17() { |
| | | return value17; |
| | | } |
| | | |
| | | public void setValue17(Double value17) { |
| | | this.value17 = value17; |
| | | } |
| | | |
| | | public Double getValue18() { |
| | | return value18; |
| | | } |
| | | |
| | | public void setValue18(Double value18) { |
| | | this.value18 = value18; |
| | | } |
| | | |
| | | public Double getValue19() { |
| | | return value19; |
| | | } |
| | | |
| | | public void setValue19(Double value19) { |
| | | this.value19 = value19; |
| | | } |
| | | |
| | | public Double getValue20() { |
| | | return value20; |
| | | } |
| | | |
| | | public void setValue20(Double value20) { |
| | | this.value20 = value20; |
| | | } |
| | | |
| | | public Double getValue21() { |
| | | return value21; |
| | | } |
| | | |
| | | public void setValue21(Double value21) { |
| | | this.value21 = value21; |
| | | } |
| | | |
| | | public Double getValue22() { |
| | | return value22; |
| | | } |
| | | |
| | | public void setValue22(Double value22) { |
| | | this.value22 = value22; |
| | | } |
| | | |
| | | public Double getValue23() { |
| | | return value23; |
| | | } |
| | | |
| | | public void setValue23(Double value23) { |
| | | this.value23 = value23; |
| | | } |
| | | |
| | | public Double getValue0() { |
| | | return value0; |
| | | } |
| | | |
| | | public void setValue0(Double value0) { |
| | | this.value0 = value0; |
| | | } |
| | | |
| | | public List<Map> getTablehead() { |
| | | return tablehead; |
| | | } |
| | | |
| | | public void setTablehead(List<Map> tablehead) { |
| | | this.tablehead = tablehead; |
| | | } |
| | | public List<DailyReport> getTabledata() { |
| | | return tabledata; |
| | | } |
| | | |
| | | public void setTabledata(List<DailyReport> tabledata) { |
| | | this.tabledata = tabledata; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.domain; |
| | | |
| | | import com.zhitan.common.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author sys |
| | | * @date 2020-12-31 |
| | | */ |
| | | public class MonthlyComprehensive implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | private String indexId; |
| | | @Excel(name = "ææ åç§°") |
| | | private String indexName; |
| | | private String value; |
| | | private Date dataTime; |
| | | private String timeType; |
| | | private String unitId; |
| | | @Excel(name = "1æ¥") |
| | | private Double value1; |
| | | @Excel(name = "2æ¥") |
| | | private Double value2; |
| | | @Excel(name = "3æ¥") |
| | | private Double value3; |
| | | @Excel(name = "4æ¥") |
| | | private Double value4; |
| | | @Excel(name = "5æ¥") |
| | | private Double value5; |
| | | @Excel(name = "6æ¥") |
| | | private Double value6; |
| | | @Excel(name = "7æ¥") |
| | | private Double value7; |
| | | @Excel(name = "8æ¥") |
| | | private Double value8; |
| | | @Excel(name = "9æ¥") |
| | | private Double value9; |
| | | @Excel(name = "10æ¥") |
| | | private Double value10; |
| | | @Excel(name = "11æ¥") |
| | | private Double value11; |
| | | @Excel(name = "12æ¥") |
| | | private Double value12; |
| | | @Excel(name = "13æ¥") |
| | | private Double value13; |
| | | @Excel(name = "14æ¥") |
| | | private Double value14; |
| | | @Excel(name = "15æ¥") |
| | | private Double value15; |
| | | @Excel(name = "16æ¥") |
| | | private Double value16; |
| | | @Excel(name = "17æ¥") |
| | | private Double value17; |
| | | @Excel(name = "18æ¥") |
| | | private Double value18; |
| | | @Excel(name = "19æ¥") |
| | | private Double value19; |
| | | @Excel(name = "20æ¥") |
| | | private Double value20; |
| | | @Excel(name = "21æ¥") |
| | | private Double value21; |
| | | @Excel(name = "22æ¥") |
| | | private Double value22; |
| | | @Excel(name = "23æ¥") |
| | | private Double value23; |
| | | @Excel(name = "24æ¥") |
| | | private Double value24; |
| | | @Excel(name = "25æ¥") |
| | | private Double value25; |
| | | @Excel(name = "26æ¥") |
| | | private Double value26; |
| | | @Excel(name = "27æ¥") |
| | | private Double value27; |
| | | @Excel(name = "28æ¥") |
| | | private Double value28; |
| | | @Excel(name = "29æ¥") |
| | | private Double value29; |
| | | @Excel(name = "30æ¥") |
| | | private Double value30; |
| | | @Excel(name = "31æ¥") |
| | | private Double value31; |
| | | private String timeCode; |
| | | private Integer count; |
| | | private List<Map> tablehead =new ArrayList<>(); |
| | | private List<MonthlyComprehensive> tabledata =new ArrayList<>(); |
| | | public String getIndexId() { |
| | | return indexId; |
| | | } |
| | | |
| | | public void setIndexId(String indexId) { |
| | | this.indexId = indexId; |
| | | } |
| | | |
| | | public String getIndexName() { |
| | | return indexName; |
| | | } |
| | | |
| | | public void setIndexName(String indexName) { |
| | | this.indexName = indexName; |
| | | } |
| | | public String getUnitId() { |
| | | return unitId; |
| | | } |
| | | |
| | | public void setUnitId(String unitId) { |
| | | this.unitId = unitId; |
| | | } |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getTimeType() { |
| | | return timeType; |
| | | } |
| | | |
| | | public void setTimeType(String timeType) { |
| | | this.timeType = timeType; |
| | | } |
| | | |
| | | public Date getDataTime() { |
| | | return dataTime; |
| | | } |
| | | |
| | | public void setDataTime(Date dataTime) { |
| | | this.dataTime = dataTime; |
| | | } |
| | | |
| | | public Double getValue1() { |
| | | return value1; |
| | | } |
| | | |
| | | public void setValue1(Double value1) { |
| | | this.value1 = value1; |
| | | } |
| | | |
| | | public Double getValue2() { |
| | | return value2; |
| | | } |
| | | |
| | | public void setValue2(Double value2) { |
| | | this.value2 = value2; |
| | | } |
| | | |
| | | public Double getValue3() { |
| | | return value3; |
| | | } |
| | | |
| | | public void setValue3(Double value3) { |
| | | this.value3 = value3; |
| | | } |
| | | |
| | | public Double getValue4() { |
| | | return value4; |
| | | } |
| | | |
| | | public void setValue4(Double value4) { |
| | | this.value4 = value4; |
| | | } |
| | | |
| | | public Double getValue5() { |
| | | return value5; |
| | | } |
| | | |
| | | public void setValue5(Double value5) { |
| | | this.value5 = value5; |
| | | } |
| | | |
| | | public Double getValue6() { |
| | | return value6; |
| | | } |
| | | |
| | | public void setValue6(Double value6) { |
| | | this.value6 = value6; |
| | | } |
| | | |
| | | public Double getValue7() { |
| | | return value7; |
| | | } |
| | | |
| | | public void setValue7(Double value7) { |
| | | this.value7 = value7; |
| | | } |
| | | |
| | | public Double getValue8() { |
| | | return value8; |
| | | } |
| | | |
| | | public void setValue8(Double value8) { |
| | | this.value8 = value8; |
| | | } |
| | | |
| | | public Double getValue9() { |
| | | return value9; |
| | | } |
| | | |
| | | public void setValue9(Double value9) { |
| | | this.value9 = value9; |
| | | } |
| | | |
| | | public Double getValue10() { |
| | | return value10; |
| | | } |
| | | |
| | | public void setValue10(Double value10) { |
| | | this.value10 = value10; |
| | | } |
| | | |
| | | public Double getValue11() { |
| | | return value11; |
| | | } |
| | | |
| | | public void setValue11(Double value11) { |
| | | this.value11 = value11; |
| | | } |
| | | |
| | | public Double getValue12() { |
| | | return value12; |
| | | } |
| | | |
| | | public void setValue12(Double value12) { |
| | | this.value12 = value12; |
| | | } |
| | | |
| | | public Double getValue13() { |
| | | return value13; |
| | | } |
| | | |
| | | public void setValue13(Double value13) { |
| | | this.value13 = value13; |
| | | } |
| | | |
| | | public Double getValue14() { |
| | | return value14; |
| | | } |
| | | |
| | | public void setValue14(Double value14) { |
| | | this.value14 = value14; |
| | | } |
| | | |
| | | public Double getValue15() { |
| | | return value15; |
| | | } |
| | | |
| | | public void setValue15(Double value15) { |
| | | this.value15 = value15; |
| | | } |
| | | |
| | | public Double getValue16() { |
| | | return value16; |
| | | } |
| | | |
| | | public void setValue16(Double value16) { |
| | | this.value16 = value16; |
| | | } |
| | | |
| | | public Double getValue17() { |
| | | return value17; |
| | | } |
| | | |
| | | public void setValue17(Double value17) { |
| | | this.value17 = value17; |
| | | } |
| | | |
| | | public Double getValue18() { |
| | | return value18; |
| | | } |
| | | |
| | | public void setValue18(Double value18) { |
| | | this.value18 = value18; |
| | | } |
| | | |
| | | public Double getValue19() { |
| | | return value19; |
| | | } |
| | | |
| | | public void setValue19(Double value19) { |
| | | this.value19 = value19; |
| | | } |
| | | |
| | | public Double getValue20() { |
| | | return value20; |
| | | } |
| | | |
| | | public void setValue20(Double value20) { |
| | | this.value20 = value20; |
| | | } |
| | | |
| | | public Double getValue21() { |
| | | return value21; |
| | | } |
| | | |
| | | public void setValue21(Double value21) { |
| | | this.value21 = value21; |
| | | } |
| | | |
| | | public Double getValue22() { |
| | | return value22; |
| | | } |
| | | |
| | | public void setValue22(Double value22) { |
| | | this.value22 = value22; |
| | | } |
| | | |
| | | public Double getValue23() { |
| | | return value23; |
| | | } |
| | | |
| | | public void setValue23(Double value23) { |
| | | this.value23 = value23; |
| | | } |
| | | |
| | | public Double getValue24() { |
| | | return value24; |
| | | } |
| | | |
| | | public void setValue24(Double value24) { |
| | | this.value24 = value24; |
| | | } |
| | | |
| | | public Double getValue25() { |
| | | return value25; |
| | | } |
| | | |
| | | public void setValue25(Double value25) { |
| | | this.value25 = value25; |
| | | } |
| | | |
| | | public Double getValue26() { |
| | | return value26; |
| | | } |
| | | |
| | | public void setValue26(Double value26) { |
| | | this.value26 = value26; |
| | | } |
| | | |
| | | public Double getValue27() { |
| | | return value27; |
| | | } |
| | | |
| | | public void setValue27(Double value27) { |
| | | this.value27 = value27; |
| | | } |
| | | |
| | | public Double getValue28() { |
| | | return value28; |
| | | } |
| | | |
| | | public void setValue28(Double value28) { |
| | | this.value28 = value28; |
| | | } |
| | | |
| | | public Double getValue29() { |
| | | return value29; |
| | | } |
| | | |
| | | public void setValue29(Double value29) { |
| | | this.value29 = value29; |
| | | } |
| | | |
| | | public Double getValue30() { |
| | | return value30; |
| | | } |
| | | |
| | | public void setValue30(Double value30) { |
| | | this.value30 = value30; |
| | | } |
| | | |
| | | public Double getValue31() { |
| | | return value31; |
| | | } |
| | | |
| | | public void setValue31(Double value31) { |
| | | this.value31 = value31; |
| | | } |
| | | |
| | | public List<Map> getTablehead() { |
| | | return tablehead; |
| | | } |
| | | |
| | | public void setTablehead(List<Map> tablehead) { |
| | | this.tablehead = tablehead; |
| | | } |
| | | public List<MonthlyComprehensive> getTabledata() { |
| | | return tabledata; |
| | | } |
| | | |
| | | public void setTabledata(List<MonthlyComprehensive> tabledata) { |
| | | this.tabledata = tabledata; |
| | | } |
| | | |
| | | public String getTimeCode() { |
| | | return timeCode; |
| | | } |
| | | |
| | | public void setTimeCode(String timeCode) { |
| | | this.timeCode = timeCode; |
| | | } |
| | | |
| | | public Integer getCount() { |
| | | return count; |
| | | } |
| | | |
| | | public void setCount(Integer count) { |
| | | this.count = count; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.domain; |
| | | |
| | | import com.zhitan.common.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | public class YearComperhensive implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | private String indexId; |
| | | @Excel(name = "ææ åç§°") |
| | | private String indexName; |
| | | private String value; |
| | | private Date dataTime; |
| | | private String timeType; |
| | | private String unitId; |
| | | @Excel(name = "1æ") |
| | | private Double value1; |
| | | @Excel(name = "2æ") |
| | | private Double value2; |
| | | @Excel(name = "3æ") |
| | | private Double value3; |
| | | @Excel(name = "4æ") |
| | | private Double value4; |
| | | @Excel(name = "5æ") |
| | | private Double value5; |
| | | @Excel(name = "6æ") |
| | | private Double value6; |
| | | @Excel(name = "7æ") |
| | | private Double value7; |
| | | @Excel(name = "8æ") |
| | | private Double value8; |
| | | @Excel(name = "9æ") |
| | | private Double value9; |
| | | @Excel(name = "10æ") |
| | | private Double value10; |
| | | @Excel(name = "11æ") |
| | | private Double value11; |
| | | @Excel(name = "12æ") |
| | | private Double value12; |
| | | private String timeCode; |
| | | private List<Map> tablehead =new ArrayList<>(); |
| | | private List<DailyReport> tabledata =new ArrayList<>(); |
| | | public String getIndexId() { |
| | | return indexId; |
| | | } |
| | | |
| | | public void setIndexId(String indexId) { |
| | | this.indexId = indexId; |
| | | } |
| | | |
| | | public String getIndexName() { |
| | | return indexName; |
| | | } |
| | | |
| | | public void setIndexName(String indexName) { |
| | | this.indexName = indexName; |
| | | } |
| | | public String getUnitId() { |
| | | return unitId; |
| | | } |
| | | |
| | | public void setUnitId(String unitId) { |
| | | this.unitId = unitId; |
| | | } |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getTimeType() { |
| | | return timeType; |
| | | } |
| | | |
| | | public void setTimeType(String timeType) { |
| | | this.timeType = timeType; |
| | | } |
| | | |
| | | public Date getDataTime() { |
| | | return dataTime; |
| | | } |
| | | |
| | | public void setDataTime(Date dataTime) { |
| | | this.dataTime = dataTime; |
| | | } |
| | | |
| | | public Double getValue1() { |
| | | return value1; |
| | | } |
| | | |
| | | public void setValue1(Double value1) { |
| | | this.value1 = value1; |
| | | } |
| | | |
| | | public Double getValue2() { |
| | | return value2; |
| | | } |
| | | |
| | | public void setValue2(Double value2) { |
| | | this.value2 = value2; |
| | | } |
| | | |
| | | public Double getValue3() { |
| | | return value3; |
| | | } |
| | | |
| | | public void setValue3(Double value3) { |
| | | this.value3 = value3; |
| | | } |
| | | |
| | | public Double getValue4() { |
| | | return value4; |
| | | } |
| | | |
| | | public void setValue4(Double value4) { |
| | | this.value4 = value4; |
| | | } |
| | | |
| | | public Double getValue5() { |
| | | return value5; |
| | | } |
| | | |
| | | public void setValue5(Double value5) { |
| | | this.value5 = value5; |
| | | } |
| | | |
| | | public Double getValue6() { |
| | | return value6; |
| | | } |
| | | |
| | | public void setValue6(Double value6) { |
| | | this.value6 = value6; |
| | | } |
| | | |
| | | public Double getValue7() { |
| | | return value7; |
| | | } |
| | | |
| | | public void setValue7(Double value7) { |
| | | this.value7 = value7; |
| | | } |
| | | |
| | | public Double getValue8() { |
| | | return value8; |
| | | } |
| | | |
| | | public void setValue8(Double value8) { |
| | | this.value8 = value8; |
| | | } |
| | | |
| | | public Double getValue9() { |
| | | return value9; |
| | | } |
| | | |
| | | public void setValue9(Double value9) { |
| | | this.value9 = value9; |
| | | } |
| | | |
| | | public Double getValue10() { |
| | | return value10; |
| | | } |
| | | |
| | | public void setValue10(Double value10) { |
| | | this.value10 = value10; |
| | | } |
| | | |
| | | public Double getValue11() { |
| | | return value11; |
| | | } |
| | | |
| | | public void setValue11(Double value11) { |
| | | this.value11 = value11; |
| | | } |
| | | |
| | | public Double getValue12() { |
| | | return value12; |
| | | } |
| | | |
| | | public void setValue12(Double value12) { |
| | | this.value12 = value12; |
| | | } |
| | | public String getTimeCode() { |
| | | return timeCode; |
| | | } |
| | | |
| | | public void setTimeCode(String timeCode) { |
| | | this.timeCode = timeCode; |
| | | } |
| | | public List<Map> getTablehead() { |
| | | return tablehead; |
| | | } |
| | | |
| | | public void setTablehead(List<Map> tablehead) { |
| | | this.tablehead = tablehead; |
| | | } |
| | | public List<DailyReport> getTabledata() { |
| | | return tabledata; |
| | | } |
| | | |
| | | public void setTabledata(List<DailyReport> tabledata) { |
| | | this.tabledata = tabledata; |
| | | } |
| | | } |
| | |
| | | * @date 2020-03-25 |
| | | */ |
| | | public interface DailyComprehensiveMapper { |
| | | public List<DailyComprehensive> getDailyComprehensiveList(@Param("nodeId") String nodeId, |
| | | List<DailyComprehensive> getDailyComprehensiveList(@Param("nodeId") String nodeId, |
| | | @Param("dataList") List<DailyComprehensive> dataList, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.mapper; |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å
¨å综åè½èç»è®¡ æ |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | public interface MonthlyComprehensiveMapper { |
| | | /** |
| | | * è·åç»¼åææ åæï¼æï¼å表 |
| | | * |
| | | * @param nodeId |
| | | * @param dataList |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | public List<MonthlyComprehensive> getMonthlyComprehensiveList(@Param("nodeId") String nodeId, |
| | | @Param("dataList") List<MonthlyComprehensive> dataList, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") TimeType timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | |
| | | /** |
| | | * è·åç»¼åææ åæå¾è¡¨ï¼æï¼æ°æ® |
| | | * |
| | | * @param indexId |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<MonthlyComprehensive> getListChart(@Param("indexId") String indexId, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") TimeType timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.mapper; |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.comprehensivestatistics.domain.YearComperhensive; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å
¨å综åè½èç»è®¡ å¹´ |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | public interface YearComprehensiveMapper { |
| | | /** |
| | | * è·åå¹´æ°æ® |
| | | * |
| | | * @param nodeId |
| | | * @param dataList |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | public List<YearComperhensive> getYearComprehensiveList(@Param("nodeId") String nodeId, |
| | | @Param("dataList") List<YearComperhensive> dataList, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") TimeType timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | |
| | | /** |
| | | * è·åå¹´æ°æ®-chart |
| | | * |
| | | * @param indexId |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<YearComperhensive> getListChart(@Param("indexId") String indexId, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") TimeType timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.service; |
| | | |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å
¨å综åè½èç»è®¡ æ |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | public interface ImonthlyComprehensive { |
| | | /** |
| | | * å
¨å综åè½èç»è®¡ æ |
| | | * |
| | | * @param nodeId |
| | | * @param dataList |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<MonthlyComprehensive> getMonthlyComprehensiveList(String nodeId, List<MonthlyComprehensive> dataList, Date beginTime, Date endTime, TimeType timeType, String indexStorageId); |
| | | |
| | | /** |
| | | * å
¨å综åè½èç»è®¡ æ |
| | | * |
| | | * @param indexId |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<MonthlyComprehensive> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.service; |
| | | |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.comprehensivestatistics.domain.YearComperhensive; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å
¨å综åè½èç»è®¡ å¹´ |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | public interface IyearComprehensive { |
| | | /** |
| | | * è·åç»¼åææ åæï¼å¹´ï¼å表 |
| | | * |
| | | * @param nodeId |
| | | * @param dataList |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<YearComperhensive> getYearComprehensiveList(String nodeId, List<YearComperhensive> dataList, |
| | | Date beginTime, Date endTime, TimeType timeType, String indexStorageId); |
| | | |
| | | /** |
| | | * è·åç»¼åææ åæï¼å¹´ï¼å¾è¡¨æ°æ® |
| | | * |
| | | * @param indexId |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<YearComperhensive> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.service.impl; |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive; |
| | | import com.zhitan.comprehensivestatistics.mapper.MonthlyComprehensiveMapper; |
| | | import com.zhitan.comprehensivestatistics.service.ImonthlyComprehensive; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ä¸å¡å±å¤ç |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | @Service |
| | | public class MonthlyComprehensiveServiceImpl implements ImonthlyComprehensive { |
| | | @Resource |
| | | private MonthlyComprehensiveMapper monthMapper; |
| | | |
| | | public List<MonthlyComprehensive> getMonthlyComprehensiveList(String nodeId, List<MonthlyComprehensive> dataList, |
| | | Date beginTime, Date endTime, TimeType timeType, String indexStorageId){ |
| | | if (StringUtils.isNotEmpty(nodeId)) { |
| | | return monthMapper.getMonthlyComprehensiveList(nodeId, dataList, beginTime, endTime, timeType, indexStorageId); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | @Override |
| | | public List<MonthlyComprehensive> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId){ |
| | | if (indexId != null && !indexId.isEmpty()) { |
| | | return monthMapper.getListChart(indexId,beginTime,endTime,timeType,indexStorageId); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.zhitan.common.constant.CommonConst; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.common.utils.DateTimeUtil; |
| | | import com.zhitan.comprehensivestatistics.domain.YearComperhensive; |
| | | import com.zhitan.comprehensivestatistics.mapper.YearComprehensiveMapper; |
| | | import com.zhitan.comprehensivestatistics.service.IyearComprehensive; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * ä¸å¡å±å¤ç |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | @Service |
| | | public class YearComprehensiveServiceImpl implements IyearComprehensive { |
| | | @Resource |
| | | private YearComprehensiveMapper yearMapper; |
| | | |
| | | @Override |
| | | public List<YearComperhensive> getYearComprehensiveList(String nodeId, List<YearComperhensive> dataList, |
| | | Date beginTime, Date endTime, TimeType timeType, String indexStorageId){ |
| | | if (StringUtils.isNotEmpty(nodeId)) { |
| | | return yearMapper.getYearComprehensiveList(nodeId, dataList, beginTime, endTime, timeType, indexStorageId); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | @Override |
| | | public List<YearComperhensive> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId){ |
| | | List<YearComperhensive> dataList = new ArrayList<>(); |
| | | if (StringUtils.isNotEmpty(indexId)) { |
| | | List<YearComperhensive> listChart = yearMapper.getListChart(indexId, beginTime, endTime, timeType, indexStorageId); |
| | | if (CollectionUtils.isNotEmpty(listChart)) { |
| | | Date date = new Date(); |
| | | YearComperhensive first = listChart.get(CommonConst.DIGIT_0); |
| | | Map<String, YearComperhensive> listChartMap = yearMapper.getListChart(indexId, beginTime, endTime, timeType, indexStorageId) |
| | | .stream().collect(Collectors.toMap(YearComperhensive::getTimeCode, prot -> prot)); |
| | | while (beginTime.before(date)) { |
| | | YearComperhensive yearComperhensive = new YearComperhensive(); |
| | | String format = CommonConst.WORD_M + DateUtil.format(beginTime, DateTimeUtil.COMMON_PATTERN_MONTH); |
| | | YearComperhensive item = listChartMap.get(format); |
| | | if (ObjectUtils.isNotEmpty(item)) { |
| | | yearComperhensive = item; |
| | | } else { |
| | | yearComperhensive.setTimeCode(format); |
| | | yearComperhensive.setIndexId(indexId); |
| | | yearComperhensive.setTimeType(timeType.name()); |
| | | yearComperhensive.setUnitId(first.getUnitId()); |
| | | yearComperhensive.setIndexName(first.getIndexName()); |
| | | } |
| | | dataList.add(yearComperhensive); |
| | | beginTime = DateUtil.offsetMonth(beginTime, CommonConst.DIGIT_1); |
| | | } |
| | | } |
| | | } |
| | | return dataList; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.dataitem.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Author DYL |
| | | **/ |
| | | @Data |
| | | public class NodeIndexValueVO { |
| | | |
| | | /** |
| | | * èç¹id |
| | | */ |
| | | private String nodeId; |
| | | |
| | | /** |
| | | * èç¹åç§° |
| | | */ |
| | | private String nodeName; |
| | | |
| | | /** |
| | | * ç¹ä½id |
| | | */ |
| | | private String indexId; |
| | | |
| | | /** |
| | | * 累积é |
| | | */ |
| | | private BigDecimal value; |
| | | } |
| | |
| | | package com.zhitan.dataitem.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zhitan.carbonemission.domain.CarbonEmission; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.dataitem.domain.StagseDataEntry; |
| | |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | public interface DataItemMapper { |
| | | public interface DataItemMapper extends BaseMapper<DataItem> { |
| | | /** |
| | | * é¶æ®µæ°æ®å½å
¥ |
| | | * |
| | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.dataitem.domain.StagseDataEntry; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import com.zhitan.statisticalAnalysis.domain.dto.FlowChartsDTO; |
| | | import com.zhitan.statisticalAnalysis.domain.vo.FlowChartsVO; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | |
| | | * @return |
| | | */ |
| | | List<DataItem> getDataItemHourInforByIndexIds(Date beginTime, Date endTime, String timeType, List<String> indexIds); |
| | | |
| | | /** |
| | | * è·åè½æµå¾å½¢åæ |
| | | * |
| | | * @param dto 请æ±åæ° |
| | | * @return ç»æ |
| | | */ |
| | | FlowChartsVO getFlowCharts(FlowChartsDTO dto); |
| | | } |
| | |
| | | package com.zhitan.dataitem.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.dataitem.domain.StagseDataEntry; |
| | | import com.zhitan.dataitem.domain.vo.NodeIndexValueVO; |
| | | import com.zhitan.dataitem.mapper.DataItemMapper; |
| | | import com.zhitan.dataitem.service.IDataItemService; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.mapper.EnergyIndexMapper; |
| | | import com.zhitan.model.mapper.ModelNodeMapper; |
| | | import com.zhitan.model.mapper.NodeIndexMapper; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import com.zhitan.statisticalAnalysis.domain.dto.FlowChartsDTO; |
| | | import com.zhitan.statisticalAnalysis.domain.vo.FlowChartsItemVO; |
| | | import com.zhitan.statisticalAnalysis.domain.vo.FlowChartsVO; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * stagseDataEntryServiceä¸å¡å±å¤ç |
| | |
| | | @AllArgsConstructor |
| | | public class DataItemServiceImpl implements IDataItemService { |
| | | |
| | | private final DataItemMapper dataItemMapper; |
| | | @Resource |
| | | private DataItemMapper dataItemMapper; |
| | | @Resource |
| | | private ModelNodeMapper modelNodeMapper; |
| | | @Resource |
| | | private EnergyIndexMapper energyIndexMapper; |
| | | @Resource |
| | | private NodeIndexMapper nodeIndexMapper; |
| | | |
| | | |
| | | /** |
| | |
| | | public List<DataItem> getDataItemHourInforByIndexIds(Date beginTime, Date endTime, String timeType, List<String> indexIds) { |
| | | return dataItemMapper.getDataItemHourInforByIndexIds(beginTime, endTime, timeType, indexIds); |
| | | } |
| | | |
| | | /** |
| | | * è·åè½æµå¾å½¢åæ |
| | | * |
| | | * @param dto 请æ±åæ° |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public FlowChartsVO getFlowCharts(FlowChartsDTO dto) { |
| | | FlowChartsVO flowChartsVO = new FlowChartsVO(); |
| | | // ç¶èç¹id |
| | | LambdaQueryWrapper<ModelNode> wrapper = Wrappers.<ModelNode>lambdaQuery() |
| | | .eq(ModelNode::getModelCode, dto.getModelCode()) |
| | | .isNull(ModelNode::getParentId); |
| | | List<ModelNode> modelNodes = modelNodeMapper.selectList(wrapper); |
| | | if(ObjectUtils.isEmpty(modelNodes)){ |
| | | throw new RuntimeException("æªæ¥è¯¢å°æ¨¡åä¿¡æ¯"); |
| | | } |
| | | Optional<ModelNode> modelNodeInfo = modelNodes.stream().findFirst(); |
| | | String nodeId = modelNodeInfo.map(ModelNode::getNodeId).toString(); |
| | | dto.setNodeId(nodeId); |
| | | String energyType = dto.getEnergyType(); |
| | | LocalDate queryTime = dto.getQueryTime(); |
| | | TimeType timeType = dto.getTimeType(); |
| | | |
| | | // è·åèç¹ä¿¡æ¯ |
| | | ModelNode modelNode = modelNodeMapper.selectModelNodeById(nodeId); |
| | | if (ObjectUtils.isEmpty(modelNode)) { |
| | | return flowChartsVO; |
| | | } |
| | | // è·åæ¥è¯¢æ¶é´ |
| | | Map<String, LocalDateTime> dateTimeMap = getDataItemByIndexId(timeType, queryTime); |
| | | |
| | | // è·åèç¹åç¹ä½ç累积é |
| | | List<NodeIndexValueVO> parentDataItemList = modelNodeMapper.getDataItemByNodeId(nodeId, energyType, timeType, dateTimeMap); |
| | | |
| | | // è·ååèç¹ä¸çç¹ä½ç累积é |
| | | List<NodeIndexValueVO> childDataItemList = modelNodeMapper.getDataItemByParentNodeId(nodeId, energyType, timeType, dateTimeMap); |
| | | |
| | | // è·åç¶èç¹ä¸çè½èæ°æ®æ»å |
| | | if (ObjectUtils.isNotEmpty(parentDataItemList)) { |
| | | // ç¶èç¹ä¸çè½èæ°æ®æ»å |
| | | BigDecimal totalValue = parentDataItemList.stream().map(NodeIndexValueVO::getValue) |
| | | .filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // æ»ç´¯ç§¯é |
| | | flowChartsVO.setTotalAccumulatedAmount(totalValue); |
| | | } |
| | | // è·ååèç¹ä¸çè½èæ°æ® |
| | | if (ObjectUtils.isNotEmpty(childDataItemList)) { |
| | | // åèç¹ä¸çè½èæ°æ®æ»å |
| | | BigDecimal childTotalValue = childDataItemList.stream().map(NodeIndexValueVO::getValue) |
| | | .filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // åèç¹ç´¯ç§¯é |
| | | flowChartsVO.setChildNodeAccumulatedAmount(childTotalValue); |
| | | |
| | | // æ ¹æ®åèç¹idåç» |
| | | Map<String, List<NodeIndexValueVO>> voMap = childDataItemList.stream() |
| | | .collect(Collectors.groupingBy(NodeIndexValueVO::getNodeId)); |
| | | List<FlowChartsItemVO> itemList = new ArrayList<>(); |
| | | |
| | | for (String childNodeId : voMap.keySet()) { |
| | | FlowChartsItemVO vo = new FlowChartsItemVO(); |
| | | vo.setSource(modelNode.getName()); |
| | | List<NodeIndexValueVO> valueList = voMap.getOrDefault(childNodeId, Collections.emptyList()); |
| | | if (ObjectUtils.isNotEmpty(valueList)) { |
| | | // å个åèç¹çè½èæ°æ®æ»å |
| | | BigDecimal value = valueList.stream().map(NodeIndexValueVO::getValue) |
| | | .filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | valueList.stream().findFirst().ifPresent(nodeIndexValueVO -> vo.setTarget(nodeIndexValueVO.getNodeName())); |
| | | vo.setValue(value); |
| | | } |
| | | itemList.add(vo); |
| | | } |
| | | flowChartsVO.setItemVOList(itemList); |
| | | } |
| | | return flowChartsVO; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®indexIdæ¥è¯¢è½èæ°æ® |
| | | */ |
| | | private Map<String, LocalDateTime> getDataItemByIndexId(TimeType timeType, LocalDate queryTime) { |
| | | LocalDateTime startTime; |
| | | LocalDateTime endTime; |
| | | LocalDate startDate; |
| | | LocalDate endDate; |
| | | switch (timeType) { |
| | | case DAY: |
| | | // å½å¤©çå¼å§æ¶é´ |
| | | startTime = LocalDateTime.of(queryTime, LocalTime.MIN); |
| | | // å½å¤©çç»ææ¶é´ |
| | | endTime = LocalDateTime.of(queryTime, LocalTime.MAX); |
| | | break; |
| | | case MONTH: |
| | | // 彿çå¼å§æ¶é´ |
| | | startDate = queryTime.with(TemporalAdjusters.firstDayOfMonth()); |
| | | startTime = LocalDateTime.of(startDate, LocalTime.MIN); |
| | | // 彿çç»ææ¶é´ |
| | | endDate = queryTime.with(TemporalAdjusters.lastDayOfMonth()); |
| | | endTime = LocalDateTime.of(endDate, LocalTime.MAX); |
| | | break; |
| | | case YEAR: |
| | | // å½å¹´çå¼å§æ¶é´ |
| | | startDate = queryTime.with(TemporalAdjusters.firstDayOfYear()); |
| | | startTime = LocalDateTime.of(startDate, LocalTime.MIN); |
| | | // å½å¹´çç»ææ¶é´ |
| | | endDate = queryTime.with(TemporalAdjusters.lastDayOfYear()); |
| | | endTime = LocalDateTime.of(endDate, LocalTime.MAX); |
| | | break; |
| | | default: |
| | | // å½å¤©çå¼å§æ¶é´ |
| | | startTime = LocalDateTime.of(queryTime, LocalTime.MIN); |
| | | // å½å¤©çç»ææ¶é´ |
| | | endTime = LocalDateTime.of(queryTime, LocalTime.MAX); |
| | | break; |
| | | } |
| | | Map<String, LocalDateTime> localDateTimeMap = new HashMap<>(); |
| | | localDateTimeMap.put("startTime", startTime); |
| | | localDateTimeMap.put("endTime", endTime); |
| | | return localDateTimeMap; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Description: TODO |
| | | * @author: yxw |
| | | * @date: 2022å¹´04æ24æ¥ 16:59 |
| | | */ |
| | | @Data |
| | | public class ElectricPowerFactorDetail { |
| | | /** |
| | | * æå¤§åçå æ° |
| | | */ |
| | | private String max; |
| | | /** |
| | | * æå¤§åçå æ°åçæ¶é´ |
| | | */ |
| | | private String maxTime; |
| | | /** |
| | | * æå°åçå æ° |
| | | */ |
| | | private String min; |
| | | /** |
| | | * æå°åçå æ°åçæ¶é´ |
| | | */ |
| | | private String minTime; |
| | | /** |
| | | * å¹³ååçå æ° |
| | | */ |
| | | private String avg; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Description: TODO |
| | | * @author: yxw |
| | | * @date: 2022å¹´04æ24æ¥ 16:59 |
| | | */ |
| | | @Data |
| | | public class ElectricPowerFactorItem { |
| | | /** |
| | | * æ¶é´ |
| | | */ |
| | | private String timeCode; |
| | | /** |
| | | * 宿¶å¼ |
| | | */ |
| | | private String value; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: TODO |
| | | * @author: yxw |
| | | * @date: 2022å¹´04æ24æ¥ 16:58 |
| | | */ |
| | | @Data |
| | | public class ElectricPowerFactorVO { |
| | | /** |
| | | * è®°å½å表 |
| | | */ |
| | | private List<ElectricPowerFactorItem> itemList; |
| | | |
| | | /** |
| | | * 详æ
å®ä½ |
| | | */ |
| | | private ElectricPowerFactorDetail detail; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Description: TODO |
| | | * @author: yxw |
| | | * @date: 2022å¹´04æ24æ¥ 16:59 |
| | | */ |
| | | @Data |
| | | public class ElectricThreePhaseDetail { |
| | | /** |
| | | * æå¤§åçå æ° |
| | | */ |
| | | private String max; |
| | | /** |
| | | * æå¤§åçå æ°åçæ¶é´ |
| | | */ |
| | | private String maxTime; |
| | | /** |
| | | * æå°åçå æ° |
| | | */ |
| | | private String min; |
| | | /** |
| | | * æå°åçå æ°åçæ¶é´ |
| | | */ |
| | | private String minTime; |
| | | |
| | | /** |
| | | * æå¤§å¼-Aç¸çµæµ/çµå |
| | | */ |
| | | private String valueMaxA; |
| | | /** |
| | | * æå¤§å¼-Bç¸çµæµ/çµå |
| | | */ |
| | | private String valueMaxB; |
| | | /** |
| | | * æå¤§å¼-Cç¸çµæµ/çµå |
| | | */ |
| | | private String valueMaxC; |
| | | |
| | | /** |
| | | * æå°å¼-Aç¸çµæµ/çµå |
| | | */ |
| | | private String valueMinA; |
| | | /** |
| | | * æå°å¼-Bç¸çµæµ/çµå |
| | | */ |
| | | private String valueMinB; |
| | | /** |
| | | * æå°å¼-Cç¸çµæµ/çµå |
| | | */ |
| | | private String valueMinC; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Description: TODO |
| | | * @author: yxw |
| | | * @date: 2022å¹´04æ24æ¥ 16:59 |
| | | */ |
| | | @Data |
| | | public class ElectricThreePhaseItem { |
| | | /** |
| | | * çµè¡¨åç§° |
| | | */ |
| | | private String name; |
| | | /** |
| | | * æ¶é´ |
| | | */ |
| | | private String timeCode; |
| | | /** |
| | | * ç»è®¡å¾æ¾ç¤ºæ¶é´ |
| | | */ |
| | | private String timeCodeChart; |
| | | /** |
| | | * æå¤§ä¸ç¸ä¸å¹³è¡¡ |
| | | */ |
| | | private String max; |
| | | /** |
| | | * æå°ä¸ç¸ä¸å¹³è¡¡ |
| | | */ |
| | | private String min; |
| | | /** |
| | | * Aç¸çµæµ/çµå |
| | | */ |
| | | private String valueA; |
| | | /** |
| | | * Dç¸çµæµ/çµå |
| | | */ |
| | | private String valueB; |
| | | /** |
| | | * Cç¸çµæµ/çµå |
| | | */ |
| | | private String valueC; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Description: TODO |
| | | * @author: yxw |
| | | * @date: 2022å¹´05æ06æ¥ 14:02 |
| | | */ |
| | | @Data |
| | | public class ElectricThreePhaseTempModel { |
| | | |
| | | private Double max; |
| | | private Date maxTime; |
| | | private Double min; |
| | | private Date minTime; |
| | | /** |
| | | * æå¤§å¼-Aç¸çµæµ/çµå |
| | | */ |
| | | private double valueMaxA; |
| | | /** |
| | | * æå¤§å¼-Bç¸çµæµ/çµå |
| | | */ |
| | | private double valueMaxB; |
| | | /** |
| | | * æå¤§å¼-Cç¸çµæµ/çµå |
| | | */ |
| | | private double valueMaxC; |
| | | |
| | | /** |
| | | * æå°å¼-Aç¸çµæµ/çµå |
| | | */ |
| | | private double valueMinA; |
| | | /** |
| | | * æå°å¼-Bç¸çµæµ/çµå |
| | | */ |
| | | private double valueMinB; |
| | | /** |
| | | * æå°å¼-Cç¸çµæµ/çµå |
| | | */ |
| | | private double valueMinC; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: TODO |
| | | * @author: yxw |
| | | * @date: 2022å¹´04æ24æ¥ 16:58 |
| | | */ |
| | | @Data |
| | | public class ElectricThreePhaseVO { |
| | | /** |
| | | * è®°å½å表 |
| | | */ |
| | | private List<ElectricThreePhaseItem> itemList; |
| | | |
| | | /** |
| | | * 详æ
å®ä½ |
| | | */ |
| | | private ElectricThreePhaseDetail detail; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * ééç¹ç¨è½åå
çµè¡¨ |
| | | * |
| | | * @author fanxinfu |
| | | */ |
| | | @Data |
| | | public class EnergyIndexAndUnitDevice { |
| | | |
| | | private String indexId; |
| | | private String indexName; |
| | | private String energyType; |
| | | private String energyName; |
| | | private String energyUnitName; |
| | | private String energyUnitDeviceName; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.domain.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | /** |
| | | * ç¹ä½è¯¦ç»ä¿¡æ¯ |
| | | * |
| | | * @Author: Zhujw |
| | | * @Date: 2023/5/26 |
| | | */ |
| | | @Data |
| | | public class EnergyIndexInforModel { |
| | | |
| | | @ApiModelProperty(value = "ç¹ä½id") |
| | | private String indexId; |
| | | |
| | | @ApiModelProperty(value = "计éå¨å
·id") |
| | | private String meterId; |
| | | |
| | | @ApiModelProperty(value = "ç¹ä½åç§°") |
| | | private String indexName; |
| | | |
| | | @ApiModelProperty(value = "ç¹ä½ç±»å(ééã计ç®)") |
| | | private String indexType; |
| | | |
| | | @ApiModelProperty(value = "ç¹ä½code") |
| | | private String indexCode; |
| | | |
| | | @ApiModelProperty(value = "ç¹ä½åä½") |
| | | private String indexUnit; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Description: TODO |
| | | * @author: yxw |
| | | * @date: 2022å¹´04æ24æ¥ 16:59 |
| | | */ |
| | | @Data |
| | | public class ListElectricLoadDetail { |
| | | /** |
| | | * æå¤§è´è· |
| | | */ |
| | | private String max; |
| | | /** |
| | | * æå¤§è´è·åçæ¶é´ |
| | | */ |
| | | private String maxTime; |
| | | /** |
| | | * æå°è´è· |
| | | */ |
| | | private String min; |
| | | /** |
| | | * æå°è´è·åçæ¶é´ |
| | | */ |
| | | private String minTime; |
| | | /** |
| | | * å¹³åè´è· |
| | | */ |
| | | private String avg; |
| | | /** |
| | | * è´è·ç = å¹³åè´è· / æå¤§è´è· |
| | | */ |
| | | private String rate; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Description: TODO |
| | | * @author: yxw |
| | | * @date: 2022å¹´04æ24æ¥ 16:59 |
| | | */ |
| | | @Data |
| | | public class ListElectricLoadItem { |
| | | /** |
| | | * çµè¡¨åç§° |
| | | */ |
| | | private String name; |
| | | /** |
| | | * æ¶é´ |
| | | */ |
| | | private String timeCode; |
| | | /** |
| | | * ç»è®¡å¾æ¾ç¤ºæ¶é´ |
| | | */ |
| | | private String timeCodeChart; |
| | | /** |
| | | * æå¤§è´è· |
| | | */ |
| | | private String max; |
| | | /** |
| | | * æå°è´è· |
| | | */ |
| | | private String min; |
| | | /** |
| | | * å¹³åè´è· |
| | | */ |
| | | private String avg; |
| | | /** |
| | | * 宿¶å¼ |
| | | */ |
| | | private String value; |
| | | /** |
| | | * è´è·ç |
| | | */ |
| | | private String rate; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: TODO |
| | | * @author: yxw |
| | | * @date: 2022å¹´04æ24æ¥ 16:58 |
| | | */ |
| | | @Data |
| | | public class ListElectricLoadVO { |
| | | /** |
| | | * è®°å½å表 |
| | | */ |
| | | private List<ListElectricLoadItem> itemList; |
| | | |
| | | /** |
| | | * 详æ
å®ä½ |
| | | */ |
| | | private ListElectricLoadDetail detail; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.service; |
| | | |
| | | import com.zhitan.energyMonitor.domain.vo.ListElectricLoadVO; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | |
| | | /** |
| | | * @Description: |
| | | * @Author: jeecg-boot |
| | | * @Date: 2022-04-19 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface IElectricLoadService { |
| | | |
| | | /** |
| | | * è·åè´è·åææ°æ® |
| | | */ |
| | | ListElectricLoadVO list(String timeType, String timeCode, EnergyIndex energyIndex); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.service; |
| | | |
| | | import com.zhitan.energyMonitor.domain.vo.ElectricPowerFactorVO; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | |
| | | |
| | | /** |
| | | * @Description: |
| | | * @Author: jeecg-boot |
| | | * @Date: 2022-04-19 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface IElectricPowerFactorService { |
| | | |
| | | /** |
| | | * è·åè´è·åææ°æ® |
| | | */ |
| | | ElectricPowerFactorVO list(String timeCode, EnergyIndex energyIndex); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.service; |
| | | |
| | | import com.zhitan.energyMonitor.domain.vo.ElectricThreePhaseVO; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: |
| | | * @Author: jeecg-boot |
| | | * @Date: 2022-04-19 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface IElectricThreePhaseService { |
| | | |
| | | /** |
| | | * è·åä¸ç¸ä¸å¹³è¡¡æ°æ® |
| | | */ |
| | | ElectricThreePhaseVO list(String timeType, String timeCode, List<EnergyIndex> energyIndexList, String requestType, String meterId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.service.impl; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.zhitan.basicdata.domain.MeterImplement; |
| | | import com.zhitan.basicdata.mapper.MeterImplementMapper; |
| | | import com.zhitan.common.constant.CommonConst; |
| | | import com.zhitan.common.constant.TimeTypeConst; |
| | | import com.zhitan.common.enums.CollectionModes; |
| | | import com.zhitan.common.enums.GroupTimeType; |
| | | import com.zhitan.common.utils.ChartUtils; |
| | | import com.zhitan.common.utils.DateTimeUtil; |
| | | import com.zhitan.common.utils.DoubleUtil; |
| | | import com.zhitan.common.utils.StringUtil; |
| | | import com.zhitan.energyMonitor.domain.vo.ListElectricLoadDetail; |
| | | import com.zhitan.energyMonitor.domain.vo.ListElectricLoadItem; |
| | | import com.zhitan.energyMonitor.domain.vo.ListElectricLoadVO; |
| | | import com.zhitan.energyMonitor.service.IElectricLoadService; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.realtimedata.domain.TagValue; |
| | | import com.zhitan.realtimedata.service.RealtimeDatabaseService; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.joda.time.DateTime; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: sensor_alarm_item |
| | | * @Author: jeecg-boot |
| | | * @Date: 2022-04-19 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Service |
| | | public class ElectricLoadServiceImpl implements IElectricLoadService { |
| | | @Autowired |
| | | private RealtimeDatabaseService realtimeDatabaseService; |
| | | @Resource |
| | | private MeterImplementMapper meterImplementMapper; |
| | | |
| | | @Override |
| | | public ListElectricLoadVO list(String timeType, String timeCode, EnergyIndex energyIndex) { |
| | | ListElectricLoadVO vo = new ListElectricLoadVO(); |
| | | List<ListElectricLoadItem> itemList = new ArrayList<>(); |
| | | vo.setItemList(itemList); |
| | | ListElectricLoadDetail detail = new ListElectricLoadDetail(); |
| | | detail.setMaxTime(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setMax(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setMin(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setMinTime(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setAvg(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setRate(CommonConst.DOUBLE_MINUS_SIGN); |
| | | vo.setDetail(detail); |
| | | |
| | | MeterImplement meterImplement = meterImplementMapper.selectById(energyIndex.getMeterId()); |
| | | |
| | | if (ObjectUtil.isEmpty(meterImplement)) { |
| | | return vo; |
| | | } |
| | | List<Date> dateList = new ArrayList<>(); |
| | | ChartUtils.generateDateList(timeType, timeCode, dateList); |
| | | // å 为influxdb没ææç
§æåç»åæ°æ®ï¼åªè½æç
§æ¥æå¾ªç¯åæ°æ® |
| | | if (TimeTypeConst.TIME_TYPE_YEAR.equals(timeType)) { |
| | | getYearData(timeType, dateList, energyIndex, meterImplement.getMeterName(), itemList); |
| | | } else { |
| | | getDayAndMonthData(timeType, timeCode, energyIndex, meterImplement.getMeterName(), itemList); |
| | | } |
| | | if (!StringUtil.isEmptyOrNull(energyIndex.getCode())) { |
| | | Date start = ChartUtils.getDateTime(timeType, timeCode); |
| | | Date end = ChartUtils.getEndTime(timeType, start); |
| | | |
| | | String code = energyIndex.getCode(); |
| | | TagValue maxTagValueModel = realtimeDatabaseService.statistics(code, start, end, CollectionModes.max); |
| | | TagValue minTagValueModel = realtimeDatabaseService.statistics(code, start, end, CollectionModes.min); |
| | | TagValue avgTagValueModel = realtimeDatabaseService.statistics(code, start, end, CollectionModes.mean); |
| | | |
| | | double avg = CommonConst.DIGIT_DOUBLE_0; |
| | | if (!ObjectUtil.isEmpty(avgTagValueModel) && !ObjectUtil.isEmpty(avgTagValueModel.getValue())) { |
| | | detail.setAvg(DoubleUtil.formatDoubleToStr(avgTagValueModel.getValue()) + CommonConst.ELECTRIC_LOAD_UNIT); |
| | | avg = avgTagValueModel.getValue(); |
| | | } |
| | | |
| | | if (!ObjectUtil.isEmpty(maxTagValueModel) && !ObjectUtil.isEmpty(maxTagValueModel.getValue())) { |
| | | detail.setMax(DoubleUtil.formatDoubleToStr(maxTagValueModel.getValue())); |
| | | detail.setMaxTime(DateTimeUtil.getDateTime(maxTagValueModel.getDataTime(), DateTimeUtil.COMMON_PATTERN)); |
| | | |
| | | if (maxTagValueModel.getValue() != CommonConst.DIGIT_DOUBLE_0) { |
| | | double rate = avg * CommonConst.DIGIT_DOUBLE_100 / maxTagValueModel.getValue(); |
| | | detail.setRate(DoubleUtil.formatDoubleToStr(rate) + CommonConst.SYMBOL_PERCENT); |
| | | } |
| | | } |
| | | |
| | | if (!ObjectUtil.isEmpty(minTagValueModel) && !ObjectUtil.isEmpty(minTagValueModel.getValue())) { |
| | | detail.setMin(DoubleUtil.formatDoubleToStr(minTagValueModel.getValue())); |
| | | detail.setMinTime(DateTimeUtil.getDateTime(minTagValueModel.getDataTime(), DateTimeUtil.COMMON_PATTERN)); |
| | | } |
| | | |
| | | if (!CommonConst.DOUBLE_MINUS_SIGN.equals(detail.getMax())) { |
| | | String m = detail.getMax(); |
| | | detail.setMax(m + CommonConst.ELECTRIC_LOAD_UNIT); |
| | | } |
| | | if (!CommonConst.DOUBLE_MINUS_SIGN.equals(detail.getMin())) { |
| | | String min = detail.getMin(); |
| | | detail.setMin(min + CommonConst.ELECTRIC_LOAD_UNIT); |
| | | } |
| | | if (CommonConst.DOUBLE_MINUS_SIGN.equals(detail.getMax())) { |
| | | detail.setAvg(CommonConst.DOUBLE_MINUS_SIGN); |
| | | } |
| | | } |
| | | |
| | | return vo; |
| | | } |
| | | |
| | | /** |
| | | * è·åæåå¤©æ°æ®,å 为influxdbå¯ä»¥æç
§åãæ¶ã天åç»åæ°ï¼ä¸å¯ä»¥æç
§æåç»åæ°ï¼æä»¥åæä¸¤ä¸ªæ¹æ³æ¥å |
| | | */ |
| | | private void getDayAndMonthData(String timeType, String timeCode, EnergyIndex energyIndex, String meterName, List<ListElectricLoadItem> itemList) { |
| | | String tagCodes = energyIndex.getCode(); |
| | | List<TagValue> maxList = new ArrayList<>(); |
| | | List<TagValue> minList = new ArrayList<>(); |
| | | List<TagValue> avgList = new ArrayList<>(); |
| | | if (TimeTypeConst.TIME_TYPE_DAY.equals(timeType)) { |
| | | } else { |
| | | String tempTimeCode = StringUtil.ifEmptyOrNullReturnValue(timeCode).replace(CommonConst.SINGLE_MINUS_SIGN, CommonConst.EMPTY); |
| | | Date start = DateTimeUtil.toDateTime(tempTimeCode, DateTimeUtil.COMMON_PATTERN_MONTH); |
| | | Date end = DateTimeUtil.addMonths(start, CommonConst.DIGIT_1); |
| | | if (!StringUtil.isEmptyOrNull(tagCodes)) { |
| | | maxList = realtimeDatabaseService.statistics(tagCodes, start, end, CollectionModes.max, GroupTimeType.d); |
| | | minList = realtimeDatabaseService.statistics(tagCodes, start, end, CollectionModes.min, GroupTimeType.d); |
| | | avgList = realtimeDatabaseService.statistics(tagCodes, start, end, CollectionModes.mean, GroupTimeType.d); |
| | | } |
| | | } |
| | | if (CollectionUtils.isEmpty(maxList)) { |
| | | maxList = new ArrayList<>(); |
| | | } |
| | | if (CollectionUtils.isEmpty(minList)) { |
| | | minList = new ArrayList<>(); |
| | | } |
| | | if (CollectionUtils.isEmpty(avgList)) { |
| | | avgList = new ArrayList<>(); |
| | | } |
| | | List<Date> dateList = new ArrayList<>(); |
| | | ChartUtils.generateDateList(timeType, timeCode, dateList); |
| | | Date now = new Date(); |
| | | Date temNow = now; |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | //å½åæ¶é´è½¬ææ´æ¶æ´ç¹ |
| | | temNow = DateTimeUtil.getHourTime(TimeTypeConst.TIME_TYPE_HOUR, now); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | //å½åæ¶é´è½¬ææ´æ¶æ´ç¹ |
| | | temNow = DateTimeUtil.getHourTime(TimeTypeConst.TIME_TYPE_DAY, now); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | for (Date date : dateList) { |
| | | ListElectricLoadItem temp = new ListElectricLoadItem(); |
| | | temp.setTimeCode(ChartUtils.getTimeCode(timeType, date)); |
| | | temp.setName(ObjectUtils.isNotEmpty(meterName) ? meterName : ""); |
| | | temp.setMax(CommonConst.DOUBLE_MINUS_SIGN); |
| | | temp.setMin(CommonConst.DOUBLE_MINUS_SIGN); |
| | | temp.setAvg(CommonConst.DOUBLE_MINUS_SIGN); |
| | | temp.setTimeCodeChart(ChartUtils.getTimeCodeChart(timeType, date)); |
| | | temp.setRate(CommonConst.DOUBLE_MINUS_SIGN); |
| | | temp.setValue(CommonConst.DOUBLE_MINUS_SIGN); |
| | | itemList.add(temp); |
| | | // 妿大äºå½åæ¶é´é»è®¤-- |
| | | if (DateTimeUtil.compareDateDiff(date, temNow) > CommonConst.DIGIT_0) { |
| | | continue; |
| | | } |
| | | //天ç夿 |
| | | if (TimeTypeConst.TIME_TYPE_DAY.equals(timeType)) { |
| | | // ç±äºå®æ¶åºè¿åçæ¶é´å¯¹åºå¼ä»£è¡¨çæ¯åä¸ä¸ªå¨æçå¼ |
| | | Date nextHour = DateTimeUtil.addHours(date, CommonConst.DIGIT_1); |
| | | if (!StringUtil.isEmptyOrNull(energyIndex.getCode())) { |
| | | TagValue tagValue = realtimeDatabaseService.retrieve(energyIndex.getCode(), nextHour); |
| | | if (!ObjectUtil.isEmpty(tagValue)) { |
| | | if (ObjectUtils.isEmpty(tagValue) || ObjectUtils.isEmpty(tagValue.getValue())) { |
| | | temp.setValue(CommonConst.DOUBLE_MINUS_SIGN); |
| | | } else { |
| | | temp.setValue(String.valueOf(DoubleUtil.formatDouble(tagValue.getValue()))); |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | //æç夿ï¼ç±äºå®æ¶åºè¿åçæ¶é´å¯¹åºå¼ä»£è¡¨çæ¯åä¸ä¸ªå¨æçå¼ |
| | | Date nextDay = DateTimeUtil.addDays(date, CommonConst.DIGIT_1); |
| | | TagValue tagValueMonth = maxList.stream().filter(x -> (new DateTime(x.getDataTime())).withTimeAtStartOfDay().toDate().equals(nextDay)).findAny().orElse(null); |
| | | if (!ObjectUtil.isEmpty(tagValueMonth)) { |
| | | //æçæ¾å¤© |
| | | TagValue minModel = minList.stream().filter(x -> x.getDataTime().equals(tagValueMonth.getDataTime())).findAny().orElse(null); |
| | | if (!ObjectUtil.isEmpty(minModel)) { |
| | | temp.setMin(String.valueOf(DoubleUtil.formatDouble(minModel.getValue()))); |
| | | } |
| | | TagValue avgModel = avgList.stream().filter(x -> x.getDataTime().equals(tagValueMonth.getDataTime())).findAny().orElse(null); |
| | | if (!ObjectUtil.isEmpty(avgModel)) { |
| | | temp.setAvg(String.valueOf(DoubleUtil.formatDouble(avgModel.getValue()))); |
| | | } |
| | | temp.setMax(String.valueOf(DoubleUtil.formatDouble(tagValueMonth.getValue()))); |
| | | |
| | | temp.setRate(CommonConst.DOUBLE_MINUS_SIGN); |
| | | if (Double.parseDouble(temp.getMax()) != CommonConst.DIGIT_DOUBLE_0) { |
| | | double rate = Double.parseDouble(temp.getAvg()) * 100 / Double.parseDouble(temp.getMax()); |
| | | temp.setRate(DoubleUtil.formatDoubleToStr(rate) + CommonConst.SYMBOL_PERCENT); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åå¹´æ°æ® |
| | | */ |
| | | private void getYearData(String timeType, List<Date> dateList, EnergyIndex energyIndex, String meterName, List<ListElectricLoadItem> itemList) { |
| | | String tagCode = StringUtil.ifEmptyOrNullReturnValue(energyIndex.getCode()); |
| | | for (Date date : dateList) { |
| | | ListElectricLoadItem temp = new ListElectricLoadItem(); |
| | | Date endTime = DateTimeUtil.addMonths(date, CommonConst.DIGIT_1); |
| | | temp.setAvg(CommonConst.DOUBLE_MINUS_SIGN); |
| | | temp.setMax(CommonConst.DOUBLE_MINUS_SIGN); |
| | | temp.setMin(CommonConst.DOUBLE_MINUS_SIGN); |
| | | if (!StringUtil.isEmptyOrNull(tagCode)) { |
| | | String code = energyIndex.getCode(); |
| | | TagValue rt3 = realtimeDatabaseService.statistics(code, date, endTime, CollectionModes.max); |
| | | TagValue rt4 = realtimeDatabaseService.statistics(code, date, endTime, CollectionModes.min); |
| | | TagValue rt2 = realtimeDatabaseService.statistics(code, date, endTime, CollectionModes.mean); |
| | | if (ObjectUtils.isNotEmpty(rt2.getValue())) { |
| | | temp.setAvg(String.valueOf(DoubleUtil.formatDouble(rt2.getValue()))); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(rt3.getValue())) { |
| | | temp.setMax(String.valueOf(DoubleUtil.formatDouble(rt3.getValue()))); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(rt4.getValue())) { |
| | | temp.setMin(String.valueOf(DoubleUtil.formatDouble(rt4.getValue()))); |
| | | } |
| | | } |
| | | |
| | | temp.setTimeCode(ChartUtils.getTimeCode(timeType, date)); |
| | | temp.setTimeCodeChart(ChartUtils.getTimeCodeChart(timeType, date)); |
| | | temp.setName(StringUtil.ifEmptyOrNullReturnValue(meterName)); |
| | | temp.setRate(CommonConst.DOUBLE_MINUS_SIGN); |
| | | temp.setValue(CommonConst.DOUBLE_MINUS_SIGN); |
| | | if (!temp.getMax().equals(CommonConst.DOUBLE_MINUS_SIGN) && Double.parseDouble(temp.getMax()) != CommonConst.DIGIT_DOUBLE_0) { |
| | | double rate = Double.parseDouble(temp.getAvg()) * 100 / Double.parseDouble(temp.getMax()); |
| | | temp.setRate(DoubleUtil.formatDoubleToStr(rate) + CommonConst.SYMBOL_PERCENT); |
| | | } |
| | | itemList.add(temp); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.service.impl; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.zhitan.common.constant.CommonConst; |
| | | import com.zhitan.common.constant.TimeTypeConst; |
| | | import com.zhitan.common.utils.ChartUtils; |
| | | import com.zhitan.common.utils.DateTimeUtil; |
| | | import com.zhitan.common.utils.DoubleUtil; |
| | | import com.zhitan.energyMonitor.domain.vo.ElectricPowerFactorDetail; |
| | | import com.zhitan.energyMonitor.domain.vo.ElectricPowerFactorItem; |
| | | import com.zhitan.energyMonitor.domain.vo.ElectricPowerFactorVO; |
| | | import com.zhitan.energyMonitor.service.IElectricPowerFactorService; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.realtimedata.domain.TagValue; |
| | | import com.zhitan.realtimedata.service.RealtimeDatabaseService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: sensor_alarm_item |
| | | * @Author: jeecg-boot |
| | | * @Date: 2022-04-19 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ElectricPowerFactorServiceImpl implements IElectricPowerFactorService { |
| | | @Autowired |
| | | private RealtimeDatabaseService realtimeDatabaseService; |
| | | |
| | | @Override |
| | | public ElectricPowerFactorVO list(String timeCode, EnergyIndex energyIndex) { |
| | | ElectricPowerFactorVO vo = new ElectricPowerFactorVO(); |
| | | List<ElectricPowerFactorItem> itemList = new ArrayList<>(); |
| | | ElectricPowerFactorDetail detail = new ElectricPowerFactorDetail(); |
| | | detail.setMaxTime(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setMax(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setMin(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setMinTime(CommonConst.DOUBLE_MINUS_SIGN); |
| | | vo.setItemList(itemList); |
| | | vo.setDetail(detail); |
| | | |
| | | List<Date> dateList = new ArrayList<>(); |
| | | ChartUtils.generateDateList(TimeTypeConst.TIME_TYPE_DAY, timeCode, dateList); |
| | | double max = CommonConst.DIGIT_0, min = CommonConst.MIN_INIT_VALUE; |
| | | //dateListè®¡æ° |
| | | Date now = new Date(); |
| | | //å½åæ¶é´è½¬ææ´æ¶æ´ç¹ |
| | | now = DateTimeUtil.getHourTime(TimeTypeConst.TIME_TYPE_HOUR, now); |
| | | int i = CommonConst.DIGIT_0; |
| | | for (Date date : dateList) { |
| | | ElectricPowerFactorItem temp = new ElectricPowerFactorItem(); |
| | | temp.setTimeCode(ChartUtils.getTimeCodeChart(TimeTypeConst.TIME_TYPE_DAY, date)); |
| | | temp.setValue(CommonConst.DOUBLE_MINUS_SIGN); |
| | | itemList.add(temp); |
| | | // 妿大äºå½åæ¶é´é»è®¤-- |
| | | if (DateTimeUtil.compareDateDiff(date, now) > CommonConst.DIGIT_0) { |
| | | i++; |
| | | continue; |
| | | } |
| | | TagValue tagValue = new TagValue(); |
| | | try { |
| | | TagValue retrieve = realtimeDatabaseService.retrieve(energyIndex.getCode(), date); |
| | | if (ObjectUtil.isNotEmpty(retrieve)) { |
| | | tagValue = retrieve; |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("è·ååçå æ°å¼å¸¸ï¼" + e.getMessage()); |
| | | } |
| | | if (ObjectUtil.isNotEmpty(tagValue.getValue())) { |
| | | double value = DoubleUtil.formatDouble(tagValue.getValue()); |
| | | |
| | | temp.setValue(String.valueOf(value)); |
| | | //ç»æå°å¼èµå¼ç¬¬ä¸æ¡ |
| | | if (i == CommonConst.DIGIT_0) { |
| | | min = Double.parseDouble(temp.getValue()); |
| | | } |
| | | if (value > max) { |
| | | max = value; |
| | | detail.setMax(max + CommonConst.EMPTY); |
| | | detail.setMaxTime(DateTimeUtil.getDateTime(date)); |
| | | } |
| | | if (value <= min) { |
| | | min = value; |
| | | detail.setMin(min + CommonConst.EMPTY); |
| | | detail.setMinTime(DateTimeUtil.getDateTime(date)); |
| | | } |
| | | } |
| | | i++; |
| | | } |
| | | |
| | | detail.setAvg(CommonConst.DOUBLE_MINUS_SIGN); |
| | | if (ObjectUtil.isNotEmpty(itemList)) { |
| | | double avg = CommonConst.DIGIT_DOUBLE_0; |
| | | for (ElectricPowerFactorItem li : itemList) { |
| | | try { |
| | | if (!li.getValue().equals(CommonConst.DOUBLE_MINUS_SIGN)) { |
| | | avg += DoubleUtil.toDouble(li.getValue()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | } |
| | | } |
| | | detail.setAvg(DoubleUtil.formatDoubleToStr(avg / itemList.size())); |
| | | } |
| | | |
| | | return vo; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energyMonitor.service.impl; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.zhitan.basicdata.domain.MeterImplement; |
| | | import com.zhitan.basicdata.mapper.MeterImplementMapper; |
| | | import com.zhitan.common.constant.CommonConst; |
| | | import com.zhitan.common.constant.TimeTypeConst; |
| | | import com.zhitan.common.utils.*; |
| | | import com.zhitan.energyMonitor.domain.vo.ElectricThreePhaseDetail; |
| | | import com.zhitan.energyMonitor.domain.vo.ElectricThreePhaseItem; |
| | | import com.zhitan.energyMonitor.domain.vo.ElectricThreePhaseTempModel; |
| | | import com.zhitan.energyMonitor.domain.vo.ElectricThreePhaseVO; |
| | | import com.zhitan.energyMonitor.service.IElectricThreePhaseService; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.realtimedata.domain.TagValue; |
| | | import com.zhitan.realtimedata.service.RealtimeDatabaseService; |
| | | import org.joda.time.DateTime; |
| | | import org.joda.time.Duration; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Description: sensor_alarm_item |
| | | * @Author: jeecg-boot |
| | | * @Date: 2022-04-19 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Service |
| | | public class ElectricThreePhaseServiceImpl implements IElectricThreePhaseService { |
| | | |
| | | @Autowired |
| | | private RealtimeDatabaseService realtimeDatabaseService; |
| | | @Resource |
| | | private MeterImplementMapper meterImplementMapper; |
| | | |
| | | /** |
| | | * è·åä¸ç¸ä¸å¹³è¡¡æ°æ® |
| | | * |
| | | * @param timeType æ¶é´ç±»å |
| | | * @param timeCode æ¶é´ç¼ç |
| | | * @param energyIndexList ç¹ä½éå |
| | | * @param requestType ç±»å |
| | | * @return ElectricThreePhaseVo |
| | | * @Date 14:27 2022/5/30 |
| | | **/ |
| | | @Override |
| | | public ElectricThreePhaseVO list(String timeType, String timeCode, List<EnergyIndex> energyIndexList, String requestType, String meterId) { |
| | | ElectricThreePhaseVO vo = new ElectricThreePhaseVO(); |
| | | if (ObjectUtil.isEmpty(energyIndexList)) { |
| | | return vo; |
| | | } |
| | | // è·åçµåä¸å¹³è¡¡æ°æ® |
| | | if (CommonConst.STR_NUMBER_0.equals(requestType)) { |
| | | energyIndexList = energyIndexList.stream() |
| | | .filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getCode()).trim().endsWith(CommonConst.TAG_CODE_VOLTAGE_A) |
| | | || StringUtil.ifEmptyOrNullReturnValue(x.getCode()).trim().endsWith(CommonConst.TAG_CODE_VOLTAGE_B) |
| | | || StringUtil.ifEmptyOrNullReturnValue(x.getCode()).trim().endsWith(CommonConst.TAG_CODE_VOLTAGE_C)).collect(Collectors.toList()); |
| | | } else { |
| | | energyIndexList = energyIndexList.stream() |
| | | .filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getCode()).trim().endsWith(CommonConst.TAG_CODE_CURRENT_A) |
| | | || StringUtil.ifEmptyOrNullReturnValue(x.getCode()).trim().endsWith(CommonConst.TAG_CODE_CURRENT_B) |
| | | || StringUtil.ifEmptyOrNullReturnValue(x.getCode()).trim().endsWith(CommonConst.TAG_CODE_CURRENT_C)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | List<String> tagCodeList = energyIndexList.stream().map(EnergyIndex::getCode).collect(Collectors.toList()); |
| | | tagCodeList.add(CommonConst.STR_NUMBER_MINUS_ONE); |
| | | String tagCodes = String.join(StrUtil.COMMA, tagCodeList); |
| | | |
| | | Date start = ChartUtils.getDateTime(timeType, timeCode); |
| | | Date end = getEndTime(timeType, start); |
| | | |
| | | DateTime begin = new DateTime(start); |
| | | DateTime finish = new DateTime(end); |
| | | long millis = new Duration(begin, finish).getMillis(); |
| | | int pointCount = IntegerUtil.toInt(millis / CommonConst.DIGIT_3600 / CommonConst.DIGIT_1000); |
| | | |
| | | List<TagValue> tagValueList = realtimeDatabaseService.retrieve(tagCodes, start, end, pointCount); |
| | | List<ElectricThreePhaseItem> itemList = new ArrayList<>(); |
| | | List<Date> dateList = new ArrayList<>(); |
| | | ChartUtils.generateDateList(timeType, timeCode, dateList); |
| | | ElectricThreePhaseTempModel tempModel = new ElectricThreePhaseTempModel(); |
| | | |
| | | Date now = new Date(); |
| | | for (Date date : dateList) { |
| | | Date tempDate = date; |
| | | Date temNow = now; |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | tempDate = DateTimeUtil.addHours(date, CommonConst.DIGIT_1); |
| | | //å½åæ¶é´è½¬ææ´æ¶æ´ç¹ |
| | | temNow = DateTimeUtil.getHourTime(TimeTypeConst.TIME_TYPE_HOUR, now); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | tempDate = date; |
| | | //å½åæ¶é´è½¬ææ´æ¶æ´ç¹ |
| | | temNow = DateTimeUtil.getHourTime(TimeTypeConst.TIME_TYPE_DAY, now); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | tempDate = date; |
| | | temNow = DateTimeUtil.getHourTime(TimeTypeConst.TIME_TYPE_MONTH, now); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | MeterImplement meterImplement = meterImplementMapper.selectById(meterId); |
| | | |
| | | ElectricThreePhaseItem temp = new ElectricThreePhaseItem(); |
| | | if (ObjectUtil.isNotEmpty(meterImplement)) { |
| | | temp.setName(meterImplement.getMeterName()); |
| | | } |
| | | temp.setTimeCode(ChartUtils.getTimeCode(timeType, date)); |
| | | temp.setTimeCodeChart(ChartUtils.getTimeCodeChart(timeType, date)); |
| | | temp.setValueA(CommonConst.DOUBLE_MINUS_SIGN); |
| | | temp.setValueB(CommonConst.DOUBLE_MINUS_SIGN); |
| | | temp.setValueC(CommonConst.DOUBLE_MINUS_SIGN); |
| | | itemList.add(temp); |
| | | // 妿大äºå½åæ¶é´é»è®¤-- |
| | | if (DateTimeUtil.compareDateDiff(date, temNow) > CommonConst.DIGIT_0) { |
| | | continue; |
| | | } |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | // æé å½å¤©æ¯ä¸ªå°æ¶çæ°æ® |
| | | listDayData(tempDate, tagValueList, temp, tempModel); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | // æé 彿æ¯å¤©çæ°æ® |
| | | listMonthData(tempDate, tagValueList, temp, tempModel); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | // æé å½å¹´æ¯æçæ°æ® |
| | | listYearData(tempDate, tagValueList, temp, tempModel); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (ObjectUtil.isEmpty(tempModel.getMin()) || CommonConst.MIN_INIT_VALUE == tempModel.getMin()) { |
| | | tempModel.setMin(null); |
| | | } |
| | | //è®¾ç½®å¼ |
| | | ElectricThreePhaseDetail detail = new ElectricThreePhaseDetail(); |
| | | BeanUtils.copyProperties(tempModel, detail); |
| | | detail.setMax(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setMaxTime(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setValueMaxA(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setValueMaxB(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setValueMaxC(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setMin(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setMinTime(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setValueMinA(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setValueMinB(CommonConst.DOUBLE_MINUS_SIGN); |
| | | detail.setValueMinC(CommonConst.DOUBLE_MINUS_SIGN); |
| | | if (ObjectUtil.isNotNull(tempModel.getMax())) { |
| | | detail.setMax(DoubleUtil.formatDoubleToStr(tempModel.getMax()) + CommonConst.SYMBOL_PERCENT); |
| | | detail.setMaxTime(DateTimeUtil.getDateTime(tempModel.getMaxTime())); |
| | | detail.setValueMaxA(DoubleUtil.formatDoubleToStr(tempModel.getValueMaxA())); |
| | | detail.setValueMaxB(DoubleUtil.formatDoubleToStr(tempModel.getValueMaxB())); |
| | | detail.setValueMaxC(DoubleUtil.formatDoubleToStr(tempModel.getValueMaxC())); |
| | | } |
| | | if (ObjectUtil.isNotNull(tempModel.getMin())) { |
| | | detail.setMin(DoubleUtil.formatDoubleToStr(tempModel.getMin()) + CommonConst.SYMBOL_PERCENT); |
| | | detail.setMinTime(DateTimeUtil.getDateTime(tempModel.getMinTime())); |
| | | detail.setValueMinA(DoubleUtil.formatDoubleToStr(tempModel.getValueMinA())); |
| | | detail.setValueMinB(DoubleUtil.formatDoubleToStr(tempModel.getValueMinB())); |
| | | detail.setValueMinC(DoubleUtil.formatDoubleToStr(tempModel.getValueMinC())); |
| | | } |
| | | vo.setDetail(detail); |
| | | vo.setItemList(itemList); |
| | | return vo; |
| | | } |
| | | |
| | | /** |
| | | * æé å½æçæ°æ®å表 |
| | | * |
| | | * @param date |
| | | * @param tagValueList |
| | | * @param temp |
| | | * @param tempModel |
| | | */ |
| | | private void listYearData(Date date, List<TagValue> tagValueList, ElectricThreePhaseItem temp, ElectricThreePhaseTempModel tempModel) { |
| | | List<Date> dateList = new ArrayList<>(); |
| | | ChartUtils.generateDateList(TimeTypeConst.TIME_TYPE_MONTH, DateTimeUtil.getDateTime(date, DateTimeUtil.COMMON_PATTERN_TO_MONTH), dateList); |
| | | ElectricThreePhaseTempModel tempModelMonth = new ElectricThreePhaseTempModel(); |
| | | for (Date date1 : dateList) { |
| | | listMonthData(date1, tagValueList, temp, tempModelMonth); |
| | | temp.setMax(CommonConst.DOUBLE_MINUS_SIGN); |
| | | temp.setMin(CommonConst.DOUBLE_MINUS_SIGN); |
| | | if (ObjectUtil.isNotNull(tempModelMonth.getMax())) { |
| | | temp.setMax(DoubleUtil.formatDoubleToStr(tempModelMonth.getMax())); |
| | | } |
| | | if (ObjectUtil.isNotNull(tempModelMonth.getMin())) { |
| | | temp.setMin(DoubleUtil.formatDoubleToStr(tempModelMonth.getMin())); |
| | | } |
| | | if (ObjectUtil.isEmpty(tempModel.getMin()) || CommonConst.MIN_INIT_VALUE == tempModel.getMin()) { |
| | | tempModel.setMin(null); |
| | | } |
| | | if (ObjectUtil.isNotNull(tempModelMonth.getMax())) { |
| | | if (ObjectUtil.isNull(tempModel.getMax()) || (ObjectUtil.isNotNull(tempModel.getMax()) && tempModelMonth.getMax() > tempModel.getMax())) { |
| | | tempModel.setMax(DoubleUtil.formatDouble(tempModelMonth.getMax())); |
| | | tempModel.setMaxTime(tempModelMonth.getMaxTime()); |
| | | tempModel.setValueMaxA(DoubleUtil.formatDouble(tempModelMonth.getValueMaxA())); |
| | | tempModel.setValueMaxB(DoubleUtil.formatDouble(tempModelMonth.getValueMaxB())); |
| | | tempModel.setValueMaxC(DoubleUtil.formatDouble(tempModelMonth.getValueMaxC())); |
| | | } |
| | | } |
| | | if (ObjectUtil.isNotNull(tempModelMonth.getMin())) { |
| | | if (ObjectUtil.isNull(tempModel.getMin()) || (ObjectUtil.isNotNull(tempModel.getMin()) && tempModelMonth.getMin() <= tempModel.getMin())) { |
| | | tempModel.setMin(DoubleUtil.formatDouble(tempModelMonth.getMin())); |
| | | tempModel.setMinTime(tempModelMonth.getMinTime()); |
| | | tempModel.setValueMinA(DoubleUtil.formatDouble(tempModelMonth.getValueMinA())); |
| | | tempModel.setValueMinB(DoubleUtil.formatDouble(tempModelMonth.getValueMinB())); |
| | | tempModel.setValueMinC(DoubleUtil.formatDouble(tempModelMonth.getValueMinC())); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æé å½æçæ°æ®å表 |
| | | * |
| | | * @param date |
| | | * @param tagValueList |
| | | * @param temp |
| | | * @param tempModel |
| | | */ |
| | | private void listMonthData(Date date, List<TagValue> tagValueList, ElectricThreePhaseItem temp, ElectricThreePhaseTempModel tempModel) { |
| | | List<Date> dateList = new ArrayList<>(); |
| | | ChartUtils.generateDateList(TimeTypeConst.TIME_TYPE_DAY, DateTimeUtil.getDateTime(date, DateTimeUtil.COMMON_PATTERN_TO_DAY), dateList); |
| | | ElectricThreePhaseTempModel tempModelDay = new ElectricThreePhaseTempModel(); |
| | | for (Date date1 : dateList) { |
| | | Date tempDate = DateTimeUtil.addHours(date1, CommonConst.DIGIT_1); |
| | | listDayData(tempDate, tagValueList, temp, tempModelDay); |
| | | temp.setMax(CommonConst.DOUBLE_MINUS_SIGN); |
| | | temp.setMin(CommonConst.DOUBLE_MINUS_SIGN); |
| | | if (ObjectUtil.isNotNull(tempModelDay.getMax())) { |
| | | temp.setMax(DoubleUtil.formatDoubleToStr(tempModelDay.getMax())); |
| | | } |
| | | if (ObjectUtil.isNotNull(tempModelDay.getMin())) { |
| | | temp.setMin(DoubleUtil.formatDoubleToStr(tempModelDay.getMin())); |
| | | } |
| | | if (ObjectUtil.isEmpty(tempModel.getMin()) || CommonConst.MIN_INIT_VALUE == tempModel.getMin()) { |
| | | tempModel.setMin(null); |
| | | } |
| | | if (ObjectUtil.isNotNull(tempModelDay.getMax())) { |
| | | if (ObjectUtil.isNull(tempModel.getMax()) || (ObjectUtil.isNotNull(tempModel.getMax()) && tempModelDay.getMax() > tempModel.getMax())) { |
| | | tempModel.setMax(DoubleUtil.formatDouble(tempModelDay.getMax())); |
| | | tempModel.setMaxTime(tempModelDay.getMaxTime()); |
| | | tempModel.setValueMaxA(DoubleUtil.formatDouble(tempModelDay.getValueMaxA())); |
| | | tempModel.setValueMaxB(DoubleUtil.formatDouble(tempModelDay.getValueMaxB())); |
| | | tempModel.setValueMaxC(DoubleUtil.formatDouble(tempModelDay.getValueMaxC())); |
| | | } |
| | | } |
| | | if (ObjectUtil.isNotNull(tempModelDay.getMin())) { |
| | | if (ObjectUtil.isNull(tempModel.getMin()) || (ObjectUtil.isNotNull(tempModel.getMin()) && tempModelDay.getMin() <= tempModel.getMin())) { |
| | | tempModel.setMin(DoubleUtil.formatDouble(tempModelDay.getMin())); |
| | | tempModel.setMinTime(tempModelDay.getMinTime()); |
| | | tempModel.setValueMinA(DoubleUtil.formatDouble(tempModelDay.getValueMinA())); |
| | | tempModel.setValueMinB(DoubleUtil.formatDouble(tempModelDay.getValueMinB())); |
| | | tempModel.setValueMinC(DoubleUtil.formatDouble(tempModelDay.getValueMinC())); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åå½å¤©çæ°æ®å表 |
| | | * |
| | | * @param date |
| | | * @param tagValueList |
| | | * @param tempModel |
| | | */ |
| | | private void listDayData(Date date, List<TagValue> tagValueList, ElectricThreePhaseItem temp, ElectricThreePhaseTempModel tempModel) { |
| | | Date endTime = DateTimeUtil.addHours(date, CommonConst.DIGIT_1); |
| | | List<TagValue> currentTagValueList = tagValueList.stream().filter(x -> DateTimeUtil.compareDateDiff(date, x.getDataTime()) <= 0 && DateTimeUtil.compareDateDiff(endTime, x.getDataTime()) > 0).collect(Collectors.toList()); |
| | | List<TagValue> currentATagValueList = currentTagValueList.stream().filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getTagCode()).trim().endsWith("_A")).collect(Collectors.toList()); |
| | | List<TagValue> currentBTagValueList = currentTagValueList.stream().filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getTagCode()).trim().endsWith("_B")).collect(Collectors.toList()); |
| | | List<TagValue> currentCTagValueList = currentTagValueList.stream().filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getTagCode()).trim().endsWith("_C")).collect(Collectors.toList()); |
| | | TagValue tagValueA = currentATagValueList.stream().filter(x -> DateTimeUtil.compareDateDiff(date, x.getDataTime()) == 0).findAny().orElse(null); |
| | | TagValue tagValueB = currentBTagValueList.stream().filter(x -> DateTimeUtil.compareDateDiff(date, x.getDataTime()) == 0).findAny().orElse(null); |
| | | TagValue tagValueC = currentCTagValueList.stream().filter(x -> DateTimeUtil.compareDateDiff(date, x.getDataTime()) == 0).findAny().orElse(null); |
| | | Double valueA = null, valueB = null, valueC = null; |
| | | if (ObjectUtil.isNotEmpty(tagValueA)) { |
| | | valueA = tagValueA.getValue(); |
| | | temp.setValueA(String.valueOf(DoubleUtil.formatDouble(tagValueA.getValue()))); |
| | | } else { |
| | | temp.setValueA(CommonConst.DOUBLE_MINUS_SIGN); |
| | | } |
| | | if (!ObjectUtil.isEmpty(tagValueB)) { |
| | | valueB = tagValueB.getValue(); |
| | | temp.setValueB(String.valueOf(DoubleUtil.formatDouble(tagValueB.getValue()))); |
| | | } else { |
| | | temp.setValueB(CommonConst.DOUBLE_MINUS_SIGN); |
| | | } |
| | | if (!ObjectUtil.isEmpty(tagValueC)) { |
| | | valueC = tagValueC.getValue(); |
| | | temp.setValueC(String.valueOf(DoubleUtil.formatDouble(tagValueC.getValue()))); |
| | | } else { |
| | | temp.setValueC(CommonConst.DOUBLE_MINUS_SIGN); |
| | | } |
| | | Double value = calcUnbalanceValue(valueA, valueB, valueC); |
| | | if (ObjectUtil.isEmpty(value)) { |
| | | return; |
| | | } |
| | | if (ObjectUtil.isEmpty(tempModel.getMin()) || CommonConst.MIN_INIT_VALUE == tempModel.getMin()) { |
| | | tempModel.setMin(value); |
| | | } |
| | | if (ObjectUtil.isEmpty(tempModel.getMax()) || value > tempModel.getMax()) { |
| | | tempModel.setMax(DoubleUtil.formatDouble(value)); |
| | | if (!ObjectUtil.isEmpty(tagValueA)) { |
| | | tempModel.setMaxTime(tagValueA.getDataTime()); |
| | | } |
| | | tempModel.setValueMaxA(DoubleUtil.formatDouble(valueA)); |
| | | tempModel.setValueMaxB(DoubleUtil.formatDouble(valueB)); |
| | | tempModel.setValueMaxC(DoubleUtil.formatDouble(valueC)); |
| | | } |
| | | if (ObjectUtil.isEmpty(tempModel.getMin()) || value <= tempModel.getMin()) { |
| | | tempModel.setMin(DoubleUtil.formatDouble(value)); |
| | | tempModel.setValueMinA(DoubleUtil.formatDouble(valueA)); |
| | | tempModel.setValueMinB(DoubleUtil.formatDouble(valueB)); |
| | | tempModel.setValueMinC(DoubleUtil.formatDouble(valueC)); |
| | | if (!ObjectUtil.isEmpty(tagValueA)) { |
| | | tempModel.setMinTime(tagValueA.getDataTime()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 计ç®ä¸ç¸ä¸å¹³è¡¡æå¼ |
| | | * |
| | | * @param valueA |
| | | * @param valueB |
| | | * @param valueC |
| | | * @return |
| | | */ |
| | | private Double calcUnbalanceValue(Double valueA, Double valueB, Double valueC) { |
| | | /** |
| | | * 1ã计ç®ä¸ç¸å¹³åçµæµï¼A/B/Cä¸ç¸çµæµç¸å é¤ä»¥3 |
| | | * 2ã MAXï¼ç¸çµæµ-ä¸ç¸å¹³åçµæµï¼/ä¸ç¸å¹³åçµæµï¼ |
| | | * æ¯å¦ä¸ç¸çµæµåå«ä¸ºIA=9A IB=8A IC=4Aï¼åä¸ç¸å¹³åçµæµä¸º7Aï¼ç¸çµæµ-ä¸ç¸å¹³åçµæµåå«ä¸º2A 1A 3Aï¼å差弿大é£ä¸ªï¼æ
MAXï¼ç¸çµæµ-ä¸ç¸å¹³åçµæµï¼=3Aï¼æä»¥ä¸ç¸çµæµä¸å¹³è¡¡åº¦=3/7ã |
| | | */ |
| | | Double result = null; |
| | | Double sum = null; |
| | | if (ObjectUtil.isNotNull(valueA)) { |
| | | sum = valueA; |
| | | } |
| | | if (ObjectUtil.isNotNull(valueB)) { |
| | | sum += valueB; |
| | | } |
| | | if (ObjectUtil.isNotNull(valueC)) { |
| | | sum += valueC; |
| | | } |
| | | if (ObjectUtil.isNotNull(sum)) { |
| | | double avg = sum / CommonConst.DIGIT_3; |
| | | double diff1 = 0, diff2 = 0, diff3 = 0; |
| | | if (ObjectUtil.isNotNull(valueA)) { |
| | | diff1 = Math.abs(valueA - avg); |
| | | } |
| | | if (ObjectUtil.isNotNull(valueB)) { |
| | | diff2 = Math.abs(valueB - avg); |
| | | } |
| | | if (ObjectUtil.isNotNull(valueC)) { |
| | | diff3 = Math.abs(valueC - avg); |
| | | } |
| | | double max = diff1; |
| | | if (diff2 > max) { |
| | | max = diff2; |
| | | } |
| | | if (diff3 > max) { |
| | | max = diff3; |
| | | } |
| | | if (avg != CommonConst.DIGIT_DOUBLE_0) { |
| | | result = max * CommonConst.DIGIT_DOUBLE_100 / avg; |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * è·å对åºçç»ææ¶é´ |
| | | * |
| | | * @param timeType |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static Date getEndTime(String timeType, Date date) { |
| | | Date d1 = null; |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | d1 = DateTimeUtil.addDays(date, CommonConst.DIGIT_1); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | d1 = DateTimeUtil.addMonths(date, CommonConst.DIGIT_1); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | d1 = DateTimeUtil.addYears(date, CommonConst.DIGIT_1); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return d1; |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public List<HomeEnergyStatisticsVO> energyConsumptionSummation(String timeType, String modelcode) { |
| | | Date currentTime = new Date(); |
| | | // Date currentTime = DateUtil.parseDateTime("2023-04-11 00:00:00"); |
| | | |
| | | DateTime tongbiTime = DateUtil.offsetMonth(currentTime, -12); |
| | | DateTime huanbiTime = DateUtil.offsetMonth(currentTime, -1); |
| | | if(TimeType.DAY.name().equals( timeType)){ |
| | | huanbiTime = DateUtil.offsetDay(currentTime, -1); |
| | | } |
| | | |
| | | final List<HomeEnergyStatisticsVO> current = getEnergyTotalByTime(timeType, modelcode, currentTime); |
| | | final List<HomeEnergyStatisticsVO> tongbi = getEnergyTotalByTime(timeType, modelcode, tongbiTime); |
| | | final List<HomeEnergyStatisticsVO> huanbi = getEnergyTotalByTime(timeType, modelcode, huanbiTime); |
| | |
| | | |
| | | @ApiModelProperty(value = "表计id") |
| | | private String meterId; |
| | | |
| | | @ApiModelProperty(value = "顺åºå·") |
| | | @Excel(name = "顺åºå·") |
| | | private int orderNum; |
| | | |
| | | @ApiModelProperty(value = "") |
| | | private String equipment; |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String energyId; |
| | | |
| | | @Transient |
| | | @TableField(exist = false) |
| | | private String meterName; |
| | | |
| | | public void setIndexId(String indexId) { |
| | | this.indexId = indexId; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.model.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 模åèç¹ä¸ææ çå
³èå
³ç³»(NodeIndex)å®ä½ç±» |
| | | * |
| | | * @author makejava |
| | | * @since 2025-02-10 15:08:14 |
| | | */ |
| | | @Data |
| | | public class NodeIndex implements Serializable { |
| | | private static final long serialVersionUID = 386292923712960012L; |
| | | /** |
| | | * èç¹ä¸»é® |
| | | */ |
| | | private String nodeId; |
| | | /** |
| | | * ææ ä¸»é® |
| | | */ |
| | | private String indexId; |
| | | |
| | | } |
| | | |
| | |
| | | import com.zhitan.basicdata.domain.MeterImplement; |
| | | import com.zhitan.basicdata.domain.SysEnergy; |
| | | import com.zhitan.basicdata.domain.SysProduct; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.dataitem.domain.vo.NodeIndexValueVO; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | ModelNode getFirstModeNodeInfo(String modelCode); |
| | | |
| | | List<ModelNodeIndexInfor> selectIndexByNodeIds(@Param("modelCode") String modelCode,@Param("nodeIds") List<String> nodeIds); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¶èç¹idåè½æºç±»åæ¥è¯¢ç¹ä½ä¸ç累积é |
| | | */ |
| | | List<NodeIndexValueVO> getDataItemByParentNodeId(@Param("parentId") String parentId, |
| | | @Param("energyType") String energyType, |
| | | @Param("timeType") TimeType timeType, |
| | | @Param("dateTimeMap") Map<String, LocalDateTime> dateTimeMap); |
| | | |
| | | /** |
| | | * æ ¹æ®èç¹idåè½æºç±»åæ¥è¯¢ç¹ä½ä¸ç累积é |
| | | */ |
| | | List<NodeIndexValueVO> getDataItemByNodeId(@Param("nodeId") String nodeId, |
| | | @Param("energyType") String energyType, |
| | | @Param("timeType") TimeType timeType, |
| | | @Param("dateTimeMap") Map<String, LocalDateTime> dateTimeMap); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.model.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zhitan.model.domain.NodeIndex; |
| | | |
| | | /** |
| | | * 模åèç¹ä¸ææ çå
³èå
³ç³»(NodeIndex)è¡¨æ°æ®åºè®¿é®å± |
| | | * |
| | | * @author makejava |
| | | * @since 2025-02-10 15:09:17 |
| | | */ |
| | | public interface NodeIndexMapper extends BaseMapper<NodeIndex> { |
| | | |
| | | } |
| | | |
| | |
| | | * @author fanxinfu |
| | | * @date 2020-02-14 |
| | | */ |
| | | public interface IEnergyIndexService { |
| | | public interface IEnergyIndexService { |
| | | |
| | | EnergyIndex getiEnergyIndexByCode(String code); |
| | | EnergyIndex getiEnergyIndexByCode(String code); |
| | | |
| | | /** |
| | | * æ ¹æ®è®¡éå¨å
·idéåæ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | * |
| | | * @param meterId 计éå¨å
·idéå |
| | | * @return |
| | | */ |
| | | List<EnergyIndex> listIndexByMeterIds(String nodeId,List<String> meterId); |
| | | /** |
| | | * æ ¹æ®è®¡éå¨å
·idéåæ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | * |
| | | * @param meterId 计éå¨å
·idéå |
| | | * @return |
| | | */ |
| | | List<EnergyIndex> listIndexByMeterIds(String nodeId, List<String> meterId); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ ä¿¡æ¯ |
| | | * |
| | | * @param indexId ææ ä¿¡æ¯ID |
| | | * @return ææ ä¿¡æ¯ |
| | | */ |
| | | EnergyIndex selectEnergyIndexById(String indexId); |
| | | /** |
| | | * æ¥è¯¢ææ ä¿¡æ¯ |
| | | * |
| | | * @param indexId ææ ä¿¡æ¯ID |
| | | * @return ææ ä¿¡æ¯ |
| | | */ |
| | | EnergyIndex selectEnergyIndexById(String indexId); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ ä¿¡æ¯ |
| | | * |
| | | * @param indexId ææ ä¿¡æ¯ID |
| | | * @return ææ ä¿¡æ¯ |
| | | */ |
| | | List<EnergyIndex> selectEnergyIndexByIds(List<String> indexId); |
| | | /** |
| | | * æ¥è¯¢ææ ä¿¡æ¯ |
| | | * |
| | | * @param indexId ææ ä¿¡æ¯ID |
| | | * @return ææ ä¿¡æ¯ |
| | | */ |
| | | List<EnergyIndex> selectEnergyIndexByIds(List<String> indexId); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ ä¿¡æ¯å表 |
| | | * |
| | | * @param energyIndex ææ ä¿¡æ¯ |
| | | * @return ææ ä¿¡æ¯éå |
| | | */ |
| | | List<EnergyIndex> selectEnergyIndexList(EnergyIndex energyIndex); |
| | | /** |
| | | * æ¥è¯¢ææ ä¿¡æ¯å表 |
| | | * |
| | | * @param energyIndex ææ ä¿¡æ¯ |
| | | * @return ææ ä¿¡æ¯éå |
| | | */ |
| | | List<EnergyIndex> selectEnergyIndexList(EnergyIndex energyIndex); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ ä¿¡æ¯å表 |
| | | * |
| | | * @param query ææ ä¿¡æ¯ |
| | | * @return ææ ä¿¡æ¯éå |
| | | */ |
| | | List<EnergyIndex> selectEnergyIndexList(EnergyIndexQuery query); |
| | | /** |
| | | * æ¥è¯¢ææ ä¿¡æ¯å表 |
| | | * |
| | | * @param query ææ ä¿¡æ¯ |
| | | * @return ææ ä¿¡æ¯éå |
| | | */ |
| | | List<EnergyIndex> selectEnergyIndexList(EnergyIndexQuery query); |
| | | |
| | | /** |
| | | * æ°å¢ææ ä¿¡æ¯ |
| | | * |
| | | * @param nodeId |
| | | * @param energyIndex ææ ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | int insertEnergyIndex(String nodeId, EnergyIndex energyIndex); |
| | | /** |
| | | * æ°å¢ææ ä¿¡æ¯ |
| | | * |
| | | * @param nodeId |
| | | * @param energyIndex ææ ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | int insertEnergyIndex(String nodeId, EnergyIndex energyIndex); |
| | | |
| | | /** |
| | | * ä¿®æ¹ææ ä¿¡æ¯ |
| | | * |
| | | * @param energyIndex ææ ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | int updateEnergyIndex(EnergyIndex energyIndex); |
| | | /** |
| | | * ä¿®æ¹ææ ä¿¡æ¯ |
| | | * |
| | | * @param energyIndex ææ ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | int updateEnergyIndex(EnergyIndex energyIndex); |
| | | |
| | | /** |
| | | * æ¹éå 餿æ ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param nodeId |
| | | * @param indexIds éè¦å é¤çææ ä¿¡æ¯ID |
| | | * @return ç»æ |
| | | */ |
| | | int deleteEnergyIndexByIds(String nodeId, String[] indexIds); |
| | | /** |
| | | * æ¹éå 餿æ ä¿¡æ¯ |
| | | * |
| | | * @param nodeId |
| | | * @param indexIds éè¦å é¤çææ ä¿¡æ¯ID |
| | | * @return ç»æ |
| | | */ |
| | | int deleteEnergyIndexByIds(String nodeId, String[] indexIds); |
| | | |
| | | boolean energyIndexHasExist(String code); |
| | | boolean energyIndexHasExist(String code); |
| | | |
| | | boolean energyIndexHasExist(String indexId, String code); |
| | | boolean energyIndexHasExist(String indexId, String code); |
| | | |
| | | AjaxResult addMeterIndex(String meterId); |
| | | AjaxResult addMeterIndex(String meterId); |
| | | |
| | | List<EnergyIndex> getMeterIndex(String meterId); |
| | | List<EnergyIndex> getMeterIndex(String meterId); |
| | | |
| | | boolean modelHasConfig(String modelCode); |
| | | boolean modelHasConfig(String modelCode); |
| | | |
| | | List<EnergyIndex> selectCollectIndex(String deviceId); |
| | | List<EnergyIndex> selectCollectIndex(String deviceId); |
| | | |
| | | List<EnergyIndex> getEnergyIndexByIds(List<String> indexIds); |
| | | List<EnergyIndex> getEnergyIndexByIds(List<String> indexIds); |
| | | |
| | | List<EnergyIndex> getEnergyIndexByCodes(List<String> indexCodes); |
| | | List<EnergyIndex> getEnergyIndexByCodes(List<String> indexCodes); |
| | | |
| | | List<EnergyIndex> getIndexByNodeAndChildrenNode(String nodeId); |
| | | List<EnergyIndex> getIndexByNodeAndChildrenNode(String nodeId); |
| | | |
| | | List<EnergyIndex> searchIndexByNodeAndChildrenNode(String nodeId, String filter); |
| | | List<EnergyIndex> searchIndexByNodeAndChildrenNode(String nodeId, String filter); |
| | | |
| | | void removeNodeIndex(String nodeId, List<String> removeLink); |
| | | void removeNodeIndex(String nodeId, List<String> removeLink); |
| | | |
| | | AjaxResult importEnergyIndex(List<EnergyIndex> energyIndexList, boolean updateSupport); |
| | | AjaxResult importEnergyIndex(List<EnergyIndex> energyIndexList, boolean updateSupport); |
| | | |
| | | List<EnergyIndex> getEnergyIndexMeterByCodes(List<String> indexCodes); |
| | | List<EnergyIndex> getEnergyIndexMeterByCodes(List<String> indexCodes); |
| | | |
| | | Page<EnergyIndex> selectEnergyIndexPage(EnergyIndexQuery query, Long pageNum, Long pageSize); |
| | | Page<EnergyIndex> selectEnergyIndexPage(EnergyIndexQuery query, Long pageNum, Long pageSize); |
| | | |
| | | Page<EnergyIndex> getMeterIndexList(List<String> meterIndexIds,String code, |
| | | String name,Long pageNum, Long pageSize); |
| | | Page<EnergyIndex> getMeterIndexList(List<String> meterIndexIds, String code, |
| | | String name, Long pageNum, Long pageSize); |
| | | |
| | | List<EnergyIndex> getIndexByCode(String code,String nodeId); |
| | | List<EnergyIndex> getIndexByCode(String code, String nodeId); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨è½åå
idå设å¤idï¼ä»¥åç¹ä½ç¼ç è·åç¹ä½ |
| | | * |
| | | * @param nodeId èç¹id |
| | | * @param meterId 设å¤id |
| | | * @param indexCode ç¹ä½ç¼ç æè
ç¹ä½ç¼ç çä¸é¨å |
| | | * @return |
| | | */ |
| | | EnergyIndex getDeviceIndexByCode(String nodeId, String meterId, String indexCode); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨è½åå
idå设å¤idï¼ä»¥åç¹ä½ç¼ç è·åç¹ä½ |
| | | * |
| | | * @param nodeId èç¹id |
| | | * @param meterId 设å¤id |
| | | * @return |
| | | */ |
| | | List<EnergyIndex> listDeviceIndex(String nodeId, String meterId); |
| | | } |
| | |
| | | package com.zhitan.model.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.basicdata.domain.MeterImplement; |
| | | import com.zhitan.basicdata.services.IMeterImplementService; |
| | |
| | | import com.zhitan.model.service.IEnergyIndexService; |
| | | import com.zhitan.model.service.IModelNodeService; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Service |
| | | public class EnergyIndexServiceImpl implements IEnergyIndexService { |
| | | |
| | | @Autowired |
| | | private EnergyIndexMapper energyIndexMapper; |
| | | @Autowired |
| | | private IDaqTemplateService daqTemplateService; |
| | | @Autowired |
| | | private IMeterImplementService meterImplementService; |
| | | @Autowired |
| | | private IModelNodeService modelNodeService; |
| | | @Autowired |
| | | private EnergyIndexMapper energyIndexMapper; |
| | | @Autowired |
| | | private IDaqTemplateService daqTemplateService; |
| | | @Autowired |
| | | private IMeterImplementService meterImplementService; |
| | | @Autowired |
| | | private IModelNodeService modelNodeService; |
| | | |
| | | @Autowired |
| | | private ModelNodeMapper modelNodeMapper; |
| | | @Autowired |
| | | private ModelNodeMapper modelNodeMapper; |
| | | |
| | | @Override |
| | | public EnergyIndex getiEnergyIndexByCode(String code) { |
| | | return energyIndexMapper.getiEnergyIndexByCode(code); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> listIndexByMeterIds(String nodeId, List<String> meterId) { |
| | | return energyIndexMapper.listIndexByMeterIds(nodeId,meterId); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ ä¿¡æ¯ |
| | | * |
| | | * @param indexId ææ ä¿¡æ¯ID |
| | | * @return ææ ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public EnergyIndex selectEnergyIndexById(String indexId) { |
| | | return energyIndexMapper.selectEnergyIndexById(indexId); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> selectEnergyIndexByIds(List<String> indexId) { |
| | | if (CollectionUtils.isEmpty(indexId)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return energyIndexMapper.selectEnergyIndexByIds(indexId); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> selectEnergyIndexList(EnergyIndex energyIndex) { |
| | | return energyIndexMapper.selectEnergyIndexList(energyIndex); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ ä¿¡æ¯å表 |
| | | * |
| | | * @param energyIndex ææ ä¿¡æ¯ |
| | | * @return ææ ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public List<EnergyIndex> selectEnergyIndexList(EnergyIndexQuery query) { |
| | | return energyIndexMapper.selectEnergyIndex(query); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ææ ä¿¡æ¯ |
| | | * |
| | | * @param nodeId |
| | | * @param energyIndex ææ ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertEnergyIndex(String nodeId, EnergyIndex energyIndex) { |
| | | energyIndex.setNodeId(nodeId); |
| | | energyIndexMapper.insertEnergyIndex( energyIndex); |
| | | return energyIndexMapper.insertNodeIndex(nodeId,energyIndex.getIndexId()); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ææ ä¿¡æ¯ |
| | | * |
| | | * @param energyIndex ææ ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateEnergyIndex(EnergyIndex energyIndex) { |
| | | return energyIndexMapper.updateEnergyIndex(energyIndex); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå 餿æ ä¿¡æ¯ |
| | | * |
| | | * @param nodeId |
| | | * @param indexIds éè¦å é¤çææ ä¿¡æ¯ID |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteEnergyIndexByIds(String nodeId, String[] indexIds) { |
| | | return energyIndexMapper.deleteEnergyIndexByIds(nodeId, indexIds); |
| | | } |
| | | |
| | | @Override |
| | | public boolean energyIndexHasExist(String code) { |
| | | int count = energyIndexMapper.energyIndexHasExist(code); |
| | | return count > 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean energyIndexHasExist(String indexId, String code) { |
| | | int count = energyIndexMapper.energyIndexHasExistWhenUpdate(indexId, code); |
| | | return count > 0; |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult addMeterIndex(String meterId) { |
| | | MeterImplement meterImplement = meterImplementService.selectMeterImplementById(meterId); |
| | | if (meterImplement == null) { |
| | | return AjaxResult.error("æ¾ä¸å°å¯¹åºç计éå¨å
·ï¼"); |
| | | @Override |
| | | public EnergyIndex getiEnergyIndexByCode(String code) { |
| | | return energyIndexMapper.getiEnergyIndexByCode(code); |
| | | } |
| | | |
| | | DaqTemplate query = new DaqTemplate(); |
| | | query.setDeviceType(meterImplement.getMeterType()); |
| | | List<DaqTemplate> daqTemplates = daqTemplateService.selectDaqTemplateList(query); |
| | | if (daqTemplates.isEmpty()) { |
| | | return AjaxResult.error("计éå¨å
·æå±çç±»åæ²¡ææ¾å°å¯¹åºç模æ¿ï¼"); |
| | | @Override |
| | | public List<EnergyIndex> listIndexByMeterIds(String nodeId, List<String> meterId) { |
| | | return energyIndexMapper.listIndexByMeterIds(nodeId, meterId); |
| | | } |
| | | |
| | | List<EnergyIndex> energyIndices = new ArrayList<>(); |
| | | daqTemplates.forEach(daqTemplate -> { |
| | | EnergyIndex energyIndex = new EnergyIndex(); |
| | | energyIndex.setIndexId(UUID.randomUUID().toString()); |
| | | energyIndex.setCode(meterImplement.getCode() + "_" + daqTemplate.getCode()); |
| | | energyIndex.setName(daqTemplate.getName()); |
| | | energyIndex.setUnitId(daqTemplate.getUnit()); |
| | | energyIndex.setIndexType(IndexType.COLLECT); |
| | | energyIndex.setMeterId(meterId); |
| | | energyIndices.add(energyIndex); |
| | | }); |
| | | |
| | | energyIndexMapper.deleteIndexByMeterId(meterId); |
| | | energyIndexMapper.insertEnergyIndices(energyIndices); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> getMeterIndex(String meterId) { |
| | | return energyIndexMapper.getMeterIndex(meterId); |
| | | } |
| | | |
| | | @Override |
| | | public boolean modelHasConfig(String modelCode) { |
| | | int count = energyIndexMapper.modelHasConfig(modelCode); |
| | | return count > 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> selectCollectIndex(String deviceId) { |
| | | return energyIndexMapper.selectCollectIndex(deviceId); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> getEnergyIndexByIds(List<String> indexIds) { |
| | | return energyIndexMapper.getEnergyIndexByIds(indexIds); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> getEnergyIndexByCodes(List<String> indexCodes) { |
| | | if (indexCodes.isEmpty()) { |
| | | return new ArrayList<>(); |
| | | /** |
| | | * æ¥è¯¢ææ ä¿¡æ¯ |
| | | * |
| | | * @param indexId ææ ä¿¡æ¯ID |
| | | * @return ææ ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public EnergyIndex selectEnergyIndexById(String indexId) { |
| | | return energyIndexMapper.selectEnergyIndexById(indexId); |
| | | } |
| | | |
| | | return energyIndexMapper.getEnergyIndexByCodes(indexCodes); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> getIndexByNodeAndChildrenNode(String nodeId) { |
| | | return energyIndexMapper.getIndexByNodeAndChildrenNode(nodeId); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> searchIndexByNodeAndChildrenNode(String nodeId, String filter) { |
| | | return energyIndexMapper.searchIndexByNodeAndChildrenNode(nodeId, filter); |
| | | } |
| | | |
| | | @Override |
| | | public void removeNodeIndex(String nodeId, List<String> removeLink) { |
| | | energyIndexMapper.removeNodeIndex(nodeId, removeLink); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult importEnergyIndex(List<EnergyIndex> energyIndexList, boolean updateSupport) { |
| | | List<String> codes = energyIndexList.stream().map(EnergyIndex::getCode) |
| | | .collect(Collectors.toList()); |
| | | List<String> nodeCodes = energyIndexList.stream().map(EnergyIndex::getNodeId) |
| | | .collect(Collectors.toList()); |
| | | List<EnergyIndex> indexList = energyIndexMapper.getEnergyIndexByCodes(codes); |
| | | List<ModelNode> modelNodes = modelNodeService.getModelNodeByNodeCodes(nodeCodes); |
| | | Map<String, String> nodeCodeToId = modelNodes.stream() |
| | | .collect(Collectors.toMap(ModelNode::getCode, ModelNode::getNodeId)); |
| | | Set<String> cacheIndexCodes = indexList.stream().map(EnergyIndex::getCode) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | List<EnergyIndex> insertData = new ArrayList<>(); |
| | | List<EnergyIndex> updateData = new ArrayList<>(); |
| | | List<String> errorNodeCode = new ArrayList<>(); |
| | | List<String> insertIndexCode = new ArrayList<>(); |
| | | AtomicBoolean existDuplicateCode = new AtomicBoolean(false); |
| | | energyIndexList.forEach(energyIndex -> { |
| | | if (cacheIndexCodes.contains(energyIndex.getCode())) { |
| | | updateData.add(energyIndex); |
| | | } else { |
| | | String nodeCode = energyIndex.getNodeId(); |
| | | if (nodeCodeToId.containsKey(nodeCode)) { |
| | | if (!insertIndexCode.contains(energyIndex.getCode())) { |
| | | insertIndexCode.add(energyIndex.getCode()); |
| | | energyIndex.setIndexId(UUID.randomUUID().toString()); |
| | | energyIndex.setNodeId(nodeCodeToId.get(nodeCode)); |
| | | insertData.add(energyIndex); |
| | | } else { |
| | | existDuplicateCode.set(true); |
| | | } |
| | | } else if (!errorNodeCode.contains(nodeCode)) { |
| | | errorNodeCode.add(nodeCode); |
| | | @Override |
| | | public List<EnergyIndex> selectEnergyIndexByIds(List<String> indexId) { |
| | | if (CollectionUtils.isEmpty(indexId)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | if (updateSupport && !updateData.isEmpty()) { |
| | | updateData.forEach(energyIndexMapper::updateEnergyIndex); |
| | | return energyIndexMapper.selectEnergyIndexByIds(indexId); |
| | | } |
| | | |
| | | if (!insertData.isEmpty()) { |
| | | energyIndexMapper.saveEnergyIndex(insertData); |
| | | @Override |
| | | public List<EnergyIndex> selectEnergyIndexList(EnergyIndex energyIndex) { |
| | | return energyIndexMapper.selectEnergyIndexList(energyIndex); |
| | | } |
| | | |
| | | String errMsg = ""; |
| | | if (existDuplicateCode.get()) { |
| | | errMsg += "åå¨éå¤çææ ç¼ç ï¼å·²èªå¨è¿æ»¤ï¼"; |
| | | /** |
| | | * æ¥è¯¢ææ ä¿¡æ¯å表 |
| | | * |
| | | * @return ææ ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public List<EnergyIndex> selectEnergyIndexList(EnergyIndexQuery query) { |
| | | return energyIndexMapper.selectEnergyIndex(query); |
| | | } |
| | | |
| | | if (!errorNodeCode.isEmpty()) { |
| | | errMsg += String.join(",", errorNodeCode) + "æ²¡ææ¾å°å¯¹åºçèç¹æ°æ®ï¼å æ¤å
¶ä¸çææææ 导å
¥å¤±è´¥ï¼"; |
| | | /** |
| | | * æ°å¢ææ ä¿¡æ¯ |
| | | * |
| | | * @param nodeId |
| | | * @param energyIndex ææ ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertEnergyIndex(String nodeId, EnergyIndex energyIndex) { |
| | | energyIndex.setNodeId(nodeId); |
| | | energyIndexMapper.insertEnergyIndex(energyIndex); |
| | | return energyIndexMapper.insertNodeIndex(nodeId, energyIndex.getIndexId()); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(errMsg)) { |
| | | return AjaxResult.error(errMsg); |
| | | } |
| | | return AjaxResult.success("导å
¥æåï¼"); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> getEnergyIndexMeterByCodes(List<String> indexCodes) { |
| | | if (indexCodes.isEmpty()) { |
| | | return new ArrayList<>(); |
| | | /** |
| | | * ä¿®æ¹ææ ä¿¡æ¯ |
| | | * |
| | | * @param energyIndex ææ ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateEnergyIndex(EnergyIndex energyIndex) { |
| | | return energyIndexMapper.updateEnergyIndex(energyIndex); |
| | | } |
| | | |
| | | return energyIndexMapper.getEnergyIndexMeterByCodes(indexCodes); |
| | | } |
| | | /** |
| | | * æ¹éå 餿æ ä¿¡æ¯ |
| | | * |
| | | * @param nodeId |
| | | * @param indexIds éè¦å é¤çææ ä¿¡æ¯ID |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteEnergyIndexByIds(String nodeId, String[] indexIds) { |
| | | return energyIndexMapper.deleteEnergyIndexByIds(nodeId, indexIds); |
| | | } |
| | | |
| | | /** |
| | | * @description: hmj å页æ¥è¯¢ |
| | | * @param query |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.zhitan.model.domain.EnergyIndex> |
| | | * @author: hmj |
| | | * @date: 2024/10/11 23:56 |
| | | */ |
| | | @Override |
| | | public Page<EnergyIndex> selectEnergyIndexPage(EnergyIndexQuery query, Long pageNum, Long pageSize) { |
| | | return energyIndexMapper.selectEnergyIndexPage(new Page<>(pageNum,pageSize),query); |
| | | } |
| | | @Override |
| | | public boolean energyIndexHasExist(String code) { |
| | | int count = energyIndexMapper.energyIndexHasExist(code); |
| | | return count > 0; |
| | | } |
| | | |
| | | @Override |
| | | public Page<EnergyIndex> getMeterIndexList(List<String> meterIndexIds,String code, |
| | | String name,Long pageNum, Long pageSize) { |
| | | LambdaQueryWrapper<EnergyIndex> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(EnergyIndex::getMeterId,meterIndexIds); |
| | | queryWrapper.like(StringUtils.isNotEmpty(code),EnergyIndex::getCode,code); |
| | | queryWrapper.like(StringUtils.isNotEmpty(name),EnergyIndex::getName,name); |
| | | return energyIndexMapper.selectPage(new Page<>(pageNum,pageSize),queryWrapper); |
| | | } |
| | | @Override |
| | | public boolean energyIndexHasExist(String indexId, String code) { |
| | | int count = energyIndexMapper.energyIndexHasExistWhenUpdate(indexId, code); |
| | | return count > 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> getIndexByCode(String code, String nodeId) { |
| | | List<EnergyIndex> energyIndexList = energyIndexMapper.getIndexByCode(code,nodeId); |
| | | @Override |
| | | public AjaxResult addMeterIndex(String meterId) { |
| | | MeterImplement meterImplement = meterImplementService.selectMeterImplementById(meterId); |
| | | if (meterImplement == null) { |
| | | return AjaxResult.error("æ¾ä¸å°å¯¹åºç计éå¨å
·ï¼"); |
| | | } |
| | | |
| | | return energyIndexList; |
| | | } |
| | | DaqTemplate query = new DaqTemplate(); |
| | | query.setDeviceType(meterImplement.getMeterType()); |
| | | List<DaqTemplate> daqTemplates = daqTemplateService.selectDaqTemplateList(query); |
| | | if (daqTemplates.isEmpty()) { |
| | | return AjaxResult.error("计éå¨å
·æå±çç±»åæ²¡ææ¾å°å¯¹åºç模æ¿ï¼"); |
| | | } |
| | | |
| | | List<EnergyIndex> energyIndices = new ArrayList<>(); |
| | | daqTemplates.forEach(daqTemplate -> { |
| | | EnergyIndex energyIndex = new EnergyIndex(); |
| | | energyIndex.setIndexId(UUID.randomUUID().toString()); |
| | | energyIndex.setCode(meterImplement.getCode() + "_" + daqTemplate.getCode()); |
| | | energyIndex.setName(daqTemplate.getName()); |
| | | energyIndex.setUnitId(daqTemplate.getUnit()); |
| | | energyIndex.setIndexType(IndexType.COLLECT); |
| | | energyIndex.setMeterId(meterId); |
| | | energyIndices.add(energyIndex); |
| | | }); |
| | | |
| | | energyIndexMapper.deleteIndexByMeterId(meterId); |
| | | energyIndexMapper.insertEnergyIndices(energyIndices); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> getMeterIndex(String meterId) { |
| | | return energyIndexMapper.getMeterIndex(meterId); |
| | | } |
| | | |
| | | @Override |
| | | public boolean modelHasConfig(String modelCode) { |
| | | int count = energyIndexMapper.modelHasConfig(modelCode); |
| | | return count > 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> selectCollectIndex(String deviceId) { |
| | | return energyIndexMapper.selectCollectIndex(deviceId); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> getEnergyIndexByIds(List<String> indexIds) { |
| | | return energyIndexMapper.getEnergyIndexByIds(indexIds); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> getEnergyIndexByCodes(List<String> indexCodes) { |
| | | if (indexCodes.isEmpty()) { |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | return energyIndexMapper.getEnergyIndexByCodes(indexCodes); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> getIndexByNodeAndChildrenNode(String nodeId) { |
| | | return energyIndexMapper.getIndexByNodeAndChildrenNode(nodeId); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> searchIndexByNodeAndChildrenNode(String nodeId, String filter) { |
| | | return energyIndexMapper.searchIndexByNodeAndChildrenNode(nodeId, filter); |
| | | } |
| | | |
| | | @Override |
| | | public void removeNodeIndex(String nodeId, List<String> removeLink) { |
| | | energyIndexMapper.removeNodeIndex(nodeId, removeLink); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult importEnergyIndex(List<EnergyIndex> energyIndexList, boolean updateSupport) { |
| | | List<String> codes = energyIndexList.stream().map(EnergyIndex::getCode) |
| | | .collect(Collectors.toList()); |
| | | List<String> nodeCodes = energyIndexList.stream().map(EnergyIndex::getNodeId) |
| | | .collect(Collectors.toList()); |
| | | List<EnergyIndex> indexList = energyIndexMapper.getEnergyIndexByCodes(codes); |
| | | List<ModelNode> modelNodes = modelNodeService.getModelNodeByNodeCodes(nodeCodes); |
| | | Map<String, String> nodeCodeToId = modelNodes.stream() |
| | | .collect(Collectors.toMap(ModelNode::getCode, ModelNode::getNodeId)); |
| | | Set<String> cacheIndexCodes = indexList.stream().map(EnergyIndex::getCode) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | List<EnergyIndex> insertData = new ArrayList<>(); |
| | | List<EnergyIndex> updateData = new ArrayList<>(); |
| | | List<String> errorNodeCode = new ArrayList<>(); |
| | | List<String> insertIndexCode = new ArrayList<>(); |
| | | AtomicBoolean existDuplicateCode = new AtomicBoolean(false); |
| | | energyIndexList.forEach(energyIndex -> { |
| | | if (cacheIndexCodes.contains(energyIndex.getCode())) { |
| | | updateData.add(energyIndex); |
| | | } else { |
| | | String nodeCode = energyIndex.getNodeId(); |
| | | if (nodeCodeToId.containsKey(nodeCode)) { |
| | | if (!insertIndexCode.contains(energyIndex.getCode())) { |
| | | insertIndexCode.add(energyIndex.getCode()); |
| | | energyIndex.setIndexId(UUID.randomUUID().toString()); |
| | | energyIndex.setNodeId(nodeCodeToId.get(nodeCode)); |
| | | insertData.add(energyIndex); |
| | | } else { |
| | | existDuplicateCode.set(true); |
| | | } |
| | | } else if (!errorNodeCode.contains(nodeCode)) { |
| | | errorNodeCode.add(nodeCode); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | if (updateSupport && !updateData.isEmpty()) { |
| | | updateData.forEach(energyIndexMapper::updateEnergyIndex); |
| | | } |
| | | |
| | | if (!insertData.isEmpty()) { |
| | | energyIndexMapper.saveEnergyIndex(insertData); |
| | | } |
| | | |
| | | String errMsg = ""; |
| | | if (existDuplicateCode.get()) { |
| | | errMsg += "åå¨éå¤çææ ç¼ç ï¼å·²èªå¨è¿æ»¤ï¼"; |
| | | } |
| | | |
| | | if (!errorNodeCode.isEmpty()) { |
| | | errMsg += String.join(",", errorNodeCode) + "æ²¡ææ¾å°å¯¹åºçèç¹æ°æ®ï¼å æ¤å
¶ä¸çææææ 导å
¥å¤±è´¥ï¼"; |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(errMsg)) { |
| | | return AjaxResult.error(errMsg); |
| | | } |
| | | return AjaxResult.success("导å
¥æåï¼"); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> getEnergyIndexMeterByCodes(List<String> indexCodes) { |
| | | if (indexCodes.isEmpty()) { |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | return energyIndexMapper.getEnergyIndexMeterByCodes(indexCodes); |
| | | } |
| | | |
| | | /** |
| | | * @param query |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.zhitan.model.domain.EnergyIndex> |
| | | * @description: hmj å页æ¥è¯¢ |
| | | * @author: hmj |
| | | * @date: 2024/10/11 23:56 |
| | | */ |
| | | @Override |
| | | public Page<EnergyIndex> selectEnergyIndexPage(EnergyIndexQuery query, Long pageNum, Long pageSize) { |
| | | return energyIndexMapper.selectEnergyIndexPage(new Page<>(pageNum, pageSize), query); |
| | | } |
| | | |
| | | @Override |
| | | public Page<EnergyIndex> getMeterIndexList(List<String> meterIndexIds, String code, |
| | | String name, Long pageNum, Long pageSize) { |
| | | LambdaQueryWrapper<EnergyIndex> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(EnergyIndex::getMeterId, meterIndexIds); |
| | | queryWrapper.like(StringUtils.isNotEmpty(code), EnergyIndex::getCode, code); |
| | | queryWrapper.like(StringUtils.isNotEmpty(name), EnergyIndex::getName, name); |
| | | return energyIndexMapper.selectPage(new Page<>(pageNum, pageSize), queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyIndex> getIndexByCode(String code, String nodeId) { |
| | | List<EnergyIndex> energyIndexList = energyIndexMapper.getIndexByCode(code, nodeId); |
| | | |
| | | return energyIndexList; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨è½åå
idå设å¤idï¼ä»¥åç¹ä½ç¼ç è·åç¹ä½ |
| | | * |
| | | * @param nodeId èç¹id |
| | | * @param meterId 设å¤id |
| | | * @param indexCode ç¹ä½ç¼ç æè
ç¹ä½ç¼ç çä¸é¨å |
| | | * @return |
| | | */ |
| | | @Override |
| | | public EnergyIndex getDeviceIndexByCode(String nodeId, String meterId, String indexCode) { |
| | | |
| | | List<EnergyIndex> energyIndexList = listDeviceIndexByCode(nodeId, meterId, indexCode); |
| | | EnergyIndex energyIndex = energyIndexList.stream().findFirst().orElse(null); |
| | | if (ObjectUtils.isEmpty(energyIndex)) { |
| | | energyIndex = new EnergyIndex(); |
| | | } |
| | | return energyIndex; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨è½åå
idå设å¤idï¼ä»¥åç¹ä½ç¼ç è·åç¹ä½ |
| | | * |
| | | * @param nodeId èç¹id |
| | | * @param meterId 设å¤id |
| | | * @param indexCode ç¹ä½ç¼ç æè
ç¹ä½ç¼ç çä¸é¨å |
| | | * @return |
| | | */ |
| | | public List<EnergyIndex> listDeviceIndexByCode(String nodeId, String meterId, String indexCode) { |
| | | return energyIndexMapper.selectList(Wrappers.<EnergyIndex>lambdaQuery() |
| | | .eq(EnergyIndex::getNodeId, nodeId) |
| | | .eq(EnergyIndex::getMeterId, meterId) |
| | | .like(EnergyIndex::getCode, indexCode)); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨è½åå
idå设å¤idï¼ä»¥åç¹ä½ç¼ç è·åç¹ä½ |
| | | * |
| | | * @param nodeId èç¹id |
| | | * @param meterId 设å¤id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<EnergyIndex> listDeviceIndex(String nodeId, String meterId) { |
| | | return energyIndexMapper.selectList(Wrappers.<EnergyIndex>lambdaQuery() |
| | | .eq(EnergyIndex::getNodeId, nodeId) |
| | | .eq(EnergyIndex::getMeterId, meterId)); |
| | | } |
| | | } |
| | |
| | | */ |
| | | PeakValleyHourVO segmentAnalysisHour(PeakValleyDTO dto); |
| | | |
| | | /** |
| | | * å°å³°å¹³è°·åæ¶ç»è®¡å¯¼åº |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | List<PeakValleyHourDataVO> segmentAnalysisHourExport(PeakValleyDTO dto); |
| | | |
| | | PeakValleyDayVO segmentAnalysisDayCustomize(PeakValleyDTO dto); |
| | |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime, endTime, timeType); |
| | | // æ ¹æ®å°æ¶æ°æ®è®¡ç®å¤©çæ°æ® |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime, endTime, TimeType.HOUR.name()); |
| | | |
| | | electricityDataMap = dataItemList.stream() |
| | | .collect(Collectors.groupingBy(li -> DateUtil.formatDateTime(li.getDataTime()))); |
| | | } |
| | | while (!startTime.after(endTime)) { |
| | | String mapKey = DateUtil.formatDateTime(startTime); |
| | | List<ElectricityDataItem> dataItemList = electricityDataMap.get(mapKey); |
| | | |
| | | Date nextTime = DateUtil.offsetDay(startTime, 1); |
| | | List<ElectricityDataItem> dataItemList = new ArrayList<>(); |
| | | for (Map.Entry<String, List<ElectricityDataItem>> entry : electricityDataMap.entrySet()) { |
| | | String key = entry.getKey(); |
| | | if ((DateUtils.parseDate(key).after(startTime) || DateUtils.parseDate(key).equals(startTime)) && DateUtils.parseDate(key).before(nextTime)) { |
| | | List<ElectricityDataItem> list = entry.getValue(); |
| | | dataItemList.addAll(list); |
| | | } |
| | | } |
| | | |
| | | BigDecimal sharpFee = BigDecimal.ZERO; |
| | | BigDecimal sharpPower = BigDecimal.ZERO; |
| | |
| | | String electricityType = electricityDataItem.getElectricityType(); |
| | | |
| | | if (ElectricityTypeEnum.SHARP.name().equals(electricityType)) { |
| | | // sharpFee = sharpFee.add(electricityDataItem.getCost()); |
| | | |
| | | sharpFee = sharpFee.add(electricityDataItem.getCost()); |
| | | sharpPower = sharpPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.PEAK.name().equals(electricityType)) { |
| | | // peakFee = peakFee.add(electricityDataItem.getCost()); |
| | | peakFee = peakFee.add(electricityDataItem.getCost()); |
| | | peakPower = peakPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.FLAT.name().equals(electricityType)) { |
| | | // flatFee = flatFee.add(electricityDataItem.getCost()); |
| | | flatFee = flatFee.add(electricityDataItem.getCost()); |
| | | flatPower = flatPower.add(electricityDataItem.getElectricity()); |
| | | } else { |
| | | // valleyFee = valleyFee.add(electricityDataItem.getCost()); |
| | | valleyFee = valleyFee.add(electricityDataItem.getCost()); |
| | | valleyPower = valleyPower.add(electricityDataItem.getElectricity()); |
| | | } |
| | | } |
| | | //2024-11-12æ°å¢ |
| | | CostPriceRelevancyVo voS = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.SHARP.name()); |
| | | if(voS!=null){ |
| | | sharpFee = voS.getPrice().multiply(sharpPower); |
| | | } |
| | | CostPriceRelevancyVo voP = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.PEAK.name()); |
| | | if(voP!=null){ |
| | | peakFee = voP.getPrice().multiply(peakPower); |
| | | } |
| | | CostPriceRelevancyVo voF = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.FLAT.name()); |
| | | if(voF!=null){ |
| | | flatFee = voF.getPrice().multiply(flatPower); |
| | | } |
| | | CostPriceRelevancyVo voV = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(), ElectricityTypeEnum.VALLEY.name()); |
| | | if(voV!=null){ |
| | | valleyFee = voV.getPrice().multiply(valleyPower); |
| | | } |
| | | // CostPriceRelevancyVo voD = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(), ElectricityTypeEnum.DEEP.name()); |
| | | // if(voV!=null){ |
| | | // DeepFee = voV.getPrice().multiply(valleyPower); |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | PeakValleyDayDataVO peakAndValleyReportVO = new PeakValleyDayDataVO(startTime, sharpFee, sharpPower, |
| | | peakFee, peakPower, flatFee, flatPower, valleyFee, valleyPower); |
| | |
| | | String electricityType = electricityDataItem.getElectricityType(); |
| | | |
| | | if (ElectricityTypeEnum.SHARP.name().equals(electricityType)) { |
| | | // sharpFee = sharpFee.add(electricityDataItem.getCost()); |
| | | sharpFee = sharpFee.add(electricityDataItem.getCost()); |
| | | sharpPower = sharpPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.PEAK.name().equals(electricityType)) { |
| | | // peakFee = peakFee.add(electricityDataItem.getCost()); |
| | | peakFee = peakFee.add(electricityDataItem.getCost()); |
| | | peakPower = peakPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.FLAT.name().equals(electricityType)) { |
| | | // flatFee = flatFee.add(electricityDataItem.getCost()); |
| | | flatFee = flatFee.add(electricityDataItem.getCost()); |
| | | flatPower = flatPower.add(electricityDataItem.getElectricity()); |
| | | } else { |
| | | // valleyFee = valleyFee.add(electricityDataItem.getCost()); |
| | | valleyFee = valleyFee.add(electricityDataItem.getCost()); |
| | | valleyPower = valleyPower.add(electricityDataItem.getElectricity()); |
| | | } |
| | | } |
| | | //2024-11-12æ°å¢ |
| | | CostPriceRelevancyVo voS = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.SHARP.name()); |
| | | if(voS!=null){ |
| | | sharpFee = voS.getPrice().multiply(sharpPower); |
| | | } |
| | | CostPriceRelevancyVo voP = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.PEAK.name()); |
| | | if(voP!=null){ |
| | | peakFee = voP.getPrice().multiply(peakPower); |
| | | } |
| | | CostPriceRelevancyVo voF = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.FLAT.name()); |
| | | if(voF!=null){ |
| | | flatFee = voF.getPrice().multiply(flatPower); |
| | | } |
| | | CostPriceRelevancyVo voV = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(), ElectricityTypeEnum.VALLEY.name()); |
| | | if(voV!=null){ |
| | | valleyFee = voV.getPrice().multiply(valleyPower); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | PeakValleyHourDataVO peakAndValleyReportVO = new PeakValleyHourDataVO(startTime, sharpFee, sharpPower, |
| | | peakFee, peakPower, flatFee, flatPower, valleyFee, valleyPower); |
| | |
| | | |
| | | |
| | | import com.zhitan.common.enums.CollectionModes; |
| | | import com.zhitan.common.enums.GroupTimeType; |
| | | import com.zhitan.common.enums.RetrievalModes; |
| | | import com.zhitan.realtimedata.domain.TagValue; |
| | | |
| | |
| | | CollectionModes collectionModes); |
| | | |
| | | /** |
| | | * è·åæµç¹å¨ä¸æ®µæ¶é´å
æç
§æä¸æ¶é´å¨æçç»è®¡æ°æ®. |
| | | * |
| | | * @param tagCodes æµç¹ç¼å·éå |
| | | * @param beginTime å¼å§æ¶é´ |
| | | * @param endTime ç»ææ¶é´,å
æ¬ç»ææ¶é´ |
| | | * @param modes ç»è®¡ç±»å |
| | | * @param timeType åç»æ¶é´å¨æï¼åãæ¶ãå¤©ï¼ |
| | | * @return æµç¹ç»è®¡ç»æ |
| | | */ |
| | | List<TagValue> statistics(String tagCodes, Date beginTime, Date endTime, CollectionModes modes, GroupTimeType timeType); |
| | | |
| | | /** |
| | | * å卿µç¹ç宿¶æ°æ®. |
| | | * |
| | | * @param tagValues æµç¹å®æ¶æ°æ® |
| | |
| | | package com.zhitan.realtimedata.service.impl; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.google.common.collect.Lists; |
| | | import com.zhitan.common.enums.CollectionModes; |
| | | import com.zhitan.common.enums.GroupTimeType; |
| | | import com.zhitan.common.enums.RetrievalModes; |
| | | import com.zhitan.realtimedata.data.RealtimeDatabaseManager; |
| | | import com.zhitan.realtimedata.data.influxdb.InfluxDBRepository; |
| | |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 宿¶æ°æ®åºåæ°æå¡å®ç°ç±». |
| | |
| | | return repository.statistics(tagCodes, beginTime, endTime, collectionModes); |
| | | } |
| | | |
| | | @Override |
| | | public List<TagValue> statistics(String tagCodes, Date beginTime, Date endTime, CollectionModes modes, GroupTimeType timeType) { |
| | | try { |
| | | List<String> tagCodeList = Arrays.asList(tagCodes.split(StrUtil.COMMA).clone()); |
| | | List<TagValue> tagValues = repository.statistics(tagCodeList, beginTime, endTime, modes, timeType); |
| | | if (ObjectUtil.isEmpty(tagValues)) { |
| | | tagValues = new ArrayList<>(); |
| | | } |
| | | return tagValues; |
| | | } catch (Exception e) { |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å卿µç¹ç宿¶æ°æ®. |
| | | * |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.statisticalAnalysis.domain.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.EnumValue; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.time.LocalDate; |
| | | |
| | | /** |
| | | * è½æµå¾æ¥è¯¢ |
| | | */ |
| | | @Data |
| | | public class FlowChartsDTO { |
| | | |
| | | /** |
| | | * è½æºç±»ååç§° |
| | | */ |
| | | @EnumValue |
| | | @ApiModelProperty(value = "æ¶é´ç±»å") |
| | | private TimeType timeType; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¶é´ |
| | | */ |
| | | @NotNull(message = "æ¥è¯¢æ¶é´ä¸è½ä¸ºç©º") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @ApiModelProperty(value = "æ¥è¯¢æ¶é´") |
| | | private LocalDate queryTime; |
| | | |
| | | /** |
| | | * è½æºç±»å |
| | | */ |
| | | @NotBlank(message = "è½æºç±»åä¸è½ä¸ºç©º") |
| | | @ApiModelProperty(value = "è½æºç±»å") |
| | | private String energyType; |
| | | |
| | | /** |
| | | * èç¹id |
| | | */ |
| | | @ApiModelProperty(value = "èç¹id") |
| | | private String nodeId; |
| | | |
| | | @NotBlank(message = "模åç¼ç ä¸è½ä¸ºç©º") |
| | | @ApiModelProperty(value = "模åç¼ç ") |
| | | private String modelCode; |
| | | |
| | | public TimeType getTimeType() { |
| | | if (ObjectUtils.isEmpty(timeType)) { |
| | | return TimeType.DAY; |
| | | } |
| | | return timeType; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.statisticalAnalysis.domain.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * è½æµå¾æ¥è¯¢ |
| | | */ |
| | | @Data |
| | | public class FlowChartsItemVO { |
| | | |
| | | /** |
| | | * æºå¤´ |
| | | */ |
| | | @ApiModelProperty(value = "æºå¤´") |
| | | private String source; |
| | | |
| | | /** |
| | | * ç®æ |
| | | */ |
| | | @ApiModelProperty(value = "ç®æ ") |
| | | private String target; |
| | | |
| | | /** |
| | | * å¼ |
| | | */ |
| | | @NotBlank(message = "å¼") |
| | | @ApiModelProperty(value = "å¼") |
| | | private BigDecimal value; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.statisticalAnalysis.domain.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è½æµå¾æ¥è¯¢ |
| | | */ |
| | | @Data |
| | | public class FlowChartsVO { |
| | | |
| | | // æ»ç´¯ç§¯é |
| | | @ApiModelProperty(value = "æ»ç´¯ç§¯é") |
| | | private BigDecimal totalAccumulatedAmount; |
| | | |
| | | // åèç¹ç´¯ç§¯é |
| | | @ApiModelProperty(value = "åèç¹ç´¯ç§¯é") |
| | | private BigDecimal childNodeAccumulatedAmount; |
| | | |
| | | // å·®å¼ |
| | | @ApiModelProperty(value = "å·®å¼") |
| | | private BigDecimal difference; |
| | | |
| | | // è½èæå¤±æ¯ä¾ |
| | | @ApiModelProperty(value = "è½èæå¤±æ¯ä¾") |
| | | private BigDecimal energyLossRatio; |
| | | |
| | | private List<FlowChartsItemVO> itemVOList; |
| | | |
| | | public BigDecimal getTotalAccumulatedAmount() { |
| | | if (totalAccumulatedAmount == null){ |
| | | return BigDecimal.ZERO; |
| | | } |
| | | return totalAccumulatedAmount; |
| | | } |
| | | |
| | | public BigDecimal getChildNodeAccumulatedAmount() { |
| | | if (childNodeAccumulatedAmount == null){ |
| | | return BigDecimal.ZERO; |
| | | } |
| | | return childNodeAccumulatedAmount; |
| | | } |
| | | |
| | | public BigDecimal getDifference() { |
| | | return difference = totalAccumulatedAmount.subtract(childNodeAccumulatedAmount); |
| | | } |
| | | |
| | | public BigDecimal getEnergyLossRatio() { |
| | | if (BigDecimal.ZERO.compareTo(totalAccumulatedAmount) == 0 |
| | | || BigDecimal.ZERO.compareTo(difference) == 0){ |
| | | return BigDecimal.ZERO; |
| | | } |
| | | return energyLossRatio = difference.divide(totalAccumulatedAmount, 2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | public FlowChartsVO() { |
| | | this.totalAccumulatedAmount = BigDecimal.ZERO; |
| | | this.childNodeAccumulatedAmount = BigDecimal.ZERO; |
| | | this.difference = BigDecimal.ZERO; |
| | | this.energyLossRatio = BigDecimal.ZERO; |
| | | this.itemVOList = Collections.emptyList(); |
| | | } |
| | | } |
| | |
| | | <result column="value0" property="value0"/> |
| | | </resultMap> |
| | | <!--å
¨åè½èç»è®¡--> |
| | | <select id="getdailyComprehensiveList" resultMap="dataItemMap"> |
| | | <select id="getDailyComprehensiveList" resultType="com.zhitan.comprehensivestatistics.domain.DailyComprehensive"> |
| | | SELECT |
| | | aa.index_id, |
| | | aa.index_name, |
| | |
| | | ORDER BY aa.order_num ASC |
| | | </select> |
| | | |
| | | <select id="getListChart" resultMap="dataItemMap"> |
| | | <select id="getListChart" resultType="com.zhitan.comprehensivestatistics.domain.DailyComprehensive"> |
| | | SELECT |
| | | di.index_id, |
| | | ci.name AS "index_name", |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.zhitan.comprehensivestatistics.mapper.MonthlyComprehensiveMapper"> |
| | | <resultMap id="dataItemMap" type="com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive"> |
| | | <result column="index_id" property="indexId"/> |
| | | <result column="index_name" property="indexName"/> |
| | | <result column="time_type" property="timeType"/> |
| | | <result column="time_code" property="timeCode"/> |
| | | <result column="unit_id" property="unitId"/> |
| | | <result column="value1" property="value1"/> |
| | | <result column="value2" property="value2"/> |
| | | <result column="value3" property="value3"/> |
| | | <result column="value4" property="value4"/> |
| | | <result column="value5" property="value5"/> |
| | | <result column="value6" property="value6"/> |
| | | <result column="value7" property="value7"/> |
| | | <result column="value8" property="value8"/> |
| | | <result column="value9" property="value9"/> |
| | | <result column="value10" property="value10"/> |
| | | <result column="value11" property="value11"/> |
| | | <result column="value12" property="value12"/> |
| | | <result column="value13" property="value13"/> |
| | | <result column="value14" property="value14"/> |
| | | <result column="value15" property="value15"/> |
| | | <result column="value16" property="value16"/> |
| | | <result column="value17" property="value17"/> |
| | | <result column="value18" property="value18"/> |
| | | <result column="value19" property="value19"/> |
| | | <result column="value20" property="value20"/> |
| | | <result column="value21" property="value21"/> |
| | | <result column="value22" property="value22"/> |
| | | <result column="value23" property="value23"/> |
| | | <result column="value24" property="value24"/> |
| | | <result column="value25" property="value25"/> |
| | | <result column="value26" property="value26"/> |
| | | <result column="value27" property="value27"/> |
| | | <result column="value28" property="value28"/> |
| | | <result column="value29" property="value29"/> |
| | | <result column="value30" property="value30"/> |
| | | <result column="value31" property="value31"/> |
| | | </resultMap> |
| | | <!--å
¨åè½èç»è®¡--> |
| | | <select id="getMonthlyComprehensiveList" resultMap="dataItemMap"> |
| | | SELECT |
| | | aa.index_id, |
| | | aa.index_name, |
| | | <foreach item="item" index="index" collection="dataList"> |
| | | COALESCE ( MAX ( CASE WHEN data_time = #{item.dataTime} THEN "value" END ), null ) AS ${item.value}, |
| | | </foreach> |
| | | aa.time_type, |
| | | aa.order_num orderNum |
| | | FROM |
| | | ( |
| | | SELECT |
| | | ni.index_id, |
| | | ei."name" AS "index_name", |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type, |
| | | mn.order_num |
| | | FROM |
| | | model_node mn |
| | | LEFT JOIN node_index ni ON ni.node_id = mn.node_id |
| | | LEFT JOIN energy_index ei ON ei.index_id = ni.index_id |
| | | LEFT JOIN data_item di ON ni.index_id = di.index_id |
| | | WHERE |
| | | mn.parent_id = #{nodeId} |
| | | AND di.data_time >= #{beginTime} |
| | | AND di.data_time <= #{endTime} |
| | | AND di.time_type = #{timeType} |
| | | <if test="indexStorageId !='' and indexStorageId !=null"> |
| | | and ei.energy_id=#{indexStorageId} |
| | | </if> |
| | | ) aa |
| | | GROUP BY |
| | | aa.index_id, aa.index_name, aa.time_type, aa.order_num |
| | | ORDER BY aa.order_num ASC |
| | | </select> |
| | | |
| | | <select id="getListChart" resultMap="dataItemMap"> |
| | | SELECT |
| | | di.index_id, |
| | | ci.name AS "index_name", |
| | | ci.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type, |
| | | di.time_code |
| | | FROM |
| | | data_item di LEFT JOIN energy_index ci ON di.index_id = ci.index_id |
| | | WHERE |
| | | di.index_id =#{indexId} |
| | | AND di.data_time <= #{endTime} |
| | | AND di.data_time >= #{beginTime} |
| | | AND di.time_type = #{timeType} |
| | | ORDER BY |
| | | di.time_code; |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.zhitan.comprehensivestatistics.mapper.YearComprehensiveMapper"> |
| | | <resultMap id="dataItemMap" type="com.zhitan.comprehensivestatistics.domain.YearComperhensive"> |
| | | <result column="index_id" property="indexId"/> |
| | | <result column="index_name" property="indexName"/> |
| | | <result column="time_type" property="timeType"/> |
| | | <result column="time_code" property="timeCode"/> |
| | | <result column="unit_id" property="unitId"/> |
| | | <result column="value1" property="value1"/> |
| | | <result column="value2" property="value2"/> |
| | | <result column="value3" property="value3"/> |
| | | <result column="value4" property="value4"/> |
| | | <result column="value5" property="value5"/> |
| | | <result column="value6" property="value6"/> |
| | | <result column="value7" property="value7"/> |
| | | <result column="value8" property="value8"/> |
| | | <result column="value9" property="value9"/> |
| | | <result column="value10" property="value10"/> |
| | | <result column="value11" property="value11"/> |
| | | <result column="value12" property="value12"/> |
| | | </resultMap> |
| | | <!--å
¨åè½èç»è®¡--> |
| | | <select id="getYearComprehensiveList" resultMap="dataItemMap"> |
| | | SELECT |
| | | aa.index_id, |
| | | aa.index_name, |
| | | <foreach item="item" index="index" collection="dataList"> |
| | | COALESCE ( MAX ( CASE WHEN data_time = #{item.dataTime} THEN "value" END ), null ) AS ${item.value}, |
| | | </foreach> |
| | | aa.time_type, |
| | | aa.order_num orderNum |
| | | FROM |
| | | ( |
| | | SELECT |
| | | ni.index_id, |
| | | ei."name" AS "index_name", |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type, |
| | | mn.order_num |
| | | FROM |
| | | model_node mn |
| | | LEFT JOIN node_index ni ON ni.node_id = mn.node_id |
| | | LEFT JOIN energy_index ei ON ei.index_id = ni.index_id |
| | | LEFT JOIN data_item di ON ni.index_id = di.index_id |
| | | WHERE |
| | | mn.parent_id = #{nodeId} |
| | | AND di.data_time >= #{beginTime} |
| | | AND di.data_time <= #{endTime} |
| | | AND di.time_type = #{timeType} |
| | | <if test="indexStorageId !='' and indexStorageId !=null"> |
| | | and ei.energy_id=#{indexStorageId} |
| | | </if> |
| | | ) aa |
| | | GROUP BY aa.index_id, aa.index_name, aa.time_type, aa.order_num |
| | | ORDER BY aa.order_num ASC |
| | | </select> |
| | | |
| | | <select id="getListChart" resultMap="dataItemMap"> |
| | | SELECT |
| | | di.index_id, |
| | | ci.name AS "index_name", |
| | | ci.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type, |
| | | di.time_code |
| | | FROM |
| | | data_item di LEFT JOIN energy_index ci ON di.index_id = ci.index_id |
| | | WHERE |
| | | di.index_id =#{indexId} |
| | | AND di.data_time < #{endTime} |
| | | AND di.data_time >= #{beginTime} |
| | | AND di.time_type = #{timeType} |
| | | ORDER BY |
| | | di.time_code; |
| | | </select> |
| | | </mapper> |
| | |
| | | resultType="com.zhitan.model.domain.EnergyIndex"> |
| | | select ei.index_id as indexId, code, name, index_type as indexType |
| | | from energy_index ei |
| | | left join node_index ni on ei.index_id = ni.index_id |
| | | left join node_index ni on ei.index_id = ni.index_id |
| | | where ni.node_id = #{nodeId} |
| | | and ei.index_type = #{indexType} |
| | | and ei.index_type = #{indexType} |
| | | <if test="code != null and code != ''"> |
| | | and code like concat('%', #{code}, '%') |
| | | </if> |
| | |
| | | node_category nodeCategory |
| | | FROM "model_node" |
| | | WHERE model_code = #{indexCode} |
| | | AND parent_id IS NULL LIMIT 1; |
| | | AND parent_id IS NULL |
| | | LIMIT 1; |
| | | </select> |
| | | <select id="selectIndexByModelCodeAndNodeId" |
| | | resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | SELECT mn.node_id nodeId, |
| | | SELECT mn.node_id nodeId, |
| | | mn."name", |
| | | ni.index_id indexId |
| | | FROM model_node mn |
| | |
| | | |
| | | <select id="getSettingDeviceIndex" resultType="com.zhitan.basicdata.domain.MeterImplement"> |
| | | SELECT distinct |
| | | m."id", |
| | | m.code, |
| | | m.meter_name AS meterName, |
| | | m.meter_type meterType, |
| | | m.wire_diameter wireDiameter, |
| | | m.max_allowable_power maxAllowablePower |
| | | m."id", |
| | | m.code, |
| | | m.meter_name AS meterName, |
| | | m.meter_type meterType, |
| | | m.wire_diameter wireDiameter, |
| | | m.max_allowable_power maxAllowablePower |
| | | FROM meter_implement m |
| | | LEFT JOIN energy_index ei ON ei.meter_id = m."id" |
| | | LEFT JOIN node_index ni ON ni.index_id = ei.index_id |
| | | LEFT JOIN energy_index ei ON ei.meter_id = m."id" |
| | | LEFT JOIN node_index ni ON ni.index_id = ei.index_id |
| | | WHERE ni.node_id = #{nodeId} |
| | | <if test="energyType!=null and energyType!=''"> |
| | | AND M.energy_type = #{energyType} |
| | |
| | | <delete id="delIndexNodeIdAndIndexType"> |
| | | delete |
| | | from node_index |
| | | where node_id = #{nodeId} and index_id in ( |
| | | select ni.index_id |
| | | from node_index ni left join energy_index ei on ni.index_id = ei.index_id |
| | | where node_id = #{nodeId} and ei.index_type = #{indexType} |
| | | ); |
| | | where node_id = #{nodeId} |
| | | and index_id in (select ni.index_id |
| | | from node_index ni |
| | | left join energy_index ei on ni.index_id = ei.index_id |
| | | where node_id = #{nodeId} |
| | | and ei.index_type = #{indexType}); |
| | | </delete> |
| | | <insert id="setIndexAndNodeId"> |
| | | <foreach collection="indexIds" item="indexId" separator=";"> |
| | |
| | | </insert> |
| | | |
| | | <select id="getModelNodeIndexIdByNodeId" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" "name", |
| | | ni.index_id indexId, |
| | | ei.energy_id energyId, |
| | | ei.index_type indexType |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" "name", |
| | | ni.index_id indexId, |
| | | ei.energy_id energyId, |
| | | ei.index_type indexType |
| | | FROM "model_node" mn |
| | | LEFT JOIN "node_index" ni ON mn.node_id = ni.node_id |
| | | LEFT JOIN energy_index ei on ni.index_id = ei.index_id |
| | |
| | | FROM "model_node" mn |
| | | LEFT JOIN "node_index" ni ON mn.node_id = ni.node_id |
| | | left join energy_index ei on ni.index_id = ei.index_id |
| | | WHERE mn.parent_id = #{parentId} and ei.index_type = 'STATISTIC' |
| | | WHERE mn.parent_id = #{parentId} |
| | | and ei.index_type = 'STATISTIC' |
| | | </select> |
| | | <select id="getFirstModeNodeInfo" resultType="com.zhitan.model.domain.ModelNode"> |
| | | <include refid="selectModelNodeVo"/> |
| | | where model_code = #{modelCode} AND parent_id is null |
| | | where model_code = #{modelCode} AND parent_id is null |
| | | order by order_num |
| | | </select> |
| | | <select id="selectIndexByNodeIds" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" "name", |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" "name", |
| | | ni.index_id indexId, |
| | | ei.energy_id |
| | | FROM "model_node" mn |
| | |
| | | left join energy_index ei on ni.index_id = ei.index_id |
| | | <where> |
| | | mn.model_code = #{modelCode} |
| | | AND mn.node_id in |
| | | <foreach collection="nodeIds" index="index" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | <if test="modelCode!=null and modelCode!='' and nodeIds.size>0"> |
| | | and ei.index_type='STATISTIC' |
| | | </if> |
| | | AND mn.node_id in |
| | | <foreach collection="nodeIds" index="index" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | <if test="modelCode!=null and modelCode!='' and nodeIds.size>0"> |
| | | and ei.index_type='STATISTIC' |
| | | </if> |
| | | |
| | | </where> |
| | | |
| | | </select> |
| | | |
| | | <select id="getDataItemByParentNodeId" resultType="com.zhitan.dataitem.domain.vo.NodeIndexValueVO"> |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" nodeName, |
| | | di.index_id indexId, |
| | | di."value" value |
| | | FROM model_node mn |
| | | LEFT JOIN "node_index" ni ON mn.node_id = ni.node_id |
| | | LEFT JOIN "energy_index" ei ON ei.index_id = ni.index_id |
| | | LEFT JOIN "data_item" di ON ei.index_id = di.index_id |
| | | WHERE mn.parent_id = #{parentId} |
| | | AND ei.energy_id = #{energyType} |
| | | AND ei.index_type = 'STATISTIC' |
| | | AND di.time_type = #{timeType.name} |
| | | AND di.data_time >= #{dateTimeMap.startTime} |
| | | AND di.data_time <= #{dateTimeMap.endTime} |
| | | </select> |
| | | |
| | | <select id="getDataItemByNodeId" resultType="com.zhitan.dataitem.domain.vo.NodeIndexValueVO"> |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" nodeName, |
| | | di.index_id indexId, |
| | | di."value" value |
| | | FROM "model_node" mn |
| | | LEFT JOIN "node_index" ni ON mn.node_id = ni.node_id |
| | | LEFT JOIN "energy_index" ei ON ei.index_id = ni.index_id |
| | | LEFT JOIN "data_item" di ON ei.index_id = di.index_id |
| | | WHERE mn.node_id = #{nodeId} |
| | | AND ei.energy_id = #{energyType} |
| | | AND ei.index_type = 'STATISTIC' |
| | | AND di.time_type = #{timeType.name} |
| | | AND di.data_time >= #{dateTimeMap.startTime} |
| | | AND di.data_time <= #{dateTimeMap.endTime} |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.zhitan.model.mapper.NodeIndexMapper"> |
| | | |
| | | <resultMap type="com.zhitan.model.domain.NodeIndex" id="NodeIndexMap"> |
| | | <result property="nodeId" column="node_id" jdbcType="VARCHAR"/> |
| | | <result property="indexId" column="index_id" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | </mapper> |
| | | |
| | |
| | | <!DOCTYPE html> |
| | | <html> |
| | | |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> |
| | | <link rel="icon" href="/favicon.ico"> |
| | | <title>管çç³»ç»</title> |
| | | <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]--> |
| | | <style> |
| | | html, |
| | | body, |
| | | #app { |
| | | height: 100%; |
| | | margin: 0px; |
| | | padding: 0px; |
| | | } |
| | | |
| | | .chromeframe { |
| | | margin: 0.2em 0; |
| | | background: #ccc; |
| | | color: #000; |
| | | padding: 0.2em 0; |
| | | } |
| | | |
| | | #loader-wrapper { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | width: 100%; |
| | | height: 100%; |
| | | z-index: 999999; |
| | | } |
| | | |
| | | #loader { |
| | | display: block; |
| | | position: relative; |
| | | left: 50%; |
| | | top: 50%; |
| | | width: 150px; |
| | | height: 150px; |
| | | margin: -75px 0 0 -75px; |
| | | border-radius: 50%; |
| | | border: 3px solid transparent; |
| | | border-top-color: #FFF; |
| | | -webkit-animation: spin 2s linear infinite; |
| | | -ms-animation: spin 2s linear infinite; |
| | | -moz-animation: spin 2s linear infinite; |
| | | -o-animation: spin 2s linear infinite; |
| | | animation: spin 2s linear infinite; |
| | | z-index: 1001; |
| | | } |
| | | |
| | | #loader:before { |
| | | content: ""; |
| | | position: absolute; |
| | | top: 5px; |
| | | left: 5px; |
| | | right: 5px; |
| | | bottom: 5px; |
| | | border-radius: 50%; |
| | | border: 3px solid transparent; |
| | | border-top-color: #FFF; |
| | | -webkit-animation: spin 3s linear infinite; |
| | | -moz-animation: spin 3s linear infinite; |
| | | -o-animation: spin 3s linear infinite; |
| | | -ms-animation: spin 3s linear infinite; |
| | | animation: spin 3s linear infinite; |
| | | } |
| | | |
| | | #loader:after { |
| | | content: ""; |
| | | position: absolute; |
| | | top: 15px; |
| | | left: 15px; |
| | | right: 15px; |
| | | bottom: 15px; |
| | | border-radius: 50%; |
| | | border: 3px solid transparent; |
| | | border-top-color: #FFF; |
| | | -moz-animation: spin 1.5s linear infinite; |
| | | -o-animation: spin 1.5s linear infinite; |
| | | -ms-animation: spin 1.5s linear infinite; |
| | | -webkit-animation: spin 1.5s linear infinite; |
| | | animation: spin 1.5s linear infinite; |
| | | } |
| | | |
| | | |
| | | @-webkit-keyframes spin { |
| | | 0% { |
| | | -webkit-transform: rotate(0deg); |
| | | -ms-transform: rotate(0deg); |
| | | transform: rotate(0deg); |
| | | <head> |
| | | <meta charset="utf-8" /> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> |
| | | <meta name="renderer" content="webkit" /> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /> |
| | | <link rel="icon" href="/logo.png" /> |
| | | <title>管çç³»ç»</title> |
| | | <!--[if lt IE 11 |
| | | ]><script> |
| | | window.location.href = "/html/ie.html" |
| | | </script><! |
| | | [endif]--> |
| | | <style> |
| | | html, |
| | | body, |
| | | #app { |
| | | height: 100%; |
| | | margin: 0px; |
| | | padding: 0px; |
| | | } |
| | | |
| | | 100% { |
| | | -webkit-transform: rotate(360deg); |
| | | -ms-transform: rotate(360deg); |
| | | transform: rotate(360deg); |
| | | } |
| | | } |
| | | |
| | | @keyframes spin { |
| | | 0% { |
| | | -webkit-transform: rotate(0deg); |
| | | -ms-transform: rotate(0deg); |
| | | transform: rotate(0deg); |
| | | .chromeframe { |
| | | margin: 0.2em 0; |
| | | background: #ccc; |
| | | color: #000; |
| | | padding: 0.2em 0; |
| | | } |
| | | |
| | | 100% { |
| | | -webkit-transform: rotate(360deg); |
| | | -ms-transform: rotate(360deg); |
| | | transform: rotate(360deg); |
| | | #loader-wrapper { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | width: 100%; |
| | | height: 100%; |
| | | z-index: 999999; |
| | | } |
| | | } |
| | | |
| | | #loader { |
| | | display: block; |
| | | position: relative; |
| | | left: 50%; |
| | | top: 50%; |
| | | width: 150px; |
| | | height: 150px; |
| | | margin: -75px 0 0 -75px; |
| | | border-radius: 50%; |
| | | border: 3px solid transparent; |
| | | border-top-color: #fff; |
| | | -webkit-animation: spin 2s linear infinite; |
| | | -ms-animation: spin 2s linear infinite; |
| | | -moz-animation: spin 2s linear infinite; |
| | | -o-animation: spin 2s linear infinite; |
| | | animation: spin 2s linear infinite; |
| | | z-index: 1001; |
| | | } |
| | | |
| | | #loader-wrapper .loader-section { |
| | | position: fixed; |
| | | top: 0; |
| | | width: 51%; |
| | | height: 100%; |
| | | background: #7171C6; |
| | | z-index: 1000; |
| | | -webkit-transform: translateX(0); |
| | | -ms-transform: translateX(0); |
| | | transform: translateX(0); |
| | | } |
| | | #loader:before { |
| | | content: ""; |
| | | position: absolute; |
| | | top: 5px; |
| | | left: 5px; |
| | | right: 5px; |
| | | bottom: 5px; |
| | | border-radius: 50%; |
| | | border: 3px solid transparent; |
| | | border-top-color: #fff; |
| | | -webkit-animation: spin 3s linear infinite; |
| | | -moz-animation: spin 3s linear infinite; |
| | | -o-animation: spin 3s linear infinite; |
| | | -ms-animation: spin 3s linear infinite; |
| | | animation: spin 3s linear infinite; |
| | | } |
| | | |
| | | #loader-wrapper .loader-section.section-left { |
| | | left: 0; |
| | | } |
| | | #loader:after { |
| | | content: ""; |
| | | position: absolute; |
| | | top: 15px; |
| | | left: 15px; |
| | | right: 15px; |
| | | bottom: 15px; |
| | | border-radius: 50%; |
| | | border: 3px solid transparent; |
| | | border-top-color: #fff; |
| | | -moz-animation: spin 1.5s linear infinite; |
| | | -o-animation: spin 1.5s linear infinite; |
| | | -ms-animation: spin 1.5s linear infinite; |
| | | -webkit-animation: spin 1.5s linear infinite; |
| | | animation: spin 1.5s linear infinite; |
| | | } |
| | | |
| | | #loader-wrapper .loader-section.section-right { |
| | | right: 0; |
| | | } |
| | | @-webkit-keyframes spin { |
| | | 0% { |
| | | -webkit-transform: rotate(0deg); |
| | | -ms-transform: rotate(0deg); |
| | | transform: rotate(0deg); |
| | | } |
| | | |
| | | 100% { |
| | | -webkit-transform: rotate(360deg); |
| | | -ms-transform: rotate(360deg); |
| | | transform: rotate(360deg); |
| | | } |
| | | } |
| | | |
| | | .loaded #loader-wrapper .loader-section.section-left { |
| | | -webkit-transform: translateX(-100%); |
| | | -ms-transform: translateX(-100%); |
| | | transform: translateX(-100%); |
| | | -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000); |
| | | transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000); |
| | | } |
| | | @keyframes spin { |
| | | 0% { |
| | | -webkit-transform: rotate(0deg); |
| | | -ms-transform: rotate(0deg); |
| | | transform: rotate(0deg); |
| | | } |
| | | |
| | | .loaded #loader-wrapper .loader-section.section-right { |
| | | -webkit-transform: translateX(100%); |
| | | -ms-transform: translateX(100%); |
| | | transform: translateX(100%); |
| | | -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000); |
| | | transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000); |
| | | } |
| | | 100% { |
| | | -webkit-transform: rotate(360deg); |
| | | -ms-transform: rotate(360deg); |
| | | transform: rotate(360deg); |
| | | } |
| | | } |
| | | |
| | | .loaded #loader { |
| | | opacity: 0; |
| | | -webkit-transition: all 0.3s ease-out; |
| | | transition: all 0.3s ease-out; |
| | | } |
| | | #loader-wrapper .loader-section { |
| | | position: fixed; |
| | | top: 0; |
| | | width: 51%; |
| | | height: 100%; |
| | | background: #7171c6; |
| | | z-index: 1000; |
| | | -webkit-transform: translateX(0); |
| | | -ms-transform: translateX(0); |
| | | transform: translateX(0); |
| | | } |
| | | |
| | | .loaded #loader-wrapper { |
| | | visibility: hidden; |
| | | -webkit-transform: translateY(-100%); |
| | | -ms-transform: translateY(-100%); |
| | | transform: translateY(-100%); |
| | | -webkit-transition: all 0.3s 1s ease-out; |
| | | transition: all 0.3s 1s ease-out; |
| | | } |
| | | #loader-wrapper .loader-section.section-left { |
| | | left: 0; |
| | | } |
| | | |
| | | .no-js #loader-wrapper { |
| | | display: none; |
| | | } |
| | | #loader-wrapper .loader-section.section-right { |
| | | right: 0; |
| | | } |
| | | |
| | | .no-js h1 { |
| | | color: #222222; |
| | | } |
| | | .loaded #loader-wrapper .loader-section.section-left { |
| | | -webkit-transform: translateX(-100%); |
| | | -ms-transform: translateX(-100%); |
| | | transform: translateX(-100%); |
| | | -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); |
| | | transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); |
| | | } |
| | | |
| | | #loader-wrapper .load_title { |
| | | font-family: 'Open Sans'; |
| | | color: #FFF; |
| | | font-size: 19px; |
| | | width: 100%; |
| | | text-align: center; |
| | | z-index: 9999999999999; |
| | | position: absolute; |
| | | top: 60%; |
| | | opacity: 1; |
| | | line-height: 30px; |
| | | } |
| | | .loaded #loader-wrapper .loader-section.section-right { |
| | | -webkit-transform: translateX(100%); |
| | | -ms-transform: translateX(100%); |
| | | transform: translateX(100%); |
| | | -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); |
| | | transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); |
| | | } |
| | | |
| | | #loader-wrapper .load_title span { |
| | | font-weight: normal; |
| | | font-style: italic; |
| | | font-size: 13px; |
| | | color: #FFF; |
| | | opacity: 0.5; |
| | | } |
| | | </style> |
| | | </head> |
| | | .loaded #loader { |
| | | opacity: 0; |
| | | -webkit-transition: all 0.3s ease-out; |
| | | transition: all 0.3s ease-out; |
| | | } |
| | | |
| | | <body> |
| | | <div id="app"> |
| | | <div id="loader-wrapper"> |
| | | <div id="loader"></div> |
| | | <div class="loader-section section-left"></div> |
| | | <div class="loader-section section-right"></div> |
| | | <div class="load_title">æ£å¨å è½½,请èå¿çå¾
</div> |
| | | .loaded #loader-wrapper { |
| | | visibility: hidden; |
| | | -webkit-transform: translateY(-100%); |
| | | -ms-transform: translateY(-100%); |
| | | transform: translateY(-100%); |
| | | -webkit-transition: all 0.3s 1s ease-out; |
| | | transition: all 0.3s 1s ease-out; |
| | | } |
| | | |
| | | .no-js #loader-wrapper { |
| | | display: none; |
| | | } |
| | | |
| | | .no-js h1 { |
| | | color: #222222; |
| | | } |
| | | |
| | | #loader-wrapper .load_title { |
| | | font-family: "Open Sans"; |
| | | color: #fff; |
| | | font-size: 19px; |
| | | width: 100%; |
| | | text-align: center; |
| | | z-index: 9999999999999; |
| | | position: absolute; |
| | | top: 60%; |
| | | opacity: 1; |
| | | line-height: 30px; |
| | | } |
| | | |
| | | #loader-wrapper .load_title span { |
| | | font-weight: normal; |
| | | font-style: italic; |
| | | font-size: 13px; |
| | | color: #fff; |
| | | opacity: 0.5; |
| | | } |
| | | </style> |
| | | </head> |
| | | |
| | | <body> |
| | | <div id="app"> |
| | | <div id="loader-wrapper"> |
| | | <div id="loader"></div> |
| | | <div class="loader-section section-left"></div> |
| | | <div class="loader-section section-right"></div> |
| | | <div class="load_title">æ£å¨å è½½,请èå¿çå¾
</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script type="module" src="/src/main.js"></script> |
| | | </body> |
| | | |
| | | </html> |
| | | <script type="module" src="/src/main.js"></script> |
| | | </body> |
| | | </html> |
| | |
| | | "type": "module", |
| | | "scripts": { |
| | | "dev": "vite", |
| | | "build:prod": "vite build", |
| | | "build": "vite build", |
| | | "build:stage": "vite build --mode staging", |
| | | "preview": "vite preview" |
| | | }, |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | //å
¨å综åè½èç»è®¡ |
| | | export function getDataList(query) { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | //å
¨å综åè½èç»è®¡å¾ |
| | | export function getlistChart(query) { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/listChart', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | export function exportList(query) { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/export', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | export function getEnergyList(query) { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/getList', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | //éç¹è®¾å¤è½èæå |
| | | export function energyList(query) { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/energyList', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | //è®¾å¤ |
| | | export function getFacilityArchives() { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/getFacilityArchives', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | //éç¹è®¾å¤ |
| | | export function getPointFacility() { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/getPointFacility', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | export function getDeviceList(query) { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/getDeviceList', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | //è·å模åä¸çè½æºåç§ |
| | | export function energyDevice(query) { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/energyDevice', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request" |
| | | |
| | | //æ¥è¯¢æ¥æ¥è¡¨ |
| | | export function getDataList(query) { |
| | | return request({ |
| | | url: "/comprehensive/dailyComprehensive/list", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
| | | export function getlistChart(query) { |
| | | return request({ |
| | | url: "/comprehensive/dailyComprehensive/listChart", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
| | | |
| | | // 导åºç»¼åæ¥è¡¨ |
| | | export function exportList(query) { |
| | | return request({ |
| | | url: "/report/dailyReport/export", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | //æ¥è¯¢æ¥æ¥è¡¨ |
| | | export function getDataList(query) { |
| | | return request({ |
| | | url: '/comprehensive/monthlyComprehensive/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | export function getlistChart(query) { |
| | | return request({ |
| | | url: '/comprehensive/monthlyComprehensive/listChart', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | //å
¨å综åè½èç»è®¡ |
| | | export function getDataList(query) { |
| | | return request({ |
| | | url: '/statisticalData/processEnergyConsumption/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | //å
¨å综åè½èç»è®¡å¾ |
| | | export function getlistChart(query) { |
| | | return request({ |
| | | url: '/statisticalData/processEnergyConsumption/listChart', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | //æ¥è¯¢æ¥æ¥è¡¨ |
| | | export function getDataList(query) { |
| | | return request({ |
| | | url: '/comprehensive/yearComprehensive/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | export function getlistChart(query) { |
| | | return request({ |
| | | url: '/comprehensive/yearComprehensive/listChart', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request" |
| | | |
| | | // ä¿®æ¹ç»æå¾ |
| | | export function updateEquipmentfile(data) { |
| | | return request({ |
| | | url: "/basicSetup/equipmentfile", |
| | | method: "put", |
| | | data: data, |
| | | }) |
| | | } |
| | | |
| | | export function getAllCollectTag(data) { |
| | | return request({ |
| | | url: "/basicsetting/energyindex/filter", |
| | | method: "get", |
| | | params: data, |
| | | }) |
| | | } |
| | | |
| | | export function saveSettingApi(nodeId, data) { |
| | | return request({ |
| | | url: "/basicSetup/equipmentfile/setting/" + nodeId, |
| | | method: "put", |
| | | data: data, |
| | | }) |
| | | } |
| | | |
| | | export function getConfigure(nodeId) { |
| | | return request({ |
| | | url: "/basicSetup/equipmentfile/configure/" + nodeId, |
| | | method: "get", |
| | | }) |
| | | } |
| | | |
| | | export function getLiveData(tagCodes) { |
| | | return request({ |
| | | url: "/rtdb/retrieve/" + tagCodes, |
| | | method: "get", |
| | | }) |
| | | } |
| | |
| | | // tr:hover > td { |
| | | // background-color: #141E4A; |
| | | // } |
| | | |
| | | .el-table-fixed-column--left { |
| | | background-color: #110f2e !important; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | // tr:hover > td { |
| | | // background-color: #141E4A; |
| | | // } |
| | | .el-table-fixed-column--left { |
| | | background-color: #fff; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | :headers="headers" |
| | | class="upload-file-uploader" |
| | | ref="fileUpload" |
| | | :drag="draggable" |
| | | > |
| | | <!-- ä¸ä¼ æé® --> |
| | | <el-button type="primary">éåæä»¶</el-button> |
| | | <el-button v-if="!draggable" type="primary">éåæä»¶</el-button> |
| | | <div v-else> |
| | | <el-icon class="el-icon--upload"><upload-filled /></el-icon> |
| | | <div class="el-upload__text">å°æä»¶æå°æ¤å¤ï¼æ<em>ç¹å»ä¸ä¼ </em></div> |
| | | </div> |
| | | </el-upload> |
| | | <!-- ä¸ä¼ æç¤º --> |
| | | <div class="el-upload__tip" v-if="showTip"> |
| | |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | // æ¯å¦ææ½ä¸ä¼ |
| | | draggable: { |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | }) |
| | | |
| | | const { proxy } = getCurrentInstance() |
| | |
| | | |
| | | |
| | | /** |
| | | * éç¨jsæ¹æ³å°è£
å¤ç |
| | | * Copyright (c) 2019 ruoyi |
| | |
| | | if (arguments.length === 0 || !time) { |
| | | return null |
| | | } |
| | | const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' |
| | | const format = pattern || "{y}-{m}-{d} {h}:{i}:{s}" |
| | | let date |
| | | if (typeof time === 'object') { |
| | | if (typeof time === "object") { |
| | | date = time |
| | | } else { |
| | | if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { |
| | | if (typeof time === "string" && /^[0-9]+$/.test(time)) { |
| | | time = parseInt(time) |
| | | } else if (typeof time === 'string') { |
| | | time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), ''); |
| | | } else if (typeof time === "string") { |
| | | time = time |
| | | .replace(new RegExp(/-/gm), "/") |
| | | .replace("T", " ") |
| | | .replace(new RegExp(/\.[\d]{3}/gm), "") |
| | | } |
| | | if ((typeof time === 'number') && (time.toString().length === 10)) { |
| | | if (typeof time === "number" && time.toString().length === 10) { |
| | | time = time * 1000 |
| | | } |
| | | date = new Date(time) |
| | |
| | | h: date.getHours(), |
| | | i: date.getMinutes(), |
| | | s: date.getSeconds(), |
| | | a: date.getDay() |
| | | a: date.getDay(), |
| | | } |
| | | const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { |
| | | let value = formatObj[key] |
| | | // Note: getDay() returns 0 on Sunday |
| | | if (key === 'a') { return ['æ¥', 'ä¸', 'äº', 'ä¸', 'å', 'äº', 'å
'][value] } |
| | | if (key === "a") { |
| | | return ["æ¥", "ä¸", "äº", "ä¸", "å", "äº", "å
"][value] |
| | | } |
| | | if (result.length > 0 && value < 10) { |
| | | value = '0' + value |
| | | value = "0" + value |
| | | } |
| | | return value || 0 |
| | | }) |
| | |
| | | // 表åéç½® |
| | | export function resetForm(refName) { |
| | | if (this.$refs[refName]) { |
| | | this.$refs[refName].resetFields(); |
| | | this.$refs[refName].resetFields() |
| | | } |
| | | } |
| | | |
| | | // æ·»å æ¥æèå´ |
| | | export function addDateRange(params, dateRange, propName) { |
| | | let search = params; |
| | | search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {}; |
| | | dateRange = Array.isArray(dateRange) ? dateRange : []; |
| | | if (typeof (propName) === 'undefined') { |
| | | search.params['beginTime'] = dateRange[0]; |
| | | search.params['endTime'] = dateRange[1]; |
| | | let search = params |
| | | search.params = |
| | | typeof search.params === "object" && search.params !== null && !Array.isArray(search.params) ? search.params : {} |
| | | dateRange = Array.isArray(dateRange) ? dateRange : [] |
| | | if (typeof propName === "undefined") { |
| | | search.params["beginTime"] = dateRange[0] |
| | | search.params["endTime"] = dateRange[1] |
| | | } else { |
| | | search.params['begin' + propName] = dateRange[0]; |
| | | search.params['end' + propName] = dateRange[1]; |
| | | search.params["begin" + propName] = dateRange[0] |
| | | search.params["end" + propName] = dateRange[1] |
| | | } |
| | | return search; |
| | | return search |
| | | } |
| | | |
| | | // åæ¾æ°æ®åå
¸ |
| | | export function selectDictLabel(datas, value) { |
| | | if (value === undefined) { |
| | | return ""; |
| | | return "" |
| | | } |
| | | var actions = []; |
| | | var actions = [] |
| | | Object.keys(datas).some((key) => { |
| | | if (datas[key].value == ('' + value)) { |
| | | actions.push(datas[key].label); |
| | | return true; |
| | | if (datas[key].value == "" + value) { |
| | | actions.push(datas[key].label) |
| | | return true |
| | | } |
| | | }) |
| | | if (actions.length === 0) { |
| | | actions.push(value); |
| | | actions.push(value) |
| | | } |
| | | return actions.join(''); |
| | | return actions.join("") |
| | | } |
| | | |
| | | // åæ¾æ°æ®åå
¸ï¼å符串æ°ç»ï¼ |
| | | export function selectDictLabels(datas, value, separator) { |
| | | if (value === undefined || value.length ===0) { |
| | | return ""; |
| | | if (value === undefined || value.length === 0) { |
| | | return "" |
| | | } |
| | | if (Array.isArray(value)) { |
| | | value = value.join(","); |
| | | value = value.join(",") |
| | | } |
| | | var actions = []; |
| | | var currentSeparator = undefined === separator ? "," : separator; |
| | | var temp = value.split(currentSeparator); |
| | | var actions = [] |
| | | var currentSeparator = undefined === separator ? "," : separator |
| | | var temp = value.split(currentSeparator) |
| | | Object.keys(value.split(currentSeparator)).some((val) => { |
| | | var match = false; |
| | | var match = false |
| | | Object.keys(datas).some((key) => { |
| | | if (datas[key].value == ('' + temp[val])) { |
| | | actions.push(datas[key].label + currentSeparator); |
| | | match = true; |
| | | if (datas[key].value == "" + temp[val]) { |
| | | actions.push(datas[key].label + currentSeparator) |
| | | match = true |
| | | } |
| | | }) |
| | | if (!match) { |
| | | actions.push(temp[val] + currentSeparator); |
| | | actions.push(temp[val] + currentSeparator) |
| | | } |
| | | }) |
| | | return actions.join('').substring(0, actions.join('').length - 1); |
| | | return actions.join("").substring(0, actions.join("").length - 1) |
| | | } |
| | | |
| | | // åç¬¦ä¸²æ ¼å¼å(%s ) |
| | | export function sprintf(str) { |
| | | var args = arguments, flag = true, i = 1; |
| | | var args = arguments, |
| | | flag = true, |
| | | i = 1 |
| | | str = str.replace(/%s/g, function () { |
| | | var arg = args[i++]; |
| | | if (typeof arg === 'undefined') { |
| | | flag = false; |
| | | return ''; |
| | | var arg = args[i++] |
| | | if (typeof arg === "undefined") { |
| | | flag = false |
| | | return "" |
| | | } |
| | | return arg; |
| | | }); |
| | | return flag ? str : ''; |
| | | return arg |
| | | }) |
| | | return flag ? str : "" |
| | | } |
| | | |
| | | // 转æ¢å符串ï¼undefined,nullç转å为"" |
| | | export function parseStrEmpty(str) { |
| | | if (!str || str == "undefined" || str == "null") { |
| | | return ""; |
| | | return "" |
| | | } |
| | | return str; |
| | | return str |
| | | } |
| | | |
| | | // æ°æ®åå¹¶ |
| | |
| | | for (var p in target) { |
| | | try { |
| | | if (target[p].constructor == Object) { |
| | | source[p] = mergeRecursive(source[p], target[p]); |
| | | source[p] = mergeRecursive(source[p], target[p]) |
| | | } else { |
| | | source[p] = target[p]; |
| | | source[p] = target[p] |
| | | } |
| | | } catch (e) { |
| | | source[p] = target[p]; |
| | | source[p] = target[p] |
| | | } |
| | | } |
| | | return source; |
| | | }; |
| | | return source |
| | | } |
| | | |
| | | /** |
| | | * æé æ åç»ææ°æ® |
| | |
| | | */ |
| | | export function handleTree(data, id, parentId, children) { |
| | | let config = { |
| | | id: id || 'id', |
| | | parentId: parentId || 'parentId', |
| | | childrenList: children || 'children' |
| | | }; |
| | | id: id || "id", |
| | | parentId: parentId || "parentId", |
| | | childrenList: children || "children", |
| | | } |
| | | |
| | | var childrenListMap = {}; |
| | | var nodeIds = {}; |
| | | var tree = []; |
| | | var childrenListMap = {} |
| | | var nodeIds = {} |
| | | var tree = [] |
| | | |
| | | for (let d of data) { |
| | | let parentId = d[config.parentId]; |
| | | let parentId = d[config.parentId] |
| | | if (childrenListMap[parentId] == null) { |
| | | childrenListMap[parentId] = []; |
| | | childrenListMap[parentId] = [] |
| | | } |
| | | nodeIds[d[config.id]] = d; |
| | | childrenListMap[parentId].push(d); |
| | | nodeIds[d[config.id]] = d |
| | | childrenListMap[parentId].push(d) |
| | | } |
| | | |
| | | for (let d of data) { |
| | | let parentId = d[config.parentId]; |
| | | let parentId = d[config.parentId] |
| | | if (nodeIds[parentId] == null) { |
| | | tree.push(d); |
| | | tree.push(d) |
| | | } |
| | | } |
| | | |
| | | for (let t of tree) { |
| | | adaptToChildrenList(t); |
| | | adaptToChildrenList(t) |
| | | } |
| | | |
| | | function adaptToChildrenList(o) { |
| | | if (childrenListMap[o[config.id]] !== null) { |
| | | o[config.childrenList] = childrenListMap[o[config.id]]; |
| | | o[config.childrenList] = childrenListMap[o[config.id]] |
| | | } |
| | | if (o[config.childrenList]) { |
| | | for (let c of o[config.childrenList]) { |
| | | adaptToChildrenList(c); |
| | | adaptToChildrenList(c) |
| | | } |
| | | } |
| | | } |
| | | return tree; |
| | | return tree |
| | | } |
| | | |
| | | /** |
| | | * åæ°å¤ç |
| | | * @param {*} params åæ° |
| | | */ |
| | | * åæ°å¤ç |
| | | * @param {*} params åæ° |
| | | */ |
| | | export function tansParams(params) { |
| | | let result = '' |
| | | let result = "" |
| | | for (const propName of Object.keys(params)) { |
| | | const value = params[propName]; |
| | | var part = encodeURIComponent(propName) + "="; |
| | | if (value !== null && value !== "" && typeof (value) !== "undefined") { |
| | | if (typeof value === 'object') { |
| | | const value = params[propName] |
| | | var part = encodeURIComponent(propName) + "=" |
| | | if (value !== null && value !== "" && typeof value !== "undefined") { |
| | | if (typeof value === "object") { |
| | | for (const key of Object.keys(value)) { |
| | | if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') { |
| | | let params = propName + '[' + key + ']'; |
| | | var subPart = encodeURIComponent(params) + "="; |
| | | result += subPart + encodeURIComponent(value[key]) + "&"; |
| | | if (value[key] !== null && value[key] !== "" && typeof value[key] !== "undefined") { |
| | | let params = propName + "[" + key + "]" |
| | | var subPart = encodeURIComponent(params) + "=" |
| | | result += subPart + encodeURIComponent(value[key]) + "&" |
| | | } |
| | | } |
| | | } else { |
| | | result += part + encodeURIComponent(value) + "&"; |
| | | result += part + encodeURIComponent(value) + "&" |
| | | } |
| | | } |
| | | } |
| | | return result |
| | | } |
| | | |
| | | |
| | | // è¿å项ç®è·¯å¾ |
| | | export function getNormalPath(p) { |
| | | if (p.length === 0 || !p || p == 'undefined') { |
| | | if (p.length === 0 || !p || p == "undefined") { |
| | | return p |
| | | }; |
| | | let res = p.replace('//', '/') |
| | | if (res[res.length - 1] === '/') { |
| | | } |
| | | let res = p.replace("//", "/") |
| | | if (res[res.length - 1] === "/") { |
| | | return res.slice(0, res.length - 1) |
| | | } |
| | | return res; |
| | | return res |
| | | } |
| | | |
| | | // éªè¯æ¯å¦ä¸ºblobæ ¼å¼ |
| | | export function blobValidate(data) { |
| | | return data.type !== 'application/json' |
| | | return data.type !== "application/json" |
| | | } |
| | | |
| | | // éç¨ä¸è½½æ¹æ³ |
| | | const baseURL = import.meta.env.VITE_APP_BASE_API |
| | | export function download(fileName) { |
| | | window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true |
| | | } |
| | | |
| | | // éç¨ä¸è½½æ¹æ³ showfileNameï¼ä¸è½½åçæä»¶å称带æ©å±å;filePath:è¦ä¸è½½æä»¶çç»å¯¹è·¯å¾,带çæä»¶ååæ©å±åï¼deleteflageä¸è½½å®æåæ¯å¦å 餿件 |
| | | export function fileDownload(showfileName, filePath, deleteflage) { |
| | | window.location.href = |
| | | baseURL + |
| | | "/common/downloadAssign?showFileName=" + |
| | | encodeURI(showfileName) + |
| | | "&filePath=" + |
| | | encodeURI(filePath) + |
| | | "&delete=" + |
| | | deleteflage |
| | | } |
| | |
| | | <div class="form-card"> |
| | | <el-form :model="form" ref="queryRef" :inline="true" label-width="85px"> |
| | | <el-form-item label="æé´" prop="timeType"> |
| | | <el-select v-model="queryParams.timeType" placeholder="æé´" clearable style="width: 100%" |
| | | @change="handleTimeType"> |
| | | <el-select |
| | | v-model="queryParams.timeType" |
| | | placeholder="æé´" |
| | | clearable |
| | | style="width: 100%" |
| | | @change="handleTimeType" |
| | | > |
| | | <el-option v-for="dict in period" :key="dict.value" :label="dict.label" :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ¶é´"> |
| | | <el-date-picker v-model="queryParams.dataTime" :clearable="false" |
| | | <el-date-picker |
| | | v-model="queryParams.dataTime" |
| | | :clearable="false" |
| | | :type="queryParams.timeType == 'YEAR' ? 'year' : queryParams.timeType == 'MONTH' ? 'month' : 'date'" |
| | | :format="queryParams.timeType == 'YEAR' ? 'YYYY' : queryParams.timeType == 'MONTH' ? 'YYYY-MM' : 'YYYY-MM-DD'" |
| | | value-format="YYYY-MM-DD" placeholder="æ¶é´" style="width: 100%" /> |
| | | :format=" |
| | | queryParams.timeType == 'YEAR' ? 'YYYY' : queryParams.timeType == 'MONTH' ? 'YYYY-MM' : 'YYYY-MM-DD' |
| | | " |
| | | value-format="YYYY-MM-DD" |
| | | placeholder="æ¶é´" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import * as echarts from 'echarts'; |
| | | import { onMounted, reactive, ref } from 'vue'; |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const { period } = proxy.useDict("period"); |
| | | let { alarm_record_category } = proxy.useDict("alarm_record_category"); |
| | | import * as echarts from "echarts" |
| | | import { onMounted, reactive, ref } from "vue" |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType" |
| | | const { proxy } = getCurrentInstance() |
| | | const { period } = proxy.useDict("period") |
| | | let { alarm_record_category } = proxy.useDict("alarm_record_category") |
| | | let energyTypeList = ref([]) |
| | | function getEnergyTypeList() { |
| | | listEnergyTypeList().then((res) => { |
| | | energyTypeList.value = res.data; |
| | | }); |
| | | energyTypeList.value = res.data |
| | | }) |
| | | } |
| | | getEnergyTypeList() |
| | | function formatterLabel(list, value) { |
| | | console.log(list, value); |
| | | console.log(list, value) |
| | | |
| | | let dict = list.find(item => item.enersno == value) |
| | | return dict ? dict.enername : '' |
| | | let dict = list.find((item) => item.enersno == value) |
| | | return dict ? dict.enername : "" |
| | | } |
| | | |
| | | |
| | | let queryParams = ref({ |
| | | timeType: null, |
| | | dataTime: null, |
| | | nodeId: null |
| | | nodeId: null, |
| | | }) |
| | | |
| | | import { getByNodeId, getCountInfo } from "@/api/alarmManage/alarmManage"; |
| | | import { el } from 'element-plus/es/locales.mjs'; |
| | | let form = ref({}); |
| | | import { getByNodeId, getCountInfo } from "@/api/alarmManage/alarmManage" |
| | | import { el } from "element-plus/es/locales.mjs" |
| | | let form = ref({}) |
| | | let currentNode = ref() |
| | | |
| | | function handleTimeType(e) { |
| | | queryParams.value.timeType = e; |
| | | queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD"); |
| | | queryParams.value.timeType = e |
| | | queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD") |
| | | } |
| | | function handleNodeClick(e) { |
| | | currentNode.value = e |
| | | queryParams.value.nodeId = e.id |
| | | handleTimeType('YEAR') |
| | | handleTimeType("YEAR") |
| | | getByNodeIdFun() |
| | | } |
| | | |
| | | function getByNodeIdFun() { |
| | | getByNodeId(queryParams.value).then(res => { |
| | | getByNodeId(queryParams.value).then((res) => { |
| | | let alarmList = [] |
| | | let energyList = [] |
| | | let alarmNumberList = { |
| | | data: [], |
| | | xAxisData: [] |
| | | xAxisData: [], |
| | | } |
| | | console.log(111, res); |
| | | console.log(111, res) |
| | | if (res.code == 200) { |
| | | let { data } = res |
| | | alarmList = data.alarmProportion.map(item => { |
| | | alarmList = data.alarmProportion.map((item) => { |
| | | return { |
| | | name: proxy.selectDictLabel(alarm_record_category.value, item.energyName), |
| | | value: item.percentage |
| | | value: item.percentage, |
| | | } |
| | | }) |
| | | energyList = data.energyProportion.map(item => { |
| | | energyList = data.energyProportion.map((item) => { |
| | | return { |
| | | name: formatterLabel(energyTypeList.value, item.energyName), |
| | | value: item.percentage |
| | | value: item.percentage, |
| | | } |
| | | }) |
| | | for (const item of data.chartDataList) { |
| | |
| | | alarmNumberList.data.push(item.yvalue) |
| | | } |
| | | |
| | | pieChart('Chart1', alarmList, 'æ¥è¦ç±»åå æ¯') |
| | | pieChart('Chart2', energyList, 'è½æºç±»åå æ¯') |
| | | getChart('Chart3', alarmNumberList) |
| | | pieChart("Chart1", alarmList, "æ¥è¦ç±»åå æ¯") |
| | | pieChart("Chart2", energyList, "è½æºç±»åå æ¯") |
| | | getChart("Chart3", alarmNumberList) |
| | | } |
| | | }) |
| | | } |
| | |
| | | getByNodeIdFun() |
| | | } |
| | | function resetQuery() { |
| | | handleTimeType('YEAR') |
| | | handleTimeType("YEAR") |
| | | getByNodeIdFun() |
| | | } |
| | | |
| | | |
| | | function pieChart(Id, data, name) { |
| | | let total = 0; |
| | | let total = 0 |
| | | data.forEach(function (val, idx, arr) { |
| | | total += val.value; |
| | | total += val.value |
| | | }) |
| | | const myChart = echarts.init(document.getElementById(Id)); |
| | | const myChart = echarts.init(document.getElementById(Id)) |
| | | myChart.setOption({ |
| | | color: ['#4D94FF', '#00C27C', '#F0142F', '#F2D261', '#0E7CE2', '#FF8352', '#E271DE', '#F8456B', '#00FFFF', '#4AEAB0'], |
| | | color: [ |
| | | "#4D94FF", |
| | | "#00C27C", |
| | | "#F0142F", |
| | | "#F2D261", |
| | | "#0E7CE2", |
| | | "#FF8352", |
| | | "#E271DE", |
| | | "#F8456B", |
| | | "#00FFFF", |
| | | "#4AEAB0", |
| | | ], |
| | | grid: { |
| | | top: '20%', |
| | | left: '1%', |
| | | right: '1%', |
| | | bottom: '0%', |
| | | containLabel: true |
| | | top: "20%", |
| | | left: "1%", |
| | | right: "1%", |
| | | bottom: "0%", |
| | | containLabel: true, |
| | | }, |
| | | tooltip: { |
| | | trigger: 'item' |
| | | trigger: "item", |
| | | }, |
| | | legend: { |
| | | orient: 'vertical', |
| | | top: 'center', |
| | | icon: 'circle', |
| | | orient: "vertical", |
| | | top: "center", |
| | | icon: "circle", |
| | | itemWidth: 14, |
| | | itemHeight: 14, |
| | | right: '2%', |
| | | right: "2%", |
| | | itemGap: 10, |
| | | textStyle: { |
| | | align: 'left', |
| | | verticalAlign: 'middle', |
| | | align: "left", |
| | | verticalAlign: "middle", |
| | | rich: { |
| | | name: { |
| | | color: '#999', |
| | | color: "#999", |
| | | fontSize: 14, |
| | | }, |
| | | value: { |
| | | color: '#999', |
| | | color: "#999", |
| | | fontSize: 14, |
| | | }, |
| | | rate: { |
| | | color: '#999', |
| | | color: "#999", |
| | | fontSize: 14, |
| | | }, |
| | | }, |
| | | }, |
| | | formatter: (name) => { |
| | | if (data.length) { |
| | | let target, percent; |
| | | let target, percent |
| | | for (let i = 0; i < data.length; i++) { |
| | | if (data[i].name === name) { |
| | | target = data[i].value; |
| | | percent = ((target / total) * 100).toFixed(2); |
| | | target = data[i].value |
| | | percent = ((target / total) * 100).toFixed(2) |
| | | } |
| | | } |
| | | return `{name|${name} }{value| ${target}} {rate| ${percent}%}`; |
| | | |
| | | return `{name|${name} }{value| ${target}} {rate| ${percent}%}` |
| | | } else { |
| | | return `{name|${name} }{value| ${0}} {rate| ${0}%}`; |
| | | |
| | | return `{name|${name} }{value| ${0}} {rate| ${0}%}` |
| | | } |
| | | }, |
| | | }, |
| | | series: [{ |
| | | name, |
| | | type: 'pie', |
| | | radius: ['45%', '70%'], |
| | | center: ['35%', '50%'], |
| | | avoidLabelOverlap: false, |
| | | label: { |
| | | show: false, |
| | | overflow: 'none', |
| | | formatter: '{b} {d}% \n {c} tce', |
| | | series: [ |
| | | { |
| | | name, |
| | | type: "pie", |
| | | radius: ["45%", "70%"], |
| | | center: ["35%", "50%"], |
| | | avoidLabelOverlap: false, |
| | | label: { |
| | | show: false, |
| | | overflow: "none", |
| | | formatter: "{b} {d}% \n {c} tce", |
| | | }, |
| | | data, |
| | | }, |
| | | data, |
| | | }] |
| | | ], |
| | | }) |
| | | } |
| | | function getChart(Id, dataList) { |
| | | const myChart3 = echarts.init(document.getElementById(Id)); |
| | | myChart3.setOption( |
| | | { |
| | | |
| | | grid: { |
| | | left: '3%', |
| | | right: '2%', |
| | | bottom: '2%', |
| | | containLabel: true |
| | | const myChart3 = echarts.init(document.getElementById(Id)) |
| | | myChart3.setOption({ |
| | | grid: { |
| | | left: "3%", |
| | | right: "2%", |
| | | bottom: "2%", |
| | | containLabel: true, |
| | | }, |
| | | tooltip: { |
| | | trigger: "axis", |
| | | }, |
| | | xAxis: { |
| | | type: "category", |
| | | // boundaryGap: false, |
| | | data: dataList.xAxisData, |
| | | axisPointer: { |
| | | type: "shadow", |
| | | }, |
| | | tooltip: { |
| | | trigger: 'axis', |
| | | |
| | | axisTick: { |
| | | show: false, |
| | | alignWithLabel: true, |
| | | length: 5, |
| | | }, |
| | | xAxis: { |
| | | type: 'category', |
| | | // boundaryGap: false, |
| | | data: dataList.xAxisData, |
| | | axisPointer: { |
| | | type: 'shadow' |
| | | // åæ è½´å»åº¦çº¿æ ·å¼ |
| | | axisTick: { |
| | | show: false, |
| | | length: 5, |
| | | lineStyle: { |
| | | color: "#ddd", |
| | | }, |
| | | axisTick: { |
| | | show: false, |
| | | alignWithLabel: true, |
| | | length: 5 |
| | | }, |
| | | // åæ è½´å»åº¦çº¿æ ·å¼ |
| | | axisTick: { |
| | | show: false, |
| | | length: 5, |
| | | lineStyle: { |
| | | color: '#ddd' |
| | | } |
| | | }, |
| | | |
| | | // åå²çº¿ |
| | | splitLine: { |
| | | show: false, |
| | | lineStyle: { |
| | | type: 'dashed', |
| | | color: 'rgba(220,222,226,0.4)' |
| | | } |
| | | }, |
| | | axisLabel: { |
| | | color: '#999', |
| | | fontSize: 14, |
| | | padding: [5, 0, 0, 0], |
| | | // formatter: '{value} ml' |
| | | } |
| | | }, |
| | | yAxis: { |
| | | type: 'value', |
| | | name: 'ï¼æ¬¡ï¼', |
| | | // 设置åç§°æ ·å¼ |
| | | nameTextStyle: { |
| | | color: ' #CEE3FF', |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | | // åæ è½´å»åº¦ |
| | | axisTick: { |
| | | show: false, |
| | | alignWithLabel: true, |
| | | length: 5 |
| | | }, |
| | | // åæ è½´å»åº¦çº¿æ ·å¼ |
| | | axisTick: { |
| | | show: false, |
| | | length: 5, |
| | | lineStyle: { |
| | | color: '' |
| | | } |
| | | }, |
| | | |
| | | // åå²çº¿ |
| | | splitLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | type: 'dashed', |
| | | color: 'rgba(220,222,226,0.4)' |
| | | } |
| | | // åå²çº¿ |
| | | splitLine: { |
| | | show: false, |
| | | lineStyle: { |
| | | type: "dashed", |
| | | color: "rgba(220,222,226,0.4)", |
| | | }, |
| | | |
| | | // åæ è½´å»åº¦é´é |
| | | // interval: '50', |
| | | // // åæ è½´æå°å¼ |
| | | // min: 'dataMin', |
| | | // // åæ è½´æå¤§å¼ |
| | | // max: 'dataMax', |
| | | // // åæ è½´å°æ°ç¹ç²¾åº¦ |
| | | // precision: 0, |
| | | // // åæ è½´å»åº¦ææ¬çå¸å±æå |
| | | // position: 'left' |
| | | axisLabel: { |
| | | color: '#B2B8C2', |
| | | fontSize: 14, |
| | | // formatter: '{value} ml' |
| | | } |
| | | }, |
| | | series: [ |
| | | { |
| | | name: "æ¥è¦æ¬¡æ°", |
| | | type: "bar", |
| | | barWidth: '17', |
| | | stack: 'number', |
| | | data: dataList.data, |
| | | tooltip: { |
| | | show: false, |
| | | } |
| | | axisLabel: { |
| | | color: "#999", |
| | | fontSize: 14, |
| | | padding: [5, 0, 0, 0], |
| | | // formatter: '{value} ml' |
| | | }, |
| | | }, |
| | | yAxis: { |
| | | type: "value", |
| | | name: "ï¼æ¬¡ï¼", |
| | | // 设置åç§°æ ·å¼ |
| | | nameTextStyle: { |
| | | color: " #CEE3FF", |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | | // åæ è½´å»åº¦ |
| | | axisTick: { |
| | | show: false, |
| | | alignWithLabel: true, |
| | | length: 5, |
| | | }, |
| | | // åæ è½´å»åº¦çº¿æ ·å¼ |
| | | axisTick: { |
| | | show: false, |
| | | length: 5, |
| | | lineStyle: { |
| | | color: "", |
| | | }, |
| | | { |
| | | name: 'æ¥è¦æ¬¡æ°', |
| | | type: 'line', |
| | | symbol: 'none', // 设置为 'none' 廿åç¹ |
| | | lineStyle: { |
| | | color: '#EE0303' |
| | | }, |
| | | data: dataList.data, |
| | | }, |
| | | ] |
| | | }) |
| | | }, |
| | | |
| | | window.addEventListener("resize", () => { |
| | | myChart1.resize(); |
| | | myChart2.resize(); |
| | | myChart3.resize(); |
| | | }, { passive: true }); |
| | | // åå²çº¿ |
| | | splitLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | type: "dashed", |
| | | color: "rgba(220,222,226,0.4)", |
| | | }, |
| | | }, |
| | | |
| | | // åæ è½´å»åº¦é´é |
| | | // interval: '50', |
| | | // // åæ è½´æå°å¼ |
| | | // min: 'dataMin', |
| | | // // åæ è½´æå¤§å¼ |
| | | // max: 'dataMax', |
| | | // // åæ è½´å°æ°ç¹ç²¾åº¦ |
| | | // precision: 0, |
| | | // // åæ è½´å»åº¦ææ¬çå¸å±æå |
| | | // position: 'left' |
| | | axisLabel: { |
| | | color: "#B2B8C2", |
| | | fontSize: 14, |
| | | // formatter: '{value} ml' |
| | | }, |
| | | }, |
| | | series: [ |
| | | { |
| | | name: "æ¥è¦æ¬¡æ°", |
| | | type: "bar", |
| | | barWidth: "12", |
| | | stack: "number", |
| | | data: dataList.data, |
| | | tooltip: { |
| | | show: false, |
| | | }, |
| | | }, |
| | | { |
| | | name: "æ¥è¦æ¬¡æ°", |
| | | type: "line", |
| | | symbol: "none", // 设置为 'none' 廿åç¹ |
| | | lineStyle: { |
| | | color: "#EE0303", |
| | | }, |
| | | data: dataList.data, |
| | | }, |
| | | ], |
| | | }) |
| | | |
| | | window.addEventListener( |
| | | "resize", |
| | | () => { |
| | | myChart1.resize() |
| | | myChart2.resize() |
| | | myChart3.resize() |
| | | }, |
| | | { passive: true } |
| | | ) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "@/assets/styles/page.scss"; |
| | | |
| | | |
| | | .chart-box { |
| | | height: calc((100vh - 410px)/2) !important; |
| | | height: calc((100vh - 410px) / 2) !important; |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <div class="form-card"> |
| | | <el-form :model="form" ref="queryRef" :inline="true" label-width="85px"> |
| | | <el-form-item label="æé´" prop="timeType"> |
| | | <el-select v-model="queryParams.timeType" placeholder="æé´" clearable style="width: 120px" |
| | | @change="handleTimeType"> |
| | | <el-select |
| | | v-model="queryParams.timeType" |
| | | placeholder="æé´" |
| | | clearable |
| | | style="width: 120px" |
| | | @change="handleTimeType" |
| | | > |
| | | <el-option v-for="dict in period" :key="dict.value" :label="dict.label" :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ¶é´"> |
| | | <el-date-picker v-model="queryParams.dataTime" :clearable="false" |
| | | <el-date-picker |
| | | v-model="queryParams.dataTime" |
| | | :clearable="false" |
| | | :type="queryParams.timeType == 'YEAR' ? 'year' : queryParams.timeType == 'MONTH' ? 'month' : 'date'" |
| | | :format="queryParams.timeType == 'YEAR' ? 'YYYY' : queryParams.timeType == 'MONTH' ? 'YYYY-MM' : 'YYYY-MM-DD'" |
| | | value-format="YYYY-MM-DD" placeholder="æ¶é´" style="width: 100%" /> |
| | | :format=" |
| | | queryParams.timeType == 'YEAR' ? 'YYYY' : queryParams.timeType == 'MONTH' ? 'YYYY-MM' : 'YYYY-MM-DD' |
| | | " |
| | | value-format="YYYY-MM-DD" |
| | | placeholder="æ¶é´" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | |
| | | </div> |
| | | |
| | | <div class="mt20 mb20 text-center data-item"> |
| | | æ¬ç¨è½åå
ææ <span>{{ dataArray.indexCount }}</span>ä¸ªï¼ |
| | | æ¬å¹´åº¦æ¥è¦<span>{{ dataArray.yearCount }}</span>æ¬¡ï¼æ¬æ<span>{{ dataArray.monthCount }}</span>次 |
| | | æ¬ç¨è½åå
ææ <span>{{ dataArray.indexCount }}</span |
| | | >ä¸ªï¼ æ¬å¹´åº¦æ¥è¦<span>{{ dataArray.yearCount }}</span |
| | | >æ¬¡ï¼æ¬æ<span>{{ dataArray.monthCount }}</span |
| | | >次 |
| | | </div> |
| | | <el-row :gutter="24" class="mb20"> |
| | | <el-col :span="12"> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import * as echarts from 'echarts'; |
| | | import { onMounted, reactive, ref } from 'vue'; |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const { period } = proxy.useDict("period"); |
| | | let { alarm_record_category } = proxy.useDict("alarm_record_category"); |
| | | import * as echarts from "echarts" |
| | | import { onMounted, reactive, ref } from "vue" |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType" |
| | | const { proxy } = getCurrentInstance() |
| | | const { period } = proxy.useDict("period") |
| | | let { alarm_record_category } = proxy.useDict("alarm_record_category") |
| | | let energyTypeList = ref([]) |
| | | function getEnergyTypeList() { |
| | | listEnergyTypeList().then((res) => { |
| | | energyTypeList.value = res.data; |
| | | queryParams.value.energyType = energyTypeList.value[0].enersno; |
| | | }); |
| | | energyTypeList.value = res.data |
| | | queryParams.value.energyType = energyTypeList.value[0].enersno |
| | | }) |
| | | } |
| | | getEnergyTypeList() |
| | | function formatterLabel(list, value) { |
| | | let dict = list.find(item => item.enersno == value) |
| | | return dict ? dict.enername : '' |
| | | let dict = list.find((item) => item.enersno == value) |
| | | return dict ? dict.enername : "" |
| | | } |
| | | |
| | | |
| | | let queryParams = ref({ |
| | | timeType: null, |
| | | dataTime: null, |
| | | nodeId: null |
| | | nodeId: null, |
| | | }) |
| | | |
| | | import { getByNodeId, getCountInfo } from "@/api/alarmManage/alarmManage"; |
| | | import { el } from 'element-plus/es/locales.mjs'; |
| | | let form = ref({}); |
| | | import { getByNodeId, getCountInfo } from "@/api/alarmManage/alarmManage" |
| | | import { el } from "element-plus/es/locales.mjs" |
| | | let form = ref({}) |
| | | let currentNode = ref() |
| | | |
| | | function handleTimeType(e) { |
| | | queryParams.value.timeType = e; |
| | | queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD"); |
| | | queryParams.value.timeType = e |
| | | queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD") |
| | | } |
| | | function handleNodeClick(e) { |
| | | currentNode.value = e |
| | | queryParams.value.nodeId = e.id |
| | | handleTimeType(period.value[0].value); |
| | | handleTimeType(period.value[0].value) |
| | | |
| | | getByNodeIdFun() |
| | | } |
| | | |
| | | function getByNodeIdFun() { |
| | | getByNodeId(queryParams.value).then(res => { |
| | | getByNodeId(queryParams.value).then((res) => { |
| | | let alarmList = [] |
| | | let energyList = [] |
| | | let alarmNumberList = { |
| | | data: [], |
| | | xAxisData: [] |
| | | xAxisData: [], |
| | | } |
| | | if (res.code == 200) { |
| | | let { data } = res |
| | | alarmList = data.alarmProportion.map(item => { |
| | | alarmList = data.alarmProportion.map((item) => { |
| | | return { |
| | | name: proxy.selectDictLabel(alarm_record_category.value, item.energyName), |
| | | value: item.count, |
| | | percentage: item.percentage |
| | | percentage: item.percentage, |
| | | } |
| | | }) |
| | | energyList = data.energyProportion.map(item => { |
| | | energyList = data.energyProportion.map((item) => { |
| | | return { |
| | | name: formatterLabel(energyTypeList.value, item.energyName), |
| | | value: item.count, |
| | | percentage: item.percentage |
| | | percentage: item.percentage, |
| | | } |
| | | }) |
| | | for (const item of data.chartDataList) { |
| | |
| | | alarmNumberList.data.push(item.yvalue) |
| | | } |
| | | |
| | | pieChart('Chart1', alarmList, 'æ¥è¦ç±»åå æ¯') |
| | | pieChart('Chart2', energyList, 'è½æºç±»åå æ¯') |
| | | getChart('Chart3', alarmNumberList) |
| | | pieChart("Chart1", alarmList, "æ¥è¦ç±»åå æ¯") |
| | | pieChart("Chart2", energyList, "è½æºç±»åå æ¯") |
| | | getChart("Chart3", alarmNumberList) |
| | | } |
| | | }) |
| | | } |
| | |
| | | getByNodeIdFun() |
| | | } |
| | | function resetQuery() { |
| | | handleTimeType('YEAR') |
| | | handleTimeType("YEAR") |
| | | getByNodeIdFun() |
| | | } |
| | | let dataArray = ref({ |
| | | indexCount: 0, |
| | | yearCount: 0, |
| | | monthCount: 0 |
| | | monthCount: 0, |
| | | }) |
| | | function getCountInfoFun() { |
| | | getCountInfo(queryParams.value).then(res => { |
| | | getCountInfo(queryParams.value).then((res) => { |
| | | if (res.code == 200) { |
| | | dataArray.value = res.data |
| | | } |
| | |
| | | getCountInfoFun() |
| | | function pieChart(Id, data, name) { |
| | | console.log(data) |
| | | let total = 0; |
| | | let total = 0 |
| | | data.forEach(function (val, idx, arr) { |
| | | total += val.value; |
| | | total += val.value |
| | | }) |
| | | const myChart = echarts.init(document.getElementById(Id)); |
| | | const myChart = echarts.init(document.getElementById(Id)) |
| | | myChart.setOption({ |
| | | color: ['#4D94FF', '#00C27C', '#F0142F', '#F2D261', '#0E7CE2', '#FF8352', '#E271DE', '#F8456B', '#00FFFF', '#4AEAB0'], |
| | | color: [ |
| | | "#4D94FF", |
| | | "#00C27C", |
| | | "#F0142F", |
| | | "#F2D261", |
| | | "#0E7CE2", |
| | | "#FF8352", |
| | | "#E271DE", |
| | | "#F8456B", |
| | | "#00FFFF", |
| | | "#4AEAB0", |
| | | ], |
| | | grid: { |
| | | top: '20%', |
| | | left: '1%', |
| | | right: '1%', |
| | | bottom: '0%', |
| | | containLabel: true |
| | | top: "20%", |
| | | left: "1%", |
| | | right: "1%", |
| | | bottom: "0%", |
| | | containLabel: true, |
| | | }, |
| | | tooltip: { |
| | | trigger: 'item' |
| | | trigger: "item", |
| | | }, |
| | | legend: { |
| | | orient: 'vertical', |
| | | top: 'center', |
| | | icon: 'circle', |
| | | orient: "vertical", |
| | | top: "center", |
| | | icon: "circle", |
| | | itemWidth: 14, |
| | | itemHeight: 14, |
| | | right: '2%', |
| | | right: "2%", |
| | | itemGap: 10, |
| | | textStyle: { |
| | | align: 'left', |
| | | verticalAlign: 'middle', |
| | | align: "left", |
| | | verticalAlign: "middle", |
| | | rich: { |
| | | name: { |
| | | color: '#999', |
| | | color: "#999", |
| | | fontSize: 14, |
| | | }, |
| | | value: { |
| | | color: '#999', |
| | | color: "#999", |
| | | fontSize: 14, |
| | | }, |
| | | rate: { |
| | | color: '#999', |
| | | color: "#999", |
| | | fontSize: 14, |
| | | }, |
| | | }, |
| | |
| | | formatter: (name) => { |
| | | for (let i = 0; i < data.length; i++) { |
| | | if (data[i].name === name) { |
| | | return `{name|${data[i].name} }{value| ${data[i].value}} {rate| ${data[i].percentage}%}`; |
| | | return `{name|${data[i].name} }{value| ${data[i].value}} {rate| ${data[i].percentage}%}` |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | series: [{ |
| | | name, |
| | | type: 'pie', |
| | | radius: ['45%', '70%'], |
| | | center: ['35%', '50%'], |
| | | avoidLabelOverlap: false, |
| | | label: { |
| | | show: false, |
| | | overflow: 'none', |
| | | formatter: '{b} {d}% \n {c} tce', |
| | | series: [ |
| | | { |
| | | name, |
| | | type: "pie", |
| | | radius: ["45%", "70%"], |
| | | center: ["35%", "50%"], |
| | | avoidLabelOverlap: false, |
| | | label: { |
| | | show: false, |
| | | overflow: "none", |
| | | formatter: "{b} {d}% \n {c} tce", |
| | | }, |
| | | data, |
| | | }, |
| | | data, |
| | | }] |
| | | ], |
| | | }) |
| | | } |
| | | function getChart(Id, dataList) { |
| | | const myChart3 = echarts.init(document.getElementById(Id)); |
| | | myChart3.setOption( |
| | | { |
| | | |
| | | grid: { |
| | | left: '3%', |
| | | right: '2%', |
| | | bottom: '2%', |
| | | containLabel: true |
| | | const myChart3 = echarts.init(document.getElementById(Id)) |
| | | myChart3.setOption({ |
| | | grid: { |
| | | left: "3%", |
| | | right: "2%", |
| | | bottom: "2%", |
| | | containLabel: true, |
| | | }, |
| | | tooltip: { |
| | | trigger: "axis", |
| | | }, |
| | | xAxis: { |
| | | type: "category", |
| | | // boundaryGap: false, |
| | | data: dataList.xAxisData, |
| | | axisPointer: { |
| | | type: "shadow", |
| | | }, |
| | | tooltip: { |
| | | trigger: 'axis', |
| | | |
| | | axisTick: { |
| | | show: false, |
| | | alignWithLabel: true, |
| | | length: 5, |
| | | }, |
| | | xAxis: { |
| | | type: 'category', |
| | | // boundaryGap: false, |
| | | data: dataList.xAxisData, |
| | | axisPointer: { |
| | | type: 'shadow' |
| | | // åæ è½´å»åº¦çº¿æ ·å¼ |
| | | axisTick: { |
| | | show: false, |
| | | length: 5, |
| | | lineStyle: { |
| | | color: "#ddd", |
| | | }, |
| | | axisTick: { |
| | | show: false, |
| | | alignWithLabel: true, |
| | | length: 5 |
| | | }, |
| | | // åæ è½´å»åº¦çº¿æ ·å¼ |
| | | axisTick: { |
| | | show: false, |
| | | length: 5, |
| | | lineStyle: { |
| | | color: '#ddd' |
| | | } |
| | | }, |
| | | |
| | | // åå²çº¿ |
| | | splitLine: { |
| | | show: false, |
| | | lineStyle: { |
| | | type: 'dashed', |
| | | color: 'rgba(220,222,226,0.4)' |
| | | } |
| | | }, |
| | | axisLabel: { |
| | | color: '#999', |
| | | fontSize: 14, |
| | | padding: [5, 0, 0, 0], |
| | | // formatter: '{value} ml' |
| | | } |
| | | }, |
| | | yAxis: { |
| | | type: 'value', |
| | | name: 'ï¼æ¬¡ï¼', |
| | | // 设置åç§°æ ·å¼ |
| | | nameTextStyle: { |
| | | color: ' #CEE3FF', |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | | // åæ è½´å»åº¦ |
| | | axisTick: { |
| | | show: false, |
| | | alignWithLabel: true, |
| | | length: 5 |
| | | }, |
| | | // åæ è½´å»åº¦çº¿æ ·å¼ |
| | | axisTick: { |
| | | show: false, |
| | | length: 5, |
| | | lineStyle: { |
| | | color: '' |
| | | } |
| | | }, |
| | | |
| | | // åå²çº¿ |
| | | splitLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | type: 'dashed', |
| | | color: 'rgba(220,222,226,0.4)' |
| | | } |
| | | // åå²çº¿ |
| | | splitLine: { |
| | | show: false, |
| | | lineStyle: { |
| | | type: "dashed", |
| | | color: "rgba(220,222,226,0.4)", |
| | | }, |
| | | |
| | | // åæ è½´å»åº¦é´é |
| | | // interval: '50', |
| | | // // åæ è½´æå°å¼ |
| | | // min: 'dataMin', |
| | | // // åæ è½´æå¤§å¼ |
| | | // max: 'dataMax', |
| | | // // åæ è½´å°æ°ç¹ç²¾åº¦ |
| | | // precision: 0, |
| | | // // åæ è½´å»åº¦ææ¬çå¸å±æå |
| | | // position: 'left' |
| | | axisLabel: { |
| | | color: '#B2B8C2', |
| | | fontSize: 14, |
| | | // formatter: '{value} ml' |
| | | } |
| | | }, |
| | | series: [ |
| | | { |
| | | name: "æ¥è¦æ¬¡æ°", |
| | | type: "bar", |
| | | barWidth: '17', |
| | | stack: 'number', |
| | | data: dataList.data, |
| | | tooltip: { |
| | | show: false, |
| | | } |
| | | axisLabel: { |
| | | color: "#999", |
| | | fontSize: 14, |
| | | padding: [5, 0, 0, 0], |
| | | // formatter: '{value} ml' |
| | | }, |
| | | }, |
| | | yAxis: { |
| | | type: "value", |
| | | name: "ï¼æ¬¡ï¼", |
| | | // 设置åç§°æ ·å¼ |
| | | nameTextStyle: { |
| | | color: " #CEE3FF", |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | | // åæ è½´å»åº¦ |
| | | axisTick: { |
| | | show: false, |
| | | alignWithLabel: true, |
| | | length: 5, |
| | | }, |
| | | // åæ è½´å»åº¦çº¿æ ·å¼ |
| | | axisTick: { |
| | | show: false, |
| | | length: 5, |
| | | lineStyle: { |
| | | color: "", |
| | | }, |
| | | { |
| | | name: 'æ¥è¦æ¬¡æ°', |
| | | type: 'line', |
| | | symbol: 'none', // 设置为 'none' 廿åç¹ |
| | | lineStyle: { |
| | | color: '#EE0303' |
| | | }, |
| | | data: dataList.data, |
| | | }, |
| | | ] |
| | | }) |
| | | }, |
| | | |
| | | window.addEventListener("resize", () => { |
| | | myChart1.resize(); |
| | | myChart2.resize(); |
| | | myChart3.resize(); |
| | | }, { passive: true }); |
| | | // åå²çº¿ |
| | | splitLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | type: "dashed", |
| | | color: "rgba(220,222,226,0.4)", |
| | | }, |
| | | }, |
| | | |
| | | // åæ è½´å»åº¦é´é |
| | | // interval: '50', |
| | | // // åæ è½´æå°å¼ |
| | | // min: 'dataMin', |
| | | // // åæ è½´æå¤§å¼ |
| | | // max: 'dataMax', |
| | | // // åæ è½´å°æ°ç¹ç²¾åº¦ |
| | | // precision: 0, |
| | | // // åæ è½´å»åº¦ææ¬çå¸å±æå |
| | | // position: 'left' |
| | | axisLabel: { |
| | | color: "#B2B8C2", |
| | | fontSize: 14, |
| | | // formatter: '{value} ml' |
| | | }, |
| | | }, |
| | | series: [ |
| | | { |
| | | name: "æ¥è¦æ¬¡æ°", |
| | | type: "bar", |
| | | barWidth: "12", |
| | | stack: "number", |
| | | data: dataList.data, |
| | | tooltip: { |
| | | show: false, |
| | | }, |
| | | }, |
| | | { |
| | | name: "æ¥è¦æ¬¡æ°", |
| | | type: "line", |
| | | symbol: "none", // 设置为 'none' 廿åç¹ |
| | | lineStyle: { |
| | | color: "#EE0303", |
| | | }, |
| | | data: dataList.data, |
| | | }, |
| | | ], |
| | | }) |
| | | |
| | | window.addEventListener( |
| | | "resize", |
| | | () => { |
| | | myChart1.resize() |
| | | myChart2.resize() |
| | | myChart3.resize() |
| | | }, |
| | | { passive: true } |
| | | ) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "@/assets/styles/page.scss"; |
| | | |
| | | |
| | | .chart-box { |
| | | height: calc((100vh - 410px)/2) !important; |
| | | height: calc((100vh - 410px) / 2) !important; |
| | | } |
| | | |
| | | .data-item { |
| | |
| | | font-weight: bold; |
| | | |
| | | span { |
| | | color: #397AEE; |
| | | color: #397aee; |
| | | margin: 0 5px; |
| | | } |
| | | } |
| | |
| | | font-weight: bold; |
| | | |
| | | span { |
| | | color: #397AEE; |
| | | color: #397aee; |
| | | margin: 0 5px; |
| | | } |
| | | } |
| | | |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <div class="form-card"> |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true"> |
| | | <el-form-item label="æé´" prop="timeType"> |
| | | <el-select v-model="queryParams.timeType" placeholder="æé´" clearable style="width: 120px" |
| | | @change="handleTimeType"> |
| | | <el-select |
| | | v-model="queryParams.timeType" |
| | | placeholder="æé´" |
| | | clearable |
| | | style="width: 120px" |
| | | @change="handleTimeType" |
| | | > |
| | | <el-option v-for="dict in period" :key="dict.value" :label="dict.label" :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ¶é´"> |
| | | <el-date-picker v-model="queryParams.dataTime" :type="queryParams.timeType == 'YEAR' |
| | | ? 'year' |
| | | : queryParams.timeType == 'MONTH' |
| | | ? 'month' |
| | | : 'date' |
| | | " :format="queryParams.timeType == 'YEAR' |
| | | ? 'YYYY' |
| | | : queryParams.timeType == 'MONTH' |
| | | ? 'YYYY-MM' |
| | | : 'YYYY-MM-DD' |
| | | " value-format="YYYY-MM-DD" placeholder="æ¶é´" style="width: 100%" /> |
| | | <el-date-picker |
| | | v-model="queryParams.dataTime" |
| | | :type="queryParams.timeType == 'YEAR' ? 'year' : queryParams.timeType == 'MONTH' ? 'month' : 'date'" |
| | | :format=" |
| | | queryParams.timeType == 'YEAR' ? 'YYYY' : queryParams.timeType == 'MONTH' ? 'YYYY-MM' : 'YYYY-MM-DD' |
| | | " |
| | | value-format="YYYY-MM-DD" |
| | | placeholder="æ¶é´" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery"> |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button type="primary" icon="Search" @click="handleQuery"> æç´¢ </el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Download" @click="handleExport"> |
| | | å¯¼åº |
| | | </el-button> |
| | | <el-button type="primary" icon="Download" @click="handleExport"> å¯¼åº </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div style=" |
| | | height: calc(100vh - 220px) !important; |
| | | max-height: calc(100vh - 220px) !important; |
| | | overflow-y: auto; |
| | | "> |
| | | <div |
| | | style="height: calc(100vh - 220px) !important; max-height: calc(100vh - 220px) !important; overflow-y: auto" |
| | | > |
| | | <div class="card-list" v-if="listTop.length > 1"> |
| | | <el-button @click="dialogVisible = true"> æ¥çæ´å¤ </el-button> |
| | | </div> |
| | |
| | | <template v-for="(item, index) in row" :key="index"> |
| | | <div class="card-list-item"> |
| | | <div class="item-top"> |
| | | <div class="top-icon" :style="{ |
| | | backgroundImage: 'url(' + bgList[index].icon + ')', |
| | | }" /> |
| | | <div |
| | | class="top-icon" |
| | | :style="{ |
| | | backgroundImage: 'url(' + bgList[index].icon + ')', |
| | | }" |
| | | /> |
| | | <div class="top-right"> |
| | | {{ item.allEneryType }} |
| | | </div> |
| | |
| | | <div class="bottom-left">忝</div> |
| | | <div class="bottom-right" :style="{ color: bgList[index].color }"> |
| | | {{ Math.abs(item.yoyEnery) }}% |
| | | <el-icon v-if="!!item.yoyEnery" :color="item.yoyEnery > 0 |
| | | ? 'green' |
| | | : item.yoyEnery < 0 |
| | | ? 'red' |
| | | : '' |
| | | "> |
| | | <el-icon |
| | | v-if="!!item.yoyEnery" |
| | | :color="item.yoyEnery > 0 ? 'green' : item.yoyEnery < 0 ? 'red' : ''" |
| | | > |
| | | <Top v-if="item.yoyEnery > 0" /> |
| | | <Bottom v-if="item.yoyEnery < 0" /> |
| | | </el-icon> |
| | |
| | | </template> |
| | | </div> |
| | | </template> |
| | | <BaseCard :title="queryParams.nodeName + |
| | | '-ç¢³ææ¾éåç¯æ¯(' + |
| | | queryParams.dataTime + |
| | | ')' |
| | | "> |
| | | <BaseCard :title="queryParams.nodeName + '-ç¢³ææ¾éåç¯æ¯(' + queryParams.dataTime + ')'"> |
| | | <div class="chart-box" v-loading="loading"> |
| | | <div id="Chart1" /> |
| | | </div> |
| | | </BaseCard> |
| | | <BaseCard :title="queryParams.nodeName + |
| | | '-ç¢³ææ¾éç»è®¡åæè¡¨(' + |
| | | queryParams.dataTime + |
| | | ')' |
| | | "> |
| | | <BaseCard :title="queryParams.nodeName + '-ç¢³ææ¾éç»è®¡åæè¡¨(' + queryParams.dataTime + ')'"> |
| | | <div class="table-box"> |
| | | <el-table :data="listBottom" v-loading="loading"> |
| | | <el-table-column label="æ¶é´" align="center" key="xaxis" prop="xaxis" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="ç ´ææ¾é(tCOâe) |
| | | " align="center" key="yaxis" prop="yaxis" :show-overflow-tooltip="true" /> |
| | | <el-table-column |
| | | label="ç ´ææ¾é(tCOâe) |
| | | " |
| | | align="center" |
| | | key="yaxis" |
| | | prop="yaxis" |
| | | :show-overflow-tooltip="true" |
| | | /> |
| | | <el-table-column label="忝" align="center" key="yoy" prop="yoy" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="ç¯æ¯" align="center" key="qoq" prop="qoq" :show-overflow-tooltip="true" /> |
| | | </el-table> |
| | |
| | | <template v-for="(item, index) in row" :key="index"> |
| | | <div class="card-list-item"> |
| | | <div class="item-top"> |
| | | <div class="top-icon" :style="{ |
| | | backgroundImage: 'url(' + bgList[index].icon + ')', |
| | | }" /> |
| | | <div |
| | | class="top-icon" |
| | | :style="{ |
| | | backgroundImage: 'url(' + bgList[index].icon + ')', |
| | | }" |
| | | /> |
| | | <div class="top-right"> |
| | | {{ item.allEneryType }} |
| | | </div> |
| | |
| | | <div class="bottom-left">忝</div> |
| | | <div class="bottom-right" :style="{ color: bgList[index].color }"> |
| | | {{ Math.abs(item.yoyEnery) }}% |
| | | <el-icon v-if="!!item.yoyEnery" :color="item.yoyEnery > 0 |
| | | ? 'green' |
| | | : item.yoyEnery < 0 |
| | | ? 'red' |
| | | : '' |
| | | "> |
| | | <el-icon v-if="!!item.yoyEnery" :color="item.yoyEnery > 0 ? 'green' : item.yoyEnery < 0 ? 'red' : ''"> |
| | | <Top v-if="item.yoyEnery > 0" /> |
| | | <Bottom v-if="item.yoyEnery < 0" /> |
| | | </el-icon> |
| | |
| | | </div> |
| | | </template> |
| | | <script setup name="carbonEmission"> |
| | | import { |
| | | listUpCarbonemission, |
| | | listMiddleCarbonemission, |
| | | } from "@/api/carbonemission/carbonemission"; |
| | | import * as echarts from "echarts"; |
| | | const { proxy } = getCurrentInstance(); |
| | | import { useRoute } from "vue-router"; |
| | | const { period } = proxy.useDict("period"); |
| | | import useSettingsStore from "@/store/modules/settings"; |
| | | const settingsStore = useSettingsStore(); |
| | | import { listUpCarbonemission, listMiddleCarbonemission } from "@/api/carbonemission/carbonemission" |
| | | import * as echarts from "echarts" |
| | | const { proxy } = getCurrentInstance() |
| | | import { useRoute } from "vue-router" |
| | | const { period } = proxy.useDict("period") |
| | | import useSettingsStore from "@/store/modules/settings" |
| | | const settingsStore = useSettingsStore() |
| | | watch( |
| | | () => settingsStore.sideTheme, |
| | | (val) => { |
| | | getList(); |
| | | getList() |
| | | } |
| | | ); |
| | | const loading = ref(false); |
| | | const dialogVisible = ref(false); |
| | | import icon1 from "@/assets/images/period/icon1.png"; |
| | | import icon2 from "@/assets/images/period/icon2.png"; |
| | | import icon3 from "@/assets/images/period/icon3.png"; |
| | | import icon4 from "@/assets/images/period/icon4.png"; |
| | | import icon5 from "@/assets/images/period/icon5.png"; |
| | | ) |
| | | const loading = ref(false) |
| | | const dialogVisible = ref(false) |
| | | import icon1 from "@/assets/images/period/icon1.png" |
| | | import icon2 from "@/assets/images/period/icon2.png" |
| | | import icon3 from "@/assets/images/period/icon3.png" |
| | | import icon4 from "@/assets/images/period/icon4.png" |
| | | import icon5 from "@/assets/images/period/icon5.png" |
| | | const bgList = ref([ |
| | | { |
| | | icon: icon1, |
| | |
| | | icon: icon5, |
| | | color: "#78e801", |
| | | }, |
| | | ]); |
| | | const listTop = ref([]); |
| | | const listBottom = ref([]); |
| | | ]) |
| | | const listTop = ref([]) |
| | | const listBottom = ref([]) |
| | | const data = reactive({ |
| | | queryParams: { |
| | | nodeId: null, |
| | |
| | | dataTime: null, |
| | | }, |
| | | query: { ...useRoute().query }, |
| | | }); |
| | | const { queryParams, query } = toRefs(data); |
| | | }) |
| | | const { queryParams, query } = toRefs(data) |
| | | /** èç¹åå»äºä»¶ */ |
| | | function handleNodeClick(data) { |
| | | queryParams.value.nodeId = data.id; |
| | | queryParams.value.nodeName = data.label; |
| | | handleTimeType(period.value[0].value); |
| | | handleQuery(); |
| | | queryParams.value.nodeId = data.id |
| | | queryParams.value.nodeName = data.label |
| | | handleTimeType(period.value[0].value) |
| | | handleQuery() |
| | | } |
| | | function handleTimeType(e) { |
| | | queryParams.value.timeType = e; |
| | | queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD"); |
| | | queryParams.value.timeType = e |
| | | queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD") |
| | | } |
| | | // ç¢³ææ¾ç®¡ç-ç¢³ææ¾éæ ¸ç®-å表 |
| | | function getList() { |
| | | loading.value = true; |
| | | listTop.value = []; |
| | | loading.value = true |
| | | listTop.value = [] |
| | | listUpCarbonemission( |
| | | proxy.addDateRange({ |
| | | ...queryParams.value, |
| | |
| | | ).then((res) => { |
| | | res.data.upData.map((item, index) => { |
| | | if (index % 5 === 0) { |
| | | listTop.value.push(res.data.upData.slice(index, index + 5)); |
| | | listTop.value.push(res.data.upData.slice(index, index + 5)) |
| | | } |
| | | }); |
| | | }); |
| | | }) |
| | | }) |
| | | // å¨åå§åä¹åï¼å
disposeæ§çå®ä¾ |
| | | if (echarts.getInstanceByDom(document.getElementById("Chart1"))) { |
| | | echarts.dispose(document.getElementById("Chart1")); |
| | | echarts.dispose(document.getElementById("Chart1")) |
| | | } |
| | | const myChart1 = echarts.init(document.getElementById("Chart1")); |
| | | const myChart1 = echarts.init(document.getElementById("Chart1")) |
| | | listMiddleCarbonemission( |
| | | proxy.addDateRange({ |
| | | emissionType: "allType", |
| | |
| | | }) |
| | | ).then((res) => { |
| | | if (!!res.code && res.code == 200) { |
| | | loading.value = false; |
| | | let xaxis = []; |
| | | let yaxis = []; |
| | | let yoy = []; |
| | | let qoq = []; |
| | | loading.value = false |
| | | let xaxis = [] |
| | | let yaxis = [] |
| | | let yoy = [] |
| | | let qoq = [] |
| | | if (!!res.data) { |
| | | res.data.map((item) => { |
| | | xaxis.push(item.xaxis); |
| | | yaxis.push(!!item.yaxis ? item.yaxis : 0); |
| | | yoy.push(!!item.yoy ? item.yoy : 0); |
| | | qoq.push(!!item.qoq ? item.qoq : 0); |
| | | }); |
| | | listBottom.value = res.data; |
| | | xaxis.push(item.xaxis) |
| | | yaxis.push(!!item.yaxis ? item.yaxis : 0) |
| | | yoy.push(!!item.yoy ? item.yoy : 0) |
| | | qoq.push(!!item.qoq ? item.qoq : 0) |
| | | }) |
| | | listBottom.value = res.data |
| | | } |
| | | setTimeout(() => { |
| | | myChart1.setOption({ |
| | |
| | | type: "shadow", |
| | | textStyle: { |
| | | fontSize: 14, |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | }, |
| | |
| | | itemWidth: 14, |
| | | itemHeight: 10, |
| | | textStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | xAxis: { |
| | |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [5, 0, 0, 0], |
| | | // formatter: '{value} ml' |
| | |
| | | name: "tCOâe", |
| | | type: "value", |
| | | nameTextStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | |
| | | show: true, |
| | | lineStyle: { |
| | | type: "dashed", |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | }, |
| | | }, |
| | |
| | | name: "%", |
| | | alignTicks: true, |
| | | nameTextStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | |
| | | show: true, |
| | | lineStyle: { |
| | | type: "dashed", |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | splitArea: { |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | }, |
| | | }, |
| | |
| | | { |
| | | name: "ç¢³ææ¾é", |
| | | type: "bar", |
| | | barWidth: "27", |
| | | barWidth: "12", |
| | | itemStyle: { |
| | | borderRadius: [15, 15, 0, 0], |
| | | }, |
| | |
| | | data: qoq, |
| | | }, |
| | | ], |
| | | }); |
| | | }, 100); |
| | | }) |
| | | }, 100) |
| | | window.addEventListener( |
| | | "resize", |
| | | () => { |
| | | myChart1.resize(); |
| | | myChart1.resize() |
| | | }, |
| | | { passive: true } |
| | | ); |
| | | ) |
| | | } |
| | | }); |
| | | }) |
| | | } |
| | | // ç¢³ææ¾ç®¡ç-ç¢³ææ¾éæ ¸ç®-æç´¢ |
| | | function handleQuery() { |
| | | getList(); |
| | | getList() |
| | | } |
| | | // ç¢³ææ¾ç®¡ç-ç¢³ææ¾éæ ¸ç®-éç½® |
| | | function resetQuery() { |
| | | proxy.resetForm("queryRef"); |
| | | queryParams.value.timeType = null; |
| | | queryParams.value.dataTime = null; |
| | | handleTimeType(period.value[0].value); |
| | | handleQuery(); |
| | | proxy.resetForm("queryRef") |
| | | queryParams.value.timeType = null |
| | | queryParams.value.dataTime = null |
| | | handleTimeType(period.value[0].value) |
| | | handleQuery() |
| | | } |
| | | // ç¢³ææ¾ç®¡ç-ç¢³ææ¾éæ ¸ç®-å¯¼åº |
| | | function handleExport() { |
| | |
| | | ...query.value, |
| | | }, |
| | | `${queryParams.value.nodeName}-ç¢³ææ¾éæ ¸ç®_${new Date().getTime()}.xlsx` |
| | | ); |
| | | ) |
| | | } |
| | | </script> |
| | | <style scoped lang="scss"> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="chart-box"> |
| | | <div id="ChartDom" style="width: 100%; height: 100%"></div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import * as echarts from "echarts" |
| | | const { proxy } = getCurrentInstance() |
| | | import useSettingsStore from "@/store/modules/settings" |
| | | const settingsStore = useSettingsStore() |
| | | const emit = defineEmits() |
| | | const props = defineProps({ |
| | | chartData: { |
| | | type: Object, |
| | | default: () => {}, |
| | | }, |
| | | }) |
| | | |
| | | watch( |
| | | () => props.chartData, |
| | | (val) => { |
| | | console.log("watch", val) |
| | | initChart() |
| | | } |
| | | ) |
| | | watch( |
| | | () => settingsStore.sideTheme, |
| | | (val) => { |
| | | initChart() |
| | | } |
| | | ) |
| | | |
| | | function initChart(value) { |
| | | const chartDom = document.getElementById("ChartDom") |
| | | if (echarts.getInstanceByDom(chartDom)) { |
| | | echarts.dispose(chartDom) |
| | | } |
| | | const myChart = echarts.init(chartDom) |
| | | let option = { |
| | | title: { |
| | | text: props.chartData.title, |
| | | left: "40", |
| | | textStyle: { |
| | | color: "#2979ff", |
| | | }, |
| | | }, |
| | | color: ["#2979ff", "#19be6b", "#ff9900", "#fa3534"], |
| | | tooltip: { |
| | | trigger: "axis", |
| | | axisPointer: { |
| | | type: "shadow", |
| | | }, |
| | | }, |
| | | legend: { |
| | | icon: "rect", |
| | | itemWidth: 14, |
| | | itemHeight: 10, |
| | | textStyle: { |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | grid: { |
| | | top: "40", |
| | | left: "50", |
| | | right: "40", |
| | | bottom: "20", |
| | | containLabel: true, |
| | | }, |
| | | xAxis: { |
| | | type: "category", |
| | | axisPointer: { |
| | | type: "shadow", |
| | | }, |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | | show: false, |
| | | }, |
| | | splitArea: { |
| | | show: false, |
| | | }, |
| | | splitLine: { |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [5, 0, 0, 0], |
| | | // formatter: '{value} ml' |
| | | }, |
| | | data: props.chartData.xData, |
| | | }, |
| | | yAxis: [ |
| | | { |
| | | type: "value", |
| | | nameTextStyle: { |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | | axisLine: { |
| | | show: false, |
| | | }, |
| | | splitLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | type: "dashed", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | | show: false, |
| | | }, |
| | | splitArea: { |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | }, |
| | | }, |
| | | ], |
| | | series: [ |
| | | { |
| | | name: props.chartData.title, |
| | | type: "bar", |
| | | barWidth: "16", |
| | | // tooltip: { |
| | | // valueFormatter: function (value) { |
| | | // return value + "tce" |
| | | // }, |
| | | // }, |
| | | itemStyle: { |
| | | borderRadius: [15, 15, 0, 0], |
| | | }, |
| | | data: props.chartData.yData, |
| | | markPoint: { |
| | | data: [ |
| | | { type: "max", name: "Max" }, |
| | | { type: "min", name: "Min" }, |
| | | ], |
| | | }, |
| | | }, |
| | | ], |
| | | } |
| | | setTimeout(() => { |
| | | myChart.setOption(option) |
| | | }, 200) |
| | | |
| | | window.addEventListener( |
| | | "resize", |
| | | () => { |
| | | myChart.resize() |
| | | }, |
| | | { passive: true } |
| | | ) |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .chart-box { |
| | | width: 100%; |
| | | height: 400px; |
| | | border: 1px solid #eaeaea; |
| | | margin-top: 20px; |
| | | padding-top: 20px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="page"> |
| | | <div class="form-card"> |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true" label-width="68px"> |
| | | <el-form-item label="è½æºç±»å" prop="energyType"> |
| | | <el-select v-model="queryParams.energyType" placeholder="è¯·éæ©è½æºç±»å"> |
| | | <el-option |
| | | :label="item.enername" |
| | | :value="item.enersno" |
| | | v-for="item in energyTypeList" |
| | | :key="item.enersno" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç»è®¡æ¶é´"> |
| | | <el-date-picker |
| | | v-model="queryParams.dataTime" |
| | | type="date" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | placeholder="éæ©æ¥æ" |
| | | style="width: 100%" |
| | | :clearable="false" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | <!-- <el-form-item> |
| | | <el-button type="warning" icon="Download" @click="handleExport"> å¯¼åº </el-button> |
| | | </el-form-item> --> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <div class="table-bg-style"> |
| | | <div class="table-box"> |
| | | <el-table :data="energyList" v-loading="loading" border max-height="380px"> |
| | | <el-table-column fixed prop="indexName" label="ææ åç§°" width="210px"> |
| | | <template #default="scope"> |
| | | <div style="width: 100%; text-align: left"> |
| | | <el-button |
| | | v-if="scope.row.indexId == queryParams.indexId" |
| | | icon="search" |
| | | circle |
| | | @click="selectChange(scope.row)" |
| | | style="color: #fff; background: #409eff; margin-right: 8px" |
| | | ></el-button> |
| | | <el-button |
| | | v-else |
| | | icon="search" |
| | | circle |
| | | @click="selectChange(scope.row)" |
| | | style="margin-right: 8px" |
| | | ></el-button> |
| | | <el-tooltip |
| | | v-if="scope.row.indexName.length > 9" |
| | | class="item" |
| | | effect="dark" |
| | | :content="scope.row.indexName" |
| | | placement="top-end" |
| | | > |
| | | <span> |
| | | {{ scope.row.indexName.substr(0, 9) + "..." }} |
| | | </span> |
| | | </el-tooltip> |
| | | <span v-else>{{ scope.row.indexName }}</span> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-for="index in 24" :key="index" :label="index - 1 + 'æ¶'" align="center" min-width="100"> |
| | | <template #default="scope">{{ numFilter(scope.row[`value${index - 1}`]) }}</template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <div> |
| | | <line-chart ref="LineChartRef" :chartData="lineChartData" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { |
| | | getDataList, |
| | | getlistChart, |
| | | exportList, |
| | | } from "@/api/comprehensiveStatistics/dailyComprehensive/dailyComprehensive" |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType" |
| | | import LineChart from "../comps/LineChart.vue" |
| | | let { proxy } = getCurrentInstance() |
| | | const energyTypeList = ref() |
| | | function getEnergyTypeList() { |
| | | listEnergyTypeList().then((res) => { |
| | | energyTypeList.value = res.data |
| | | // form.value.indexType = alarm_record_category.value[0].value |
| | | // form.value.energyType = energyTypeList.value[0].enersno |
| | | getList() |
| | | }) |
| | | } |
| | | getEnergyTypeList() |
| | | function numFilter(value) { |
| | | // æªåå½åæ°æ®å°å°æ°ç¹åçå ä½ |
| | | let realVal = "" |
| | | if (!isNaN(value) && value !== "" && value !== null) { |
| | | realVal = parseFloat(value).toFixed(2) |
| | | } else { |
| | | realVal = "--" |
| | | } |
| | | return realVal |
| | | } |
| | | let loading = ref(false) |
| | | let total = ref(0) |
| | | let queryParams = ref({ |
| | | indexStorageId: "", |
| | | indexCode: "", |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | dataTime: "", |
| | | }) |
| | | |
| | | const energyList = ref([]) |
| | | const lineChartData = ref({}) |
| | | function getList() { |
| | | queryParams.value.indexCode = proxy.$route.query.modelCode |
| | | getDataList({ |
| | | ...queryParams.value, |
| | | timeType: "HOUR", |
| | | }).then((response) => { |
| | | energyList.value = response.data |
| | | if (response.data && response.data.length !== 0) { |
| | | selectChange(response.data[0]) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const LineChartRef = ref() |
| | | function selectChange(row) { |
| | | queryParams.value.indexId = row ? row.indexId : undefined |
| | | queryParams.value.timeType = "HOUR" |
| | | getlistChart(queryParams.value).then((response) => { |
| | | let actualData = [] |
| | | let expectedData = [] |
| | | let title = "" |
| | | response.data.forEach((item) => { |
| | | expectedData.push(numFilter(item.value)) |
| | | actualData.push(item.timeCode.slice(item.timeCode.length - 2, item.timeCode.length) + "æ¶") |
| | | title = item.indexName + "(" + (item.unitId || "") + ")" |
| | | }) |
| | | |
| | | console.log(response) |
| | | console.log(actualData) |
| | | console.log(expectedData) |
| | | |
| | | lineChartData.value = { |
| | | // xData: [ |
| | | // "0æ¶", |
| | | // "1æ¶", |
| | | // "2æ¶", |
| | | // "3æ¶", |
| | | // "4æ¶", |
| | | // "5æ¶", |
| | | // "6æ¶", |
| | | // "7æ¶", |
| | | // "8æ¶", |
| | | // "9æ¶", |
| | | // "10æ¶", |
| | | // "11æ¶", |
| | | // "12æ¶", |
| | | // "13æ¶", |
| | | // "14æ¶", |
| | | // "15æ¶", |
| | | // "16æ¶", |
| | | // "17æ¶", |
| | | // "18æ¶", |
| | | // "19æ¶", |
| | | // "20æ¶", |
| | | // "21æ¶", |
| | | // "22æ¶", |
| | | // "23æ¶", |
| | | // ], |
| | | xData: actualData, |
| | | yData: expectedData, |
| | | title, |
| | | } |
| | | // LineChartRef.value.initChart() |
| | | // this.lineChartData.actualData = actualData; |
| | | // this.lineChartData.expectedData = expectedData; |
| | | // this.lineChartData.title = title; |
| | | // this.$refs.LineChart.initChart(this.lineChartData); |
| | | // this.$refs.BarChart.initChart(this.lineChartData); |
| | | }) |
| | | } |
| | | |
| | | function getTime() { |
| | | var date = new Date() |
| | | var year = date.getFullYear() |
| | | var month = date.getMonth() + 1 |
| | | var date = date.getDate() |
| | | month = month < 10 ? "0" + month : month |
| | | date = date < 10 ? "0" + date : date |
| | | queryParams.value.dataTime = year + "-" + month + "-" + date |
| | | } |
| | | getTime() |
| | | |
| | | // å¯¼åºæé®æä½ |
| | | function handleExport() { |
| | | exportList(queryParams.value).then((response) => { |
| | | console.log(response) |
| | | // download(response.msg); |
| | | }) |
| | | } |
| | | |
| | | function handleQuery() { |
| | | queryParams.value.pageNum = 1 |
| | | getList() |
| | | } |
| | | |
| | | function resetQuery() { |
| | | queryParams.value = { |
| | | limitName: "", |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | dataTime: null, |
| | | } |
| | | getTime() |
| | | getList() |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | @import "@/assets/styles/page.scss"; |
| | | |
| | | .header-box { |
| | | :deep .el-form-item__content { |
| | | color: #fff; |
| | | font-size: 16px; |
| | | } |
| | | } |
| | | |
| | | :deep .el-table--fit { |
| | | border-bottom: 1px solid #eaeaea; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="page"> |
| | | <div class="form-card"> |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true" label-width="68px"> |
| | | <el-form-item label="è½æºç±»å" prop="energyType"> |
| | | <el-select v-model="queryParams.energyType" placeholder="è¯·éæ©è½æºç±»å"> |
| | | <el-option |
| | | :label="item.enername" |
| | | :value="item.enersno" |
| | | v-for="item in energyTypeList" |
| | | :key="item.enersno" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç»è®¡æ¶é´"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="queryParams.dataTime" |
| | | type="month" |
| | | :clearable="false" |
| | | value-format="yyyy-MM" |
| | | placeholder="éæ©æ¥æ" |
| | | > |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | <!-- <el-form-item> |
| | | <el-button type="warning" icon="Download" @click="handleExport"> å¯¼åº </el-button> |
| | | </el-form-item> --> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <div class="table-bg-style"> |
| | | <div class="table-box"> |
| | | <el-table :data="energyList" v-loading="loading" border max-height="380px"> |
| | | <el-table-column fixed prop="indexName" label="ææ åç§°" width="210px"> |
| | | <template #default="scope"> |
| | | <div style="width: 100%; text-align: left"> |
| | | <el-button |
| | | v-if="scope.row.indexId == queryParams.indexId" |
| | | icon="search" |
| | | circle |
| | | @click="selectChange(scope.row)" |
| | | style="color: #fff; background: #409eff; margin-right: 8px" |
| | | ></el-button> |
| | | <el-button |
| | | v-else |
| | | icon="search" |
| | | circle |
| | | @click="selectChange(scope.row)" |
| | | style="margin-right: 8px" |
| | | ></el-button> |
| | | <el-tooltip |
| | | v-if="scope.row.indexName.length > 9" |
| | | class="item" |
| | | effect="dark" |
| | | :content="scope.row.indexName" |
| | | placement="top-end" |
| | | > |
| | | <span> |
| | | {{ scope.row.indexName.substr(0, 9) + "..." }} |
| | | </span> |
| | | </el-tooltip> |
| | | <span v-else>{{ scope.row.indexName }}</span> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-for="index in 31" :key="index" :label="index + 'æ¥'" align="center" min-width="100"> |
| | | <template #default="scope">{{ numFilter(scope.row[`value${index - 1}`]) }}</template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <div> |
| | | <line-chart ref="LineChartRef" :chartData="lineChartData" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { getDataList, getlistChart } from "@/api/comprehensiveStatistics/monthlyComprehensive/monthlyComprehensive" |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType" |
| | | import LineChart from "../comps/LineChart.vue" |
| | | let { proxy } = getCurrentInstance() |
| | | const energyTypeList = ref() |
| | | function getEnergyTypeList() { |
| | | listEnergyTypeList().then((res) => { |
| | | energyTypeList.value = res.data |
| | | // form.value.indexType = alarm_record_category.value[0].value |
| | | // form.value.energyType = energyTypeList.value[0].enersno |
| | | getList() |
| | | }) |
| | | } |
| | | getEnergyTypeList() |
| | | function numFilter(value) { |
| | | // æªåå½åæ°æ®å°å°æ°ç¹åçå ä½ |
| | | let realVal = "" |
| | | if (!isNaN(value) && value !== "" && value !== null) { |
| | | realVal = parseFloat(value).toFixed(2) |
| | | } else { |
| | | realVal = "--" |
| | | } |
| | | return realVal |
| | | } |
| | | let loading = ref(false) |
| | | let total = ref(0) |
| | | let queryParams = ref({ |
| | | indexStorageId: "", |
| | | indexCode: "", |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | dataTime: "", |
| | | timeType: "DAY", |
| | | }) |
| | | |
| | | const energyList = ref([]) |
| | | const lineChartData = ref({}) |
| | | function getList() { |
| | | queryParams.value.indexCode = proxy.$route.query.modelCode |
| | | getDataList({ |
| | | ...queryParams.value, |
| | | }).then((response) => { |
| | | energyList.value = response.data.tabledata |
| | | if (energyList.value && energyList.value.length !== 0) { |
| | | selectChange(energyList.value[0]) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const LineChartRef = ref() |
| | | function selectChange(row) { |
| | | queryParams.value.indexId = row ? row.indexId : undefined |
| | | getlistChart(queryParams.value).then((response) => { |
| | | let actualData = [] |
| | | let expectedData = [] |
| | | let title = "" |
| | | response.data.forEach((item) => { |
| | | expectedData.push(numFilter(item.value)) |
| | | actualData.push(item.timeCode.slice(item.timeCode.length - 2, item.timeCode.length) + "æ¥") |
| | | title = item.indexName + "(" + (item.unitId || "") + ")" |
| | | }) |
| | | |
| | | console.log(response) |
| | | console.log(actualData) |
| | | console.log(expectedData) |
| | | |
| | | lineChartData.value = { |
| | | // xData: [ |
| | | // "0æ¶", |
| | | // "1æ¶", |
| | | // "2æ¶", |
| | | // "3æ¶", |
| | | // "4æ¶", |
| | | // "5æ¶", |
| | | // "6æ¶", |
| | | // "7æ¶", |
| | | // "8æ¶", |
| | | // "9æ¶", |
| | | // "10æ¶", |
| | | // "11æ¶", |
| | | // "12æ¶", |
| | | // "13æ¶", |
| | | // "14æ¶", |
| | | // "15æ¶", |
| | | // "16æ¶", |
| | | // "17æ¶", |
| | | // "18æ¶", |
| | | // "19æ¶", |
| | | // "20æ¶", |
| | | // "21æ¶", |
| | | // "22æ¶", |
| | | // "23æ¶", |
| | | // ], |
| | | xData: actualData, |
| | | yData: expectedData, |
| | | title, |
| | | } |
| | | // LineChartRef.value.initChart() |
| | | // this.lineChartData.actualData = actualData; |
| | | // this.lineChartData.expectedData = expectedData; |
| | | // this.lineChartData.title = title; |
| | | // this.$refs.LineChart.initChart(this.lineChartData); |
| | | // this.$refs.BarChart.initChart(this.lineChartData); |
| | | }) |
| | | } |
| | | |
| | | function getTime() { |
| | | var date = new Date() |
| | | var year = date.getFullYear() |
| | | var month = date.getMonth() + 1 |
| | | var date = date.getDate() |
| | | month = month < 10 ? "0" + month : month |
| | | date = date < 10 ? "0" + date : date |
| | | queryParams.value.dataTime = year + "-" + month |
| | | } |
| | | getTime() |
| | | |
| | | // å¯¼åºæé®æä½ |
| | | function handleExport() { |
| | | exportList(queryParams.value).then((response) => { |
| | | console.log(response) |
| | | // download(response.msg); |
| | | }) |
| | | } |
| | | |
| | | function handleQuery() { |
| | | queryParams.value.pageNum = 1 |
| | | getList() |
| | | } |
| | | |
| | | function resetQuery() { |
| | | queryParams.value = { |
| | | limitName: "", |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | dataTime: null, |
| | | timeType: "DAY", |
| | | } |
| | | getTime() |
| | | getList() |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | @import "@/assets/styles/page.scss"; |
| | | |
| | | .header-box { |
| | | :deep .el-form-item__content { |
| | | color: #fff; |
| | | font-size: 16px; |
| | | } |
| | | } |
| | | |
| | | :deep .el-table--fit { |
| | | border-bottom: 1px solid #eaeaea; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="page"> |
| | | <div class="form-card"> |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true" label-width="68px"> |
| | | <el-form-item label="è½æºç±»å" prop="energyType"> |
| | | <el-select v-model="queryParams.energyType" placeholder="è¯·éæ©è½æºç±»å"> |
| | | <el-option |
| | | :label="item.enername" |
| | | :value="item.enersno" |
| | | v-for="item in energyTypeList" |
| | | :key="item.enersno" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç»è®¡æ¶é´"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="queryParams.dataTime" |
| | | type="year" |
| | | :clearable="false" |
| | | value-format="YYYY" |
| | | placeholder="éæ©æ¥æ" |
| | | > |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | <!-- <el-form-item> |
| | | <el-button type="warning" icon="Download" @click="handleExport"> å¯¼åº </el-button> |
| | | </el-form-item> --> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <div class="table-bg-style"> |
| | | <div class="table-box"> |
| | | <el-table :data="energyList" v-loading="loading" border max-height="380px"> |
| | | <el-table-column fixed prop="indexName" label="ææ åç§°" width="210px"> |
| | | <template #default="scope"> |
| | | <div style="width: 100%; text-align: left"> |
| | | <el-button |
| | | v-if="scope.row.indexId == queryParams.indexId" |
| | | icon="search" |
| | | circle |
| | | @click="selectChange(scope.row)" |
| | | style="color: #fff; background: #409eff; margin-right: 8px" |
| | | ></el-button> |
| | | <el-button |
| | | v-else |
| | | icon="search" |
| | | circle |
| | | @click="selectChange(scope.row)" |
| | | style="margin-right: 8px" |
| | | ></el-button> |
| | | <el-tooltip |
| | | v-if="scope.row.indexName.length > 9" |
| | | class="item" |
| | | effect="dark" |
| | | :content="scope.row.indexName" |
| | | placement="top-end" |
| | | > |
| | | <span> |
| | | {{ scope.row.indexName.substr(0, 9) + "..." }} |
| | | </span> |
| | | </el-tooltip> |
| | | <span v-else>{{ scope.row.indexName }}</span> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-for="index in 12" :key="index" :label="index + 'æ'" align="center" min-width="100"> |
| | | <template #default="scope">{{ numFilter(scope.row[`value${index - 1}`]) }}</template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <div> |
| | | <line-chart ref="LineChartRef" :chartData="lineChartData" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { getDataList, getlistChart } from "@/api/comprehensiveStatistics/yearComprehensive/yearComprehensive" |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType" |
| | | import LineChart from "../comps/LineChart.vue" |
| | | let { proxy } = getCurrentInstance() |
| | | const energyTypeList = ref() |
| | | function getEnergyTypeList() { |
| | | listEnergyTypeList().then((res) => { |
| | | energyTypeList.value = res.data |
| | | // form.value.indexType = alarm_record_category.value[0].value |
| | | // form.value.energyType = energyTypeList.value[0].enersno |
| | | getList() |
| | | }) |
| | | } |
| | | getEnergyTypeList() |
| | | function numFilter(value) { |
| | | // æªåå½åæ°æ®å°å°æ°ç¹åçå ä½ |
| | | let realVal = "" |
| | | if (!isNaN(value) && value !== "" && value !== null) { |
| | | realVal = parseFloat(value).toFixed(2) |
| | | } else { |
| | | realVal = "--" |
| | | } |
| | | return realVal |
| | | } |
| | | let loading = ref(false) |
| | | let queryParams = ref({ |
| | | indexStorageId: "", |
| | | indexCode: "", |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | dataTime: "2025-01-0", |
| | | timeType: "MONTH", |
| | | }) |
| | | |
| | | const energyList = ref([]) |
| | | const lineChartData = ref({}) |
| | | function getList() { |
| | | queryParams.value.indexCode = proxy.$route.query.modelCode |
| | | getDataList({ |
| | | ...queryParams.value, |
| | | dataTime: queryParams.value.dataTime ? queryParams.value.dataTime + "-01" : "", |
| | | }).then((response) => { |
| | | energyList.value = response.data |
| | | if (response.data && response.data.length !== 0) { |
| | | selectChange(response.data[0]) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const LineChartRef = ref() |
| | | function selectChange(row) { |
| | | queryParams.value.indexId = row ? row.indexId : undefined |
| | | getlistChart({ |
| | | ...queryParams.value, |
| | | dataTime: queryParams.value.dataTime ? queryParams.value.dataTime + "-01" : "", |
| | | }).then((response) => { |
| | | let actualData = [] |
| | | let expectedData = [] |
| | | let title = "" |
| | | response.data.forEach((item) => { |
| | | expectedData.push(numFilter(item.value)) |
| | | actualData.push(item.timeCode.slice(item.timeCode.length - 2, item.timeCode.length) + "æ¶") |
| | | title = item.indexName + "(" + (item.unitId || "") + ")" |
| | | }) |
| | | |
| | | console.log(response) |
| | | console.log(actualData) |
| | | console.log(expectedData) |
| | | |
| | | lineChartData.value = { |
| | | // xData: [ |
| | | // "0æ¶", |
| | | // "1æ¶", |
| | | // "2æ¶", |
| | | // "3æ¶", |
| | | // "4æ¶", |
| | | // "5æ¶", |
| | | // "6æ¶", |
| | | // "7æ¶", |
| | | // "8æ¶", |
| | | // "9æ¶", |
| | | // "10æ¶", |
| | | // "11æ¶", |
| | | // "12æ¶", |
| | | // "13æ¶", |
| | | // "14æ¶", |
| | | // "15æ¶", |
| | | // "16æ¶", |
| | | // "17æ¶", |
| | | // "18æ¶", |
| | | // "19æ¶", |
| | | // "20æ¶", |
| | | // "21æ¶", |
| | | // "22æ¶", |
| | | // "23æ¶", |
| | | // ], |
| | | xData: actualData, |
| | | yData: expectedData, |
| | | title, |
| | | } |
| | | // LineChartRef.value.initChart() |
| | | // this.lineChartData.actualData = actualData; |
| | | // this.lineChartData.expectedData = expectedData; |
| | | // this.lineChartData.title = title; |
| | | // this.$refs.LineChart.initChart(this.lineChartData); |
| | | // this.$refs.BarChart.initChart(this.lineChartData); |
| | | }) |
| | | } |
| | | |
| | | function getTime() { |
| | | var date = new Date() |
| | | var year = date.getFullYear() |
| | | var month = date.getMonth() + 1 |
| | | var date = date.getDate() |
| | | month = month < 10 ? "0" + month : month |
| | | date = date < 10 ? "0" + date : date |
| | | queryParams.value.dataTime = year + "" |
| | | } |
| | | |
| | | // å¯¼åºæé®æä½ |
| | | function handleExport() { |
| | | exportList(queryParams.value).then((response) => { |
| | | console.log(response) |
| | | // download(response.msg); |
| | | }) |
| | | } |
| | | |
| | | function handleQuery() { |
| | | queryParams.value.pageNum = 1 |
| | | getList() |
| | | } |
| | | |
| | | function resetQuery() { |
| | | queryParams.value = { |
| | | limitName: "", |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | dataTime: null, |
| | | timeType: "MONTH", |
| | | } |
| | | getTime() |
| | | getList() |
| | | } |
| | | |
| | | getTime() |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | @import "@/assets/styles/page.scss"; |
| | | |
| | | .header-box { |
| | | :deep .el-form-item__content { |
| | | color: #fff; |
| | | font-size: 16px; |
| | | } |
| | | } |
| | | |
| | | :deep .el-table--fit { |
| | | border-bottom: 1px solid #eaeaea; |
| | | } |
| | | </style> |
| | |
| | | right: "5%", |
| | | itemWidth: 14, |
| | | itemHeight: 14, |
| | | itemGap: 60, |
| | | itemGap: 16, |
| | | textStyle: { |
| | | align: "left", |
| | | verticalAlign: "middle", |
| | |
| | | right: "10%", |
| | | itemWidth: 14, |
| | | itemHeight: 14, |
| | | itemGap: 50, |
| | | itemGap: 16, |
| | | textStyle: { |
| | | align: "left", |
| | | verticalAlign: "middle", |
| | |
| | | <div class="middle-view"> |
| | | <div class="left-wrapper"> |
| | | <div class="login-font">{{ systemInfo.systemName || "" }}</div> |
| | | <img src="@/assets/images/font01.png" alt="" style="width: 406px" /> |
| | | <img src="@/assets/images/img_logo.png" alt="" style="width: 200px; margin-top: 20px" /> |
| | | <img src="@/assets/images/font01.png" alt="" style="width: 380px" /> |
| | | <img src="@/assets/images/img_logo.png" alt="" style="width: 180px; margin-top: 20px" /> |
| | | </div> |
| | | <div class="right-wrapper"> |
| | | <div class="header"> |
| | |
| | | size="large" |
| | | auto-complete="off" |
| | | placeholder="éªè¯ç " |
| | | style="width: 266px" |
| | | style="width: 230px" |
| | | @keyup.enter="handleLogin" |
| | | > |
| | | <!-- <template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template> --> |
| | |
| | | display: flex; |
| | | align-items: center; |
| | | height: 100%; |
| | | background-image: url("@/assets/images/login-background.png"); |
| | | background-image: url("@/assets/images/login-background.jpg"); |
| | | background-repeat: no-repeat; |
| | | background-size: cover; |
| | | flex-direction: column; |
| | |
| | | flex-direction: column; |
| | | } |
| | | .login-font { |
| | | font-size: 34px; |
| | | font-size: 32px; |
| | | font-weight: 700; |
| | | color: #d5f8ff; |
| | | margin-bottom: 12px; |
| | | margin-bottom: 10px; |
| | | } |
| | | } |
| | | |
| | | .right-wrapper { |
| | | border-radius: 23px; |
| | | background: #ffffff; |
| | | width: 480px; |
| | | width: 410px; |
| | | position: relative; |
| | | .header { |
| | | height: 70px; |
| | | line-height: 70px; |
| | | height: 56px; |
| | | line-height: 56px; |
| | | border-bottom: 1px solid #f1f1f1; |
| | | color: #3b3b3b; |
| | | font-size: 22px; |
| | | font-size: 18px; |
| | | margin-bottom: 22px; |
| | | span { |
| | | display: inline-block; |
| | | height: 70px; |
| | | line-height: 70px; |
| | | border-bottom: 6px solid #3a83fc; |
| | | margin-left: 50px; |
| | | height: 56px; |
| | | line-height: 62px; |
| | | border-bottom: 4px solid #3a83fc; |
| | | margin-left: 32px; |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | .login-form { |
| | | padding: 0 50px 30px; |
| | | padding: 0 32px 20px; |
| | | |
| | | .submit-btn { |
| | | width: 382px; |
| | | height: 54px; |
| | | width: 360px; |
| | | height: 44px; |
| | | background: #3a83fc; |
| | | border-radius: 3px; |
| | | font-size: 20px; |
| | | font-size: 18px; |
| | | box-shadow: 1px 2px 5px #3a83fc; |
| | | border: none; |
| | | border-radius: 6px; |
| | |
| | | text-align: center; |
| | | color: #fff; |
| | | font-family: Arial; |
| | | font-size: 16px; |
| | | font-size: 14px; |
| | | letter-spacing: 1px; |
| | | } |
| | | </style> |
| | |
| | | </div> |
| | | <div class="page-container-right"> |
| | | <div class="form-card"> |
| | | <el-form |
| | | :model="queryParams" |
| | | ref="queryRef" |
| | | :inline="true" |
| | | > |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true"> |
| | | <el-form-item label="æ¶é´" prop="queryTime"> |
| | | <el-date-picker |
| | | v-model="queryParams.queryTime" |
| | |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery"> |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button type="primary" icon="Search" @click="handleQuery"> æç´¢ </el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div |
| | | style=" |
| | | height: calc(100vh - 205px) !important; |
| | | max-height: calc(100vh - 205px) !important; |
| | | overflow-y: auto; |
| | | " |
| | | style="height: calc(100vh - 205px) !important; max-height: calc(100vh - 205px) !important; overflow-y: auto" |
| | | v-loading="loading" |
| | | > |
| | | <div class="card-list"> |
| | | <div |
| | | class="card-list-item" |
| | | v-for="item in periodList" |
| | | :key="item.title" |
| | | > |
| | | <div class="card-list-item" v-for="item in periodList" :key="item.title"> |
| | | <div class="item-top"> |
| | | <div |
| | | class="icon" |
| | | :style="{ backgroundImage: 'url(' + item.icon + ')' }" |
| | | ></div> |
| | | <div class="icon" :style="{ backgroundImage: 'url(' + item.icon + ')' }"></div> |
| | | <div class="name">{{ item.title }}</div> |
| | | </div> |
| | | <div |
| | | class="item-bottom" |
| | | v-for="(node, nodeIndex) in item.data" |
| | | :key="nodeIndex" |
| | | > |
| | | <div class="item-bottom" v-for="(node, nodeIndex) in item.data" :key="nodeIndex"> |
| | | <div class="bottom-left">{{ node.label }}</div> |
| | | <div class="bottom-right" :style="{ color: item.color }"> |
| | | {{ node.value }} |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <BaseCard :title="queryParams.nodeName+'-å°å³°å¹³è°·çµéå¾'"> |
| | | <BaseCard :title="queryParams.nodeName + '-å°å³°å¹³è°·çµéå¾'"> |
| | | <div class="chart-box"> |
| | | <div id="Chart1" /> |
| | | </div> |
| | | </BaseCard> |
| | | <BaseCard :title="queryParams.nodeName+'-å°å³°å¹³è°·çµè´¹å¾'"> |
| | | <BaseCard :title="queryParams.nodeName + '-å°å³°å¹³è°·çµè´¹å¾'"> |
| | | <div class="chart-box"> |
| | | <div id="Chart2" /> |
| | | </div> |
| | |
| | | </div> |
| | | </template> |
| | | <script setup name="period"> |
| | | import { listPeriod } from "@/api/peakValley/period"; |
| | | import * as echarts from "echarts"; |
| | | const { proxy } = getCurrentInstance(); |
| | | import { useRoute } from "vue-router"; |
| | | import useSettingsStore from "@/store/modules/settings"; |
| | | const settingsStore = useSettingsStore(); |
| | | import { listPeriod } from "@/api/peakValley/period" |
| | | import * as echarts from "echarts" |
| | | const { proxy } = getCurrentInstance() |
| | | import { useRoute } from "vue-router" |
| | | import useSettingsStore from "@/store/modules/settings" |
| | | const settingsStore = useSettingsStore() |
| | | watch( |
| | | () => settingsStore.sideTheme, |
| | | (val) => { |
| | | getList(); |
| | | getList() |
| | | } |
| | | ); |
| | | const loading = ref(false); |
| | | import icon1 from "@/assets/images/period/icon1.png"; |
| | | import icon2 from "@/assets/images/period/icon2.png"; |
| | | import icon3 from "@/assets/images/period/icon3.png"; |
| | | import icon4 from "@/assets/images/period/icon4.png"; |
| | | import icon5 from "@/assets/images/period/icon5.png"; |
| | | ) |
| | | const loading = ref(false) |
| | | import icon1 from "@/assets/images/period/icon1.png" |
| | | import icon2 from "@/assets/images/period/icon2.png" |
| | | import icon3 from "@/assets/images/period/icon3.png" |
| | | import icon4 from "@/assets/images/period/icon4.png" |
| | | import icon5 from "@/assets/images/period/icon5.png" |
| | | const periodList = ref([ |
| | | { |
| | | icon: icon1, |
| | |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | ]) |
| | | const data = reactive({ |
| | | queryParams: { |
| | | nodeId: null, |
| | |
| | | queryTime: null, |
| | | }, |
| | | query: { ...useRoute().query }, |
| | | }); |
| | | const { queryParams, query } = toRefs(data); |
| | | }) |
| | | const { queryParams, query } = toRefs(data) |
| | | /** èç¹åå»äºä»¶ */ |
| | | function handleNodeClick(data) { |
| | | queryParams.value.nodeId = data.id; |
| | | queryParams.value.nodeName = data.label; |
| | | queryParams.value.queryTime = proxy.dayjs(new Date()).format("YYYY-MM"); |
| | | handleQuery(); |
| | | queryParams.value.nodeId = data.id |
| | | queryParams.value.nodeName = data.label |
| | | queryParams.value.queryTime = proxy.dayjs(new Date()).format("YYYY-MM") |
| | | handleQuery() |
| | | } |
| | | // 峰平谷è½èåæ-å³°å¹³è°·æ¶æ®µç»è®¡-å表 |
| | | function getList() { |
| | | loading.value = true; |
| | | loading.value = true |
| | | listPeriod( |
| | | proxy.addDateRange({ |
| | | ...queryParams.value, |
| | | ...query.value, |
| | | }) |
| | | ).then((res) => { |
| | | loading.value = false; |
| | | loading.value = false |
| | | if (!!res.code && res.code == 200) { |
| | | if (!!res.data.totalVO) { |
| | | periodList.value[0].data[0].value = !!res.data.totalVO |
| | | .totalPowerConsumption |
| | | periodList.value[0].data[0].value = !!res.data.totalVO.totalPowerConsumption |
| | | ? res.data.totalVO.totalPowerConsumption |
| | | : 0; |
| | | periodList.value[0].data[1].value = !!res.data.totalVO.totalCost |
| | | ? res.data.totalVO.totalCost |
| | | : 0; |
| | | : 0 |
| | | periodList.value[0].data[1].value = !!res.data.totalVO.totalCost ? res.data.totalVO.totalCost : 0 |
| | | |
| | | periodList.value[1].data[0].value = !!res.data.totalVO |
| | | .tipPowerConsumption |
| | | periodList.value[1].data[0].value = !!res.data.totalVO.tipPowerConsumption |
| | | ? res.data.totalVO.tipPowerConsumption |
| | | : 0; |
| | | : 0 |
| | | periodList.value[1].data[1].value = |
| | | (!!res.data.totalVO.tipPowerProportion |
| | | ? res.data.totalVO.tipPowerProportion |
| | | : 0) + "%"; |
| | | periodList.value[1].data[2].value = !!res.data.totalVO.tipPowerCost |
| | | ? res.data.totalVO.tipPowerCost |
| | | : 0; |
| | | (!!res.data.totalVO.tipPowerProportion ? res.data.totalVO.tipPowerProportion : 0) + "%" |
| | | periodList.value[1].data[2].value = !!res.data.totalVO.tipPowerCost ? res.data.totalVO.tipPowerCost : 0 |
| | | periodList.value[1].data[3].value = |
| | | (!!res.data.totalVO.tipPowerCostProportion |
| | | ? res.data.totalVO.tipPowerCostProportion |
| | | : 0) + "%"; |
| | | (!!res.data.totalVO.tipPowerCostProportion ? res.data.totalVO.tipPowerCostProportion : 0) + "%" |
| | | |
| | | periodList.value[2].data[0].value = !!res.data.totalVO |
| | | .peakPowerConsumption |
| | | periodList.value[2].data[0].value = !!res.data.totalVO.peakPowerConsumption |
| | | ? res.data.totalVO.peakPowerConsumption |
| | | : 0; |
| | | : 0 |
| | | periodList.value[2].data[1].value = |
| | | (!!res.data.totalVO.peakPowerProportion |
| | | ? res.data.totalVO.peakPowerProportion |
| | | : 0) + "%"; |
| | | periodList.value[2].data[2].value = !!res.data.totalVO.peakPowerCost |
| | | ? res.data.totalVO.peakPowerCost |
| | | : 0; |
| | | (!!res.data.totalVO.peakPowerProportion ? res.data.totalVO.peakPowerProportion : 0) + "%" |
| | | periodList.value[2].data[2].value = !!res.data.totalVO.peakPowerCost ? res.data.totalVO.peakPowerCost : 0 |
| | | periodList.value[2].data[3].value = |
| | | (!!res.data.totalVO.peakPowerCostProportion |
| | | ? res.data.totalVO.peakPowerCostProportion |
| | | : 0) + "%"; |
| | | (!!res.data.totalVO.peakPowerCostProportion ? res.data.totalVO.peakPowerCostProportion : 0) + "%" |
| | | |
| | | periodList.value[3].data[0].value = !!res.data.totalVO |
| | | .flatPowerConsumption |
| | | periodList.value[3].data[0].value = !!res.data.totalVO.flatPowerConsumption |
| | | ? res.data.totalVO.flatPowerConsumption |
| | | : 0; |
| | | : 0 |
| | | periodList.value[3].data[1].value = |
| | | (!!res.data.totalVO.flatPowerProportion |
| | | ? res.data.totalVO.flatPowerProportion |
| | | : 0) + "%"; |
| | | periodList.value[3].data[2].value = !!res.data.totalVO.flatPowerCost |
| | | ? res.data.totalVO.flatPowerCost |
| | | : 0; |
| | | (!!res.data.totalVO.flatPowerProportion ? res.data.totalVO.flatPowerProportion : 0) + "%" |
| | | periodList.value[3].data[2].value = !!res.data.totalVO.flatPowerCost ? res.data.totalVO.flatPowerCost : 0 |
| | | periodList.value[3].data[3].value = |
| | | (!!res.data.totalVO.flatPowerCostProportion |
| | | ? res.data.totalVO.flatPowerCostProportion |
| | | : 0) + "%"; |
| | | (!!res.data.totalVO.flatPowerCostProportion ? res.data.totalVO.flatPowerCostProportion : 0) + "%" |
| | | |
| | | periodList.value[4].data[0].value = !!res.data.totalVO |
| | | .troughPowerConsumption |
| | | periodList.value[4].data[0].value = !!res.data.totalVO.troughPowerConsumption |
| | | ? res.data.totalVO.troughPowerConsumption |
| | | : 0; |
| | | : 0 |
| | | periodList.value[4].data[1].value = |
| | | (!!res.data.totalVO.troughPowerProportion |
| | | ? res.data.totalVO.troughPowerProportion |
| | | : 0) + "%"; |
| | | periodList.value[4].data[2].value = !!res.data.totalVO.troughPowerCost |
| | | ? res.data.totalVO.troughPowerCost |
| | | : 0; |
| | | (!!res.data.totalVO.troughPowerProportion ? res.data.totalVO.troughPowerProportion : 0) + "%" |
| | | periodList.value[4].data[2].value = !!res.data.totalVO.troughPowerCost ? res.data.totalVO.troughPowerCost : 0 |
| | | periodList.value[4].data[3].value = |
| | | (!!res.data.totalVO.troughPowerCostProportion |
| | | ? res.data.totalVO.troughPowerCostProportion |
| | | : 0) + "%"; |
| | | (!!res.data.totalVO.troughPowerCostProportion ? res.data.totalVO.troughPowerCostProportion : 0) + "%" |
| | | } |
| | | // å¨åå§åä¹åï¼å
disposeæ§çå®ä¾ |
| | | if (echarts.getInstanceByDom(document.getElementById("Chart1"))) { |
| | | echarts.dispose(document.getElementById("Chart1")); |
| | | echarts.dispose(document.getElementById("Chart1")) |
| | | } |
| | | if (echarts.getInstanceByDom(document.getElementById("Chart2"))) { |
| | | echarts.dispose(document.getElementById("Chart2")); |
| | | echarts.dispose(document.getElementById("Chart2")) |
| | | } |
| | | const myChart1 = echarts.init(document.getElementById("Chart1")); |
| | | const myChart2 = echarts.init(document.getElementById("Chart2")); |
| | | const myChart1 = echarts.init(document.getElementById("Chart1")) |
| | | const myChart2 = echarts.init(document.getElementById("Chart2")) |
| | | if (!!res.data.powerConsumptionList) { |
| | | let xdata = []; |
| | | let ytip = []; |
| | | let ypeak = []; |
| | | let yflat = []; |
| | | let ytrough = []; |
| | | let xdata = [] |
| | | let ytip = [] |
| | | let ypeak = [] |
| | | let yflat = [] |
| | | let ytrough = [] |
| | | res.data.powerConsumptionList.map((item) => { |
| | | xdata.push(Number(item.xdata.slice(-2)) + "æ¥"); |
| | | ytip.push(!!item.ytip ? item.ytip : 0); |
| | | ypeak.push(!!item.ypeak ? item.ypeak : 0); |
| | | yflat.push(!!item.yflat ? item.yflat : 0); |
| | | ytrough.push(!!item.ytrough ? item.ytrough : 0); |
| | | }); |
| | | xdata.push(Number(item.xdata.slice(-2)) + "æ¥") |
| | | ytip.push(!!item.ytip ? item.ytip : 0) |
| | | ypeak.push(!!item.ypeak ? item.ypeak : 0) |
| | | yflat.push(!!item.yflat ? item.yflat : 0) |
| | | ytrough.push(!!item.ytrough ? item.ytrough : 0) |
| | | }) |
| | | myChart1.setOption({ |
| | | color: ["#f52528", "#ff6200", "#ffce0c", "#78e801"], |
| | | tooltip: { |
| | |
| | | type: "shadow", |
| | | textStyle: { |
| | | fontSize: 14, |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | }, |
| | |
| | | itemHeight: 10, |
| | | // right: 0, |
| | | textStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | xAxis: { |
| | |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [5, 0, 0, 0], |
| | | // formatter: '{value} ml' |
| | |
| | | name: "èçµé(KWH)", |
| | | type: "value", |
| | | nameTextStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | |
| | | show: true, |
| | | lineStyle: { |
| | | type: "dashed", |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | // formatter: '{value} ml' |
| | | }, |
| | |
| | | name: "å°", |
| | | type: "bar", |
| | | stack: "total", |
| | | barWidth: "27", |
| | | barWidth: "12", |
| | | data: ytip, |
| | | }, |
| | | { |
| | | name: "å³°", |
| | | type: "bar", |
| | | stack: "total", |
| | | barWidth: "27", |
| | | barWidth: "12", |
| | | data: ypeak, |
| | | }, |
| | | { |
| | | name: "å¹³", |
| | | type: "bar", |
| | | stack: "total", |
| | | barWidth: "27", |
| | | barWidth: "12", |
| | | data: yflat, |
| | | }, |
| | | { |
| | | name: "è°·", |
| | | type: "bar", |
| | | stack: "total", |
| | | barWidth: "27", |
| | | barWidth: "12", |
| | | data: ytrough, |
| | | }, |
| | | ], |
| | | }); |
| | | }) |
| | | } |
| | | if (!!res.data.costList) { |
| | | let xdata = []; |
| | | let ytip = []; |
| | | let ypeak = []; |
| | | let yflat = []; |
| | | let ytrough = []; |
| | | let xdata = [] |
| | | let ytip = [] |
| | | let ypeak = [] |
| | | let yflat = [] |
| | | let ytrough = [] |
| | | res.data.costList.map((item) => { |
| | | xdata.push(Number(item.xdata.slice(-2)) + "æ¥"); |
| | | ytip.push(!!item.ytip ? item.ytip : 0); |
| | | ypeak.push(!!item.ypeak ? item.ypeak : 0); |
| | | yflat.push(!!item.yflat ? item.yflat : 0); |
| | | ytrough.push(!!item.ytrough ? item.ytrough : 0); |
| | | }); |
| | | xdata.push(Number(item.xdata.slice(-2)) + "æ¥") |
| | | ytip.push(!!item.ytip ? item.ytip : 0) |
| | | ypeak.push(!!item.ypeak ? item.ypeak : 0) |
| | | yflat.push(!!item.yflat ? item.yflat : 0) |
| | | ytrough.push(!!item.ytrough ? item.ytrough : 0) |
| | | }) |
| | | myChart2.setOption({ |
| | | color: ["#f52528", "#ff6200", "#ffce0c", "#78e801"], |
| | | tooltip: { |
| | |
| | | type: "shadow", |
| | | textStyle: { |
| | | fontSize: 14, |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | }, |
| | |
| | | itemHeight: 10, |
| | | // right: 0, |
| | | textStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | xAxis: { |
| | |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [5, 0, 0, 0], |
| | | // formatter: '{value} ml' |
| | |
| | | name: "çµè´¹(å
)", |
| | | type: "value", |
| | | nameTextStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | |
| | | show: true, |
| | | lineStyle: { |
| | | type: "dashed", |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | // formatter: '{value} ml' |
| | | }, |
| | |
| | | name: "å°", |
| | | type: "bar", |
| | | stack: "total", |
| | | barWidth: "27", |
| | | barWidth: "12", |
| | | data: ytip, |
| | | }, |
| | | { |
| | | name: "å³°", |
| | | type: "bar", |
| | | stack: "total", |
| | | barWidth: "27", |
| | | barWidth: "12", |
| | | data: ypeak, |
| | | }, |
| | | { |
| | | name: "å¹³", |
| | | type: "bar", |
| | | stack: "total", |
| | | barWidth: "27", |
| | | barWidth: "12", |
| | | data: yflat, |
| | | }, |
| | | { |
| | | name: "è°·", |
| | | type: "bar", |
| | | stack: "total", |
| | | barWidth: "27", |
| | | barWidth: "12", |
| | | data: ytrough, |
| | | }, |
| | | ], |
| | | }); |
| | | }) |
| | | } |
| | | window.addEventListener("resize", () => { |
| | | myChart1.resize(); |
| | | myChart2.resize(); |
| | | },{passive: true}); |
| | | window.addEventListener( |
| | | "resize", |
| | | () => { |
| | | myChart1.resize() |
| | | myChart2.resize() |
| | | }, |
| | | { passive: true } |
| | | ) |
| | | } |
| | | }); |
| | | }) |
| | | } |
| | | // 峰平谷è½èåæ-å³°å¹³è°·æ¶æ®µç»è®¡-æç´¢ |
| | | function handleQuery() { |
| | | getList(); |
| | | getList() |
| | | } |
| | | // 峰平谷è½èåæ-å³°å¹³è°·æ¶æ®µç»è®¡-éç½® |
| | | function resetQuery() { |
| | | proxy.resetForm("queryRef"); |
| | | queryParams.value.queryTime = proxy.dayjs(new Date()).format("YYYY-MM"); |
| | | handleQuery(); |
| | | proxy.resetForm("queryRef") |
| | | queryParams.value.queryTime = proxy.dayjs(new Date()).format("YYYY-MM") |
| | | handleQuery() |
| | | } |
| | | </script> |
| | | <style scoped lang="scss"> |
| | |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery"> |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button type="primary" icon="Search" @click="handleQuery"> æç´¢ </el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Download" @click="handleExport"> |
| | | å¯¼åº |
| | | </el-button> |
| | | <el-button type="primary" icon="Download" @click="handleExport"> å¯¼åº </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div |
| | | style=" |
| | | height: calc(100vh - 205px) !important; |
| | | max-height: calc(100vh - 205px) !important; |
| | | overflow-y: auto; |
| | | " |
| | | style="height: calc(100vh - 205px) !important; max-height: calc(100vh - 205px) !important; overflow-y: auto" |
| | | v-loading="loading" |
| | | > |
| | | <el-row> |
| | |
| | | <el-col :span="24"> |
| | | <BaseCard :title="queryParams.nodeName + '-å³°å¹³è°·åæ¶ç»è®¡'"> |
| | | <div class="table-box"> |
| | | <el-table |
| | | :data="timeSharingList" |
| | | style="width: 100%" |
| | | show-summary |
| | | > |
| | | <el-table-column |
| | | label="æ¶é´" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | > |
| | | <el-table :data="timeSharingList" style="width: 100%" show-summary> |
| | | <el-table-column label="æ¶é´" align="center" show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | {{ proxy.dayjs(scope.row.time).format("HHæ¶") }} |
| | | </template> |
| | |
| | | show-overflow-tooltip |
| | | width="120" |
| | | /> |
| | | <el-table-column |
| | | prop="sharpFee" |
| | | label="çµè´¹(å
)" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column prop="sharpFee" label="çµè´¹(å
)" align="center" show-overflow-tooltip /> |
| | | </el-table-column> |
| | | <el-table-column label="å³°" align="center"> |
| | | <el-table-column |
| | |
| | | show-overflow-tooltip |
| | | width="120" |
| | | /> |
| | | <el-table-column |
| | | prop="peakFee" |
| | | label="çµè´¹(å
)" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column prop="peakFee" label="çµè´¹(å
)" align="center" show-overflow-tooltip /> |
| | | </el-table-column> |
| | | <el-table-column label="å¹³" align="center"> |
| | | <el-table-column |
| | |
| | | show-overflow-tooltip |
| | | width="120" |
| | | /> |
| | | <el-table-column |
| | | prop="flatFee" |
| | | label="çµè´¹(å
)" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column prop="flatFee" label="çµè´¹(å
)" align="center" show-overflow-tooltip /> |
| | | </el-table-column> |
| | | <el-table-column label="è°·" align="center"> |
| | | <el-table-column |
| | |
| | | show-overflow-tooltip |
| | | width="120" |
| | | /> |
| | | <el-table-column |
| | | prop="valleyFee" |
| | | label="çµè´¹(å
)" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column prop="valleyFee" label="çµè´¹(å
)" align="center" show-overflow-tooltip /> |
| | | </el-table-column> |
| | | <el-table-column label="å计" align="center"> |
| | | <el-table-column |
| | |
| | | show-overflow-tooltip |
| | | width="120" |
| | | /> |
| | | <el-table-column |
| | | prop="totalFee" |
| | | label="æ»çµè´¹(å
)" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column prop="totalFee" label="æ»çµè´¹(å
)" align="center" show-overflow-tooltip /> |
| | | </el-table-column> |
| | | <!-- <el-table-column label="æä½" align="center"> |
| | | <template #default="scope"> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <el-dialog |
| | | v-model="timeSharingDialogTableVisible" |
| | | title="æ¥çåæ¶ç»è®¡è¯¦æ
" |
| | | width="1300" |
| | | > |
| | | <el-dialog v-model="timeSharingDialogTableVisible" title="æ¥çåæ¶ç»è®¡è¯¦æ
" width="1300"> |
| | | <div class="table-box"> |
| | | <el-table :data="viewTimeSharingList" style="width: 100%" height="420"> |
| | | <el-table-column |
| | | label="æ¶é´" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | width="200" |
| | | > |
| | | <el-table-column label="æ¶é´" align="center" show-overflow-tooltip width="200"> |
| | | <template #default="scope"> {{ scope.row.time }}æ¶ </template> |
| | | </el-table-column> |
| | | <el-table-column label="å°" align="center"> |
| | | <el-table-column |
| | | prop="sharpPower" |
| | | label="èçµé(kWh)" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | width="120" |
| | | /> |
| | | <el-table-column |
| | | prop="sharpFee" |
| | | label="çµè´¹(å
)" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | width="90" |
| | | /> |
| | | <el-table-column prop="sharpPower" label="èçµé(kWh)" align="center" show-overflow-tooltip width="120" /> |
| | | <el-table-column prop="sharpFee" label="çµè´¹(å
)" align="center" show-overflow-tooltip width="90" /> |
| | | </el-table-column> |
| | | <el-table-column label="å³°" align="center"> |
| | | <el-table-column |
| | | prop="peakPower" |
| | | label="èçµé(kWh)" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | width="120" |
| | | /> |
| | | <el-table-column |
| | | prop="peakFee" |
| | | label="çµè´¹(å
)" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | width="90" |
| | | /> |
| | | <el-table-column prop="peakPower" label="èçµé(kWh)" align="center" show-overflow-tooltip width="120" /> |
| | | <el-table-column prop="peakFee" label="çµè´¹(å
)" align="center" show-overflow-tooltip width="90" /> |
| | | </el-table-column> |
| | | <el-table-column label="å¹³" align="center"> |
| | | <el-table-column |
| | | prop="flatPower" |
| | | label="èçµé(kWh)" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | width="120" |
| | | /> |
| | | <el-table-column |
| | | prop="flatFee" |
| | | label="çµè´¹(å
)" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | width="90" |
| | | /> |
| | | <el-table-column prop="flatPower" label="èçµé(kWh)" align="center" show-overflow-tooltip width="120" /> |
| | | <el-table-column prop="flatFee" label="çµè´¹(å
)" align="center" show-overflow-tooltip width="90" /> |
| | | </el-table-column> |
| | | <el-table-column label="è°·" align="center"> |
| | | <el-table-column |
| | | prop="valleyPower" |
| | | label="èçµé(kWh)" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | width="120" |
| | | /> |
| | | <el-table-column |
| | | prop="valleyFee" |
| | | label="çµè´¹(å
)" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | width="90" |
| | | /> |
| | | <el-table-column prop="valleyPower" label="èçµé(kWh)" align="center" show-overflow-tooltip width="120" /> |
| | | <el-table-column prop="valleyFee" label="çµè´¹(å
)" align="center" show-overflow-tooltip width="90" /> |
| | | </el-table-column> |
| | | <el-table-column label="å计" align="center"> |
| | | <el-table-column |
| | |
| | | width="120" |
| | | > |
| | | <template #default="scope"> |
| | | {{ |
| | | scope.row.sharpPower + |
| | | scope.row.peakPower + |
| | | scope.row.flatPower + |
| | | scope.row.valleyPower |
| | | }} |
| | | {{ scope.row.sharpPower + scope.row.peakPower + scope.row.flatPower + scope.row.valleyPower }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="totalCost" |
| | | label="æ»çµè´¹(å
)" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | width="100" |
| | | > |
| | | <el-table-column prop="totalCost" label="æ»çµè´¹(å
)" align="center" show-overflow-tooltip width="100"> |
| | | <template #default="scope"> |
| | | {{ |
| | | scope.row.sharpFee + |
| | | scope.row.peakFee + |
| | | scope.row.flatFee + |
| | | scope.row.valleyFee |
| | | }} |
| | | {{ scope.row.sharpFee + scope.row.peakFee + scope.row.flatFee + scope.row.valleyFee }} |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="nodeName" |
| | | label="ç¨è½åå
" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | width="200" |
| | | /> |
| | | <el-table-column prop="nodeName" label="ç¨è½åå
" align="center" show-overflow-tooltip width="200" /> |
| | | </el-table> |
| | | </div> |
| | | </el-dialog> |
| | |
| | | </template> |
| | | |
| | | <script setup name="timeSharing"> |
| | | import { listTimeSharing } from "@/api/peakValley/timeSharing"; |
| | | import * as echarts from "echarts"; |
| | | const { proxy } = getCurrentInstance(); |
| | | import { useRoute } from "vue-router"; |
| | | import useSettingsStore from "@/store/modules/settings"; |
| | | const settingsStore = useSettingsStore(); |
| | | import { listTimeSharing } from "@/api/peakValley/timeSharing" |
| | | import * as echarts from "echarts" |
| | | const { proxy } = getCurrentInstance() |
| | | import { useRoute } from "vue-router" |
| | | import useSettingsStore from "@/store/modules/settings" |
| | | const settingsStore = useSettingsStore() |
| | | watch( |
| | | () => settingsStore.sideTheme, |
| | | (val) => { |
| | | getList(); |
| | | getList() |
| | | } |
| | | ); |
| | | const loading = ref(false); |
| | | const timeSharingList = ref([]); |
| | | const timeSharingDialogTableVisible = ref(false); |
| | | const viewTimeSharingList = ref([]); |
| | | const nodeOptions = ref(undefined); |
| | | ) |
| | | const loading = ref(false) |
| | | const timeSharingList = ref([]) |
| | | const timeSharingDialogTableVisible = ref(false) |
| | | const viewTimeSharingList = ref([]) |
| | | const nodeOptions = ref(undefined) |
| | | const data = reactive({ |
| | | queryParams: { |
| | | nodeId: null, |
| | |
| | | queryTime: null, |
| | | }, |
| | | query: { ...useRoute().query }, |
| | | }); |
| | | const { queryParams, query } = toRefs(data); |
| | | }) |
| | | const { queryParams, query } = toRefs(data) |
| | | /** éè¿æ¡ä»¶è¿æ»¤èç¹ */ |
| | | const filterNode = (value, data) => { |
| | | if (!value) return true; |
| | | return data.label.indexOf(value) !== -1; |
| | | }; |
| | | if (!value) return true |
| | | return data.label.indexOf(value) !== -1 |
| | | } |
| | | function handleNodeClick(data) { |
| | | queryParams.value.nodeId = data.id; |
| | | queryParams.value.nodeName = data.label; |
| | | queryParams.value.queryTime = proxy.dayjs(new Date()).format("YYYY-MM-DD"); |
| | | handleQuery(); |
| | | queryParams.value.nodeId = data.id |
| | | queryParams.value.nodeName = data.label |
| | | queryParams.value.queryTime = proxy.dayjs(new Date()).format("YYYY-MM-DD") |
| | | handleQuery() |
| | | } |
| | | // 峰平谷è½èåæ-å³°å¹³è°·åæ¶ç»è®¡-å表 |
| | | function getList() { |
| | | loading.value = true; |
| | | loading.value = true |
| | | listTimeSharing( |
| | | proxy.addDateRange({ |
| | | ...queryParams.value, |
| | | ...query.value, |
| | | }) |
| | | ).then((res) => { |
| | | loading.value = false; |
| | | loading.value = false |
| | | if (!!res.code && res.code == 200) { |
| | | // å¨åå§åä¹åï¼å
disposeæ§çå®ä¾ |
| | | if (echarts.getInstanceByDom(document.getElementById("Chart1"))) { |
| | | echarts.dispose(document.getElementById("Chart1")); |
| | | echarts.dispose(document.getElementById("Chart1")) |
| | | } |
| | | if (echarts.getInstanceByDom(document.getElementById("Chart2"))) { |
| | | echarts.dispose(document.getElementById("Chart2")); |
| | | echarts.dispose(document.getElementById("Chart2")) |
| | | } |
| | | const myChart1 = echarts.init(document.getElementById("Chart1")); |
| | | const myChart2 = echarts.init(document.getElementById("Chart2")); |
| | | const myChart1 = echarts.init(document.getElementById("Chart1")) |
| | | const myChart2 = echarts.init(document.getElementById("Chart2")) |
| | | if (!!res.data.lineChat) { |
| | | let xdata = []; |
| | | let ytip = []; |
| | | let ypeak = []; |
| | | let yflat = []; |
| | | let ytrough = []; |
| | | let xdata = [] |
| | | let ytip = [] |
| | | let ypeak = [] |
| | | let yflat = [] |
| | | let ytrough = [] |
| | | res.data.lineChat.map((item) => { |
| | | xdata.push(Number(item.xdata.slice(-8).substring(0, 2)) + "æ¶"); |
| | | ytip.push(!!item.ytip ? item.ytip : 0); |
| | | ypeak.push(!!item.ypeak ? item.ypeak : 0); |
| | | yflat.push(!!item.yflat ? item.yflat : 0); |
| | | ytrough.push(!!item.ytrough ? item.ytrough : 0); |
| | | }); |
| | | xdata.push(Number(item.xdata.slice(-8).substring(0, 2)) + "æ¶") |
| | | ytip.push(!!item.ytip ? item.ytip : 0) |
| | | ypeak.push(!!item.ypeak ? item.ypeak : 0) |
| | | yflat.push(!!item.yflat ? item.yflat : 0) |
| | | ytrough.push(!!item.ytrough ? item.ytrough : 0) |
| | | }) |
| | | myChart1.setOption({ |
| | | color: ["#f52528", "#ff6200", "#ffce0c", "#78e801"], |
| | | grid: { |
| | |
| | | itemHeight: 10, |
| | | // right: 0, |
| | | textStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | // data: ['å°', 'å³°', 'å¹³', 'è°·'] |
| | | }, |
| | |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [5, 0, 0, 0], |
| | | // formatter: '{value} ml' |
| | |
| | | name: "èçµé(KWH)", |
| | | type: "value", |
| | | nameTextStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | |
| | | show: true, |
| | | lineStyle: { |
| | | type: "dashed", |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | // formatter: '{value} ml' |
| | | }, |
| | |
| | | { |
| | | name: "å°", // ytip |
| | | type: "bar", |
| | | barWidth: "27", |
| | | barWidth: "12", |
| | | stack: "total", |
| | | data: ytip, |
| | | }, |
| | | { |
| | | name: "å³°", // ypeak |
| | | type: "bar", |
| | | barWidth: "27", |
| | | barWidth: "12", |
| | | stack: "total", |
| | | data: ypeak, |
| | | }, |
| | | { |
| | | name: "å¹³", // yflat |
| | | type: "bar", |
| | | barWidth: "27", |
| | | barWidth: "12", |
| | | stack: "total", |
| | | data: yflat, |
| | | }, |
| | | { |
| | | name: "è°·", // ytrough |
| | | type: "bar", |
| | | barWidth: "27", |
| | | barWidth: "12", |
| | | stack: "total", |
| | | data: ytrough, |
| | | }, |
| | | ], |
| | | }); |
| | | }) |
| | | } |
| | | if (!!res.data.pieChat) { |
| | | myChart2.setOption({ |
| | |
| | | itemGap: 10, |
| | | // right: 0, |
| | | textStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | series: [ |
| | |
| | | label: { |
| | | overflow: "none", |
| | | formatter: "{b} {c}% ", |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | data: [ |
| | | { |
| | | value: !!res.data.pieChat.tip |
| | | ? Number(res.data.pieChat.tip) |
| | | : 0, |
| | | value: !!res.data.pieChat.tip ? Number(res.data.pieChat.tip) : 0, |
| | | name: "å°", |
| | | }, |
| | | { |
| | | value: !!res.data.pieChat.peak |
| | | ? Number(res.data.pieChat.peak) |
| | | : 0, |
| | | value: !!res.data.pieChat.peak ? Number(res.data.pieChat.peak) : 0, |
| | | name: "å³°", |
| | | }, |
| | | { |
| | | value: !!res.data.pieChat.flat |
| | | ? Number(res.data.pieChat.flat) |
| | | : 0, |
| | | value: !!res.data.pieChat.flat ? Number(res.data.pieChat.flat) : 0, |
| | | name: "å¹³", |
| | | }, |
| | | { |
| | | value: !!res.data.pieChat.trough |
| | | ? Number(res.data.pieChat.trough) |
| | | : 0, |
| | | value: !!res.data.pieChat.trough ? Number(res.data.pieChat.trough) : 0, |
| | | name: "è°·", |
| | | }, |
| | | ], |
| | | }, |
| | | ], |
| | | }); |
| | | }) |
| | | } |
| | | if (!!res.data.dataList) { |
| | | timeSharingList.value = !!res.data.dataList ? res.data.dataList : []; |
| | | timeSharingList.value = !!res.data.dataList ? res.data.dataList : [] |
| | | } |
| | | window.addEventListener( |
| | | "resize", |
| | | () => { |
| | | myChart1.resize(); |
| | | myChart2.resize(); |
| | | myChart1.resize() |
| | | myChart2.resize() |
| | | }, |
| | | { passive: true } |
| | | ); |
| | | ) |
| | | } |
| | | }); |
| | | }) |
| | | } |
| | | // 峰平谷è½èåæ-å³°å¹³è°·åæ¶ç»è®¡-æ¥ç |
| | | function handleView(row) { |
| | | queryParams.value.key = row.timeStr; |
| | | timeSharingDialogTableVisible.value = true; |
| | | viewTimeSharingList.value = [row]; |
| | | queryParams.value.key = row.timeStr |
| | | timeSharingDialogTableVisible.value = true |
| | | viewTimeSharingList.value = [row] |
| | | } |
| | | // 峰平谷è½èåæ-å³°å¹³è°·åæ¶ç»è®¡-æç´¢ |
| | | function handleQuery() { |
| | | getList(); |
| | | getList() |
| | | } |
| | | // 峰平谷è½èåæ-å³°å¹³è°·åæ¶ç»è®¡-éç½® |
| | | function resetQuery() { |
| | | proxy.resetForm("queryRef"); |
| | | (queryParams.value.queryTime = proxy.dayjs(new Date()).format("YYYY-MM-DD")), |
| | | handleQuery(); |
| | | proxy.resetForm("queryRef") |
| | | ;(queryParams.value.queryTime = proxy.dayjs(new Date()).format("YYYY-MM-DD")), handleQuery() |
| | | } |
| | | // 峰平谷è½èåæ-å³°å¹³è°·åæ¶ç»è®¡-å¯¼åº |
| | | function handleExport() { |
| | |
| | | ...query.value, |
| | | }, |
| | | `${queryParams.value.nodeName}_å³°å¹³è°·åæ¶ç»è®¡_${new Date().getTime()}.xlsx` |
| | | ); |
| | | ) |
| | | } |
| | | </script> |
| | | <style scoped lang="scss"> |
| | |
| | | <div class="page"> |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true" label-width="80px"> |
| | | <el-form-item label="æ¥æçé" prop="dataTime"> |
| | | <el-date-picker v-model="queryParams.dataTime" value-format="YYYY-MM-DD 00:00:00" type="date" |
| | | placeholder="æ¥æçé" style="width: 100%" /> |
| | | <el-date-picker |
| | | v-model="queryParams.dataTime" |
| | | value-format="YYYY-MM-DD 00:00:00" |
| | | type="date" |
| | | placeholder="æ¥æçé" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery"> |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button type="primary" icon="Search" @click="handleQuery"> æç´¢ </el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Download" @click="handleExport"> |
| | | å¯¼åº |
| | | </el-button> |
| | | <el-button type="primary" icon="Download" @click="handleExport"> å¯¼åº </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div class="chart-box" v-loading="loading"> |
| | |
| | | </template> |
| | | |
| | | <script setup name="chartModal"> |
| | | import * as echarts from "echarts"; |
| | | import { getEnergyRealTimeMonitor } from "@/api/realTimeMonitor/realTimeMonitor"; |
| | | const { proxy } = getCurrentInstance(); |
| | | import useSettingsStore from "@/store/modules/settings"; |
| | | const settingsStore = useSettingsStore(); |
| | | const dialogTableVisible = ref(false); |
| | | import * as echarts from "echarts" |
| | | import { getEnergyRealTimeMonitor } from "@/api/realTimeMonitor/realTimeMonitor" |
| | | const { proxy } = getCurrentInstance() |
| | | import useSettingsStore from "@/store/modules/settings" |
| | | const settingsStore = useSettingsStore() |
| | | const dialogTableVisible = ref(false) |
| | | const data = reactive({ |
| | | title: null, |
| | | queryParams: { |
| | | tagCode: null, |
| | | dataTime: null, |
| | | }, |
| | | }); |
| | | const { queryParams, title } = toRefs(data); |
| | | const loading = ref(false); |
| | | defineExpose({ handleOpen }); |
| | | }) |
| | | const { queryParams, title } = toRefs(data) |
| | | const loading = ref(false) |
| | | defineExpose({ handleOpen }) |
| | | function handleOpen(row) { |
| | | title.value = row.name; |
| | | dialogTableVisible.value = true; |
| | | queryParams.value.nodeName = row.nodeName; |
| | | queryParams.value.tagCode = row.indexCode; |
| | | queryParams.value.unit = row.unit; |
| | | queryParams.value.name = row.name; |
| | | queryParams.value.dataTime = proxy |
| | | .dayjs(new Date()) |
| | | .format("YYYY-MM-DD 00:00:00"); |
| | | getList(); |
| | | title.value = row.name |
| | | dialogTableVisible.value = true |
| | | queryParams.value.nodeName = row.nodeName |
| | | queryParams.value.tagCode = row.indexCode |
| | | queryParams.value.unit = row.unit |
| | | queryParams.value.name = row.name |
| | | queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD 00:00:00") |
| | | getList() |
| | | } |
| | | function handleClose() { |
| | | dialogTableVisible.value = false; |
| | | dialogTableVisible.value = false |
| | | } |
| | | // è½æºå®æ¶çæ§-è½æºå®æ¶çæ§-å表 |
| | | function getList() { |
| | | loading.value = true; |
| | | getEnergyRealTimeMonitor(proxy.addDateRange(queryParams.value)).then( |
| | | (res) => { |
| | | const myChart1 = echarts.init(document.getElementById("Chart1")); |
| | | if (!!res.code && res.code == 200) { |
| | | if (!!res.data) { |
| | | let xdata = []; |
| | | let ydata = []; |
| | | res.data.map((item) => { |
| | | xdata.push(proxy.dayjs(item.name).format("HH:mm")); |
| | | ydata.push(!!item.value ? item.value : 0); |
| | | }); |
| | | loading.value = false; |
| | | myChart1.setOption({ |
| | | color: ["#2979ff", "#19be6b", "#ff9900", "#fa3534"], |
| | | grid: { |
| | | top: "45", |
| | | left: "6%", |
| | | right: "5%", |
| | | bottom: "10", |
| | | containLabel: true, |
| | | }, |
| | | tooltip: { |
| | | trigger: "axis", |
| | | axisPointer: { |
| | | type: "shadow", |
| | | }, |
| | | }, |
| | | xAxis: { |
| | | type: "category", |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | | show: false, |
| | | }, |
| | | splitArea: { |
| | | show: false, |
| | | }, |
| | | splitLine: { |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | fontSize: 14, |
| | | padding: [5, 0, 0, 0], |
| | | // formatter: '{value} ml' |
| | | }, |
| | | data: xdata, |
| | | }, |
| | | yAxis: { |
| | | type: "value", |
| | | name: |
| | | queryParams.value.name + |
| | | (!!queryParams.value.unit |
| | | ? "(" + queryParams.value.unit + ")" |
| | | : ""), |
| | | nameTextStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | | axisLine: { |
| | | show: false, |
| | | }, |
| | | splitLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | type: "dashed", |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | | show: false, |
| | | }, |
| | | splitArea: { |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | fontSize: 14, |
| | | }, |
| | | }, |
| | | series: [ |
| | | { |
| | | name: title.value + "å岿°æ®æ¥è¯¢", // ytip |
| | | type: "line", |
| | | barWidth: "27", |
| | | stack: "total", |
| | | data: ydata, |
| | | }, |
| | | ], |
| | | }); |
| | | } |
| | | window.addEventListener( |
| | | "resize", |
| | | () => { |
| | | myChart1.resize(); |
| | | loading.value = true |
| | | getEnergyRealTimeMonitor(proxy.addDateRange(queryParams.value)).then((res) => { |
| | | const myChart1 = echarts.init(document.getElementById("Chart1")) |
| | | if (!!res.code && res.code == 200) { |
| | | if (!!res.data) { |
| | | let xdata = [] |
| | | let ydata = [] |
| | | res.data.map((item) => { |
| | | xdata.push(proxy.dayjs(item.name).format("HH:mm")) |
| | | ydata.push(!!item.value ? item.value : 0) |
| | | }) |
| | | loading.value = false |
| | | myChart1.setOption({ |
| | | color: ["#2979ff", "#19be6b", "#ff9900", "#fa3534"], |
| | | grid: { |
| | | top: "45", |
| | | left: "6%", |
| | | right: "5%", |
| | | bottom: "10", |
| | | containLabel: true, |
| | | }, |
| | | { passive: true } |
| | | ); |
| | | tooltip: { |
| | | trigger: "axis", |
| | | axisPointer: { |
| | | type: "shadow", |
| | | }, |
| | | }, |
| | | xAxis: { |
| | | type: "category", |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | | show: false, |
| | | }, |
| | | splitArea: { |
| | | show: false, |
| | | }, |
| | | splitLine: { |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [5, 0, 0, 0], |
| | | // formatter: '{value} ml' |
| | | }, |
| | | data: xdata, |
| | | }, |
| | | yAxis: { |
| | | type: "value", |
| | | name: queryParams.value.name + (!!queryParams.value.unit ? "(" + queryParams.value.unit + ")" : ""), |
| | | nameTextStyle: { |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | | axisLine: { |
| | | show: false, |
| | | }, |
| | | splitLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | type: "dashed", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | | show: false, |
| | | }, |
| | | splitArea: { |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | }, |
| | | }, |
| | | series: [ |
| | | { |
| | | name: title.value + "å岿°æ®æ¥è¯¢", // ytip |
| | | type: "line", |
| | | barWidth: "12", |
| | | stack: "total", |
| | | data: ydata, |
| | | }, |
| | | ], |
| | | }) |
| | | } |
| | | window.addEventListener( |
| | | "resize", |
| | | () => { |
| | | myChart1.resize() |
| | | }, |
| | | { passive: true } |
| | | ) |
| | | } |
| | | ); |
| | | }) |
| | | } |
| | | // è½æºå®æ¶çæ§-è½æºå®æ¶çæ§-æç´¢ |
| | | function handleQuery() { |
| | | getList(); |
| | | getList() |
| | | } |
| | | // è½æºå®æ¶çæ§-è½æºå®æ¶çæ§-éç½® |
| | | function resetQuery() { |
| | | proxy.resetForm("queryRef"); |
| | | (queryParams.value.dataTime = proxy |
| | | .dayjs(new Date()) |
| | | .format("YYYY-MM-DD 00:00:00")), |
| | | handleNodeClick(nodeOptions.value[0]); |
| | | proxy.resetForm("queryRef") |
| | | ;(queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD 00:00:00")), |
| | | handleNodeClick(nodeOptions.value[0]) |
| | | } |
| | | // è½æºå®æ¶çæ§-è½æºå®æ¶çæ§-å¯¼åº |
| | | function handleExport() { |
| | |
| | | "rtdb/realtimeTrend/export", |
| | | queryParams.value, |
| | | `${queryParams.value.nodeName}-${queryParams.value.name}_è½æºå®æ¶çæ§_${new Date().getTime()}.xlsx` |
| | | ); |
| | | ) |
| | | } |
| | | </script> |
| | | <style scoped lang="scss"> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <div slot="header" class="clearfix"> |
| | | <el-button |
| | | style="float: right; padding: 8px; margin-left: 8px" |
| | | type="text" |
| | | icon="el-icon-setting" |
| | | @click="saveSetting" |
| | | > |
| | | ä¿åé
ç½® |
| | | </el-button> |
| | | <el-button |
| | | style="float: right; padding: 8px; margin-left: 8px" |
| | | type="text" |
| | | icon="el-icon-setting" |
| | | @click="reset()" |
| | | > |
| | | éæ°éæ©åºå¾ |
| | | </el-button> |
| | | </div> |
| | | <el-row> |
| | | <el-col :span="18"> |
| | | <!-- v-if="filePath === '空èç¹'" --> |
| | | <div style="text-align: center; margin-left: 12px" v-if="filePath === '空èç¹'"> |
| | | <FileUpload |
| | | :modelValue="fileList" |
| | | @update:modelValue="fileUploadChange" |
| | | :isShowTip="false" |
| | | :limit="1" |
| | | :fileSize="20" |
| | | :fileType="[]" |
| | | :draggable="true" |
| | | /> |
| | | </div> |
| | | |
| | | <div id="svgHtml" v-if="filePath !== '空èç¹'"> |
| | | <div v-html="svgHtml" /> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="6" style="height: calc(100vh - 165px); overflow: auto"> |
| | | <el-table :data="tags" border> |
| | | <el-table-column label="åæ°" align="center" prop="param" /> |
| | | <el-table-column label="ééç¹" align="center" prop="tag"> |
| | | <template #default="scope"> |
| | | <el-autocomplete |
| | | popper-class="my-autocomplete" |
| | | v-model="scope.row['tag']" |
| | | :fetch-suggestions="querySearch" |
| | | placeholder="请è¾å
¥ææ ç¼ç " |
| | | placement="bottom-end" |
| | | > |
| | | <template #default="{ item }"> |
| | | <div class="">{{ item.value }}</div> |
| | | <span class="" style="color: #409eff; display: block">{{ item.name }}</span> |
| | | </template> |
| | | </el-autocomplete> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { getAllCollectTag, getConfigure, saveSettingApi, updateEquipmentfile } from "@/api/svg/equipmentfile" |
| | | const { proxy } = getCurrentInstance() |
| | | let props = defineProps(["types"]) |
| | | const emit = defineEmits(["getList"]) |
| | | const currentNode = ref({}) |
| | | const filePath = ref("空èç¹") |
| | | const svgHtml = ref("") |
| | | const form = ref({ |
| | | nodeId: "", |
| | | fileName: "", |
| | | svgType: "", |
| | | }) |
| | | const tags = ref([]) |
| | | const fileList = ref([]) |
| | | |
| | | function changeModelNode(modelNode) { |
| | | currentNode.value = modelNode |
| | | filePath.value = "空èç¹" |
| | | getConfigure(modelNode.id).then((response) => { |
| | | tags.value = [] |
| | | svgHtml.value = "" |
| | | if (response.code === 200) { |
| | | if (response.data) { |
| | | filePath.value = response.data.filePath |
| | | tags.value = response.data.infoList |
| | | getSvg() |
| | | } |
| | | } else { |
| | | proxy.$modal.msgError(response.msg) |
| | | } |
| | | }) |
| | | } |
| | | // åå§åsvg |
| | | function getSvg() { |
| | | /* å建xhr对象 */ |
| | | const xhr = new XMLHttpRequest() |
| | | xhr.open("GET", filePath.value, true) |
| | | xhr.send() |
| | | /* çå¬xhr对象 */ |
| | | xhr.addEventListener("load", () => { |
| | | svgHtml.value = xhr.responseText |
| | | let values = xhr.responseXML.getElementsByTagName("text") |
| | | let tagTemps = [] |
| | | for (let i = 0; i < values.length; i++) { |
| | | if (values[i].getAttribute("id") != undefined) |
| | | tagTemps.push({ |
| | | param: values[i].textContent, |
| | | tag: "", |
| | | tagType: "COLLECT", |
| | | }) |
| | | } |
| | | console.log(tags.value.length, tagTemps.length) |
| | | if (tags.value.length === 0 || tags.value.length != tagTemps.length) { |
| | | tags.value = [] |
| | | tags.value = tagTemps |
| | | console.log("222", tags.value.length, tagTemps.length) |
| | | } |
| | | }) |
| | | } |
| | | //ä¸ä¼ æåå |
| | | function fileUploadChange(val) { |
| | | if (val.length) { |
| | | // this.$refs.upload.clearFiles() |
| | | form.value.nodeId = currentNode.value.id |
| | | form.value.filePath = val[0].fullUrl |
| | | form.value.svgType = "COLLECT" |
| | | updateEquipmentfile(form.value).then((result) => { |
| | | if (result.code === 200) { |
| | | filePath.value = val[0].fullUrl |
| | | tags.value = [] |
| | | getSvg() |
| | | } else { |
| | | proxy.$modal.msgError(result.msg) |
| | | } |
| | | }) |
| | | } else { |
| | | proxy.$modal.msgError(result.msg) |
| | | } |
| | | } |
| | | |
| | | function querySearch(queryString, cb) { |
| | | if (queryString) { |
| | | getAllCollectTag({ |
| | | codeOrName: queryString, |
| | | indexType: "COLLECT", |
| | | }).then((response) => { |
| | | // è°ç¨ callback è¿å建议åè¡¨çæ°æ® |
| | | let result = response.data |
| | | let values = [] |
| | | result.forEach((item) => { |
| | | values.push({ |
| | | value: item.code, |
| | | name: item.name, |
| | | }) |
| | | }) |
| | | cb(values) |
| | | }) |
| | | } |
| | | } |
| | | function saveSetting() { |
| | | saveSettingApi(currentNode.value.id, tags.value).then((response) => { |
| | | if (response.code === 200) { |
| | | proxy.$modal.msgSuccess(response.msg) |
| | | } else { |
| | | proxy.$modal.msgError(response.msg) |
| | | } |
| | | }) |
| | | } |
| | | function reset() { |
| | | filePath.value = "空èç¹" |
| | | } |
| | | |
| | | defineExpose({ changeModelNode }) |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .el-autocomplete { |
| | | width: 100%; |
| | | } |
| | | |
| | | .my-autocomplete li { |
| | | line-height: normal; |
| | | padding: 7px; |
| | | } |
| | | |
| | | .my-autocomplete li .name { |
| | | text-overflow: ellipsis; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .my-autocomplete li .addr { |
| | | font-size: 12px; |
| | | color: #b4b4b4; |
| | | } |
| | | |
| | | .my-autocomplete li .highlighted .addr { |
| | | color: #ddd; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <div v-if="filePath" v-html="svgHtml" /> |
| | | <div v-else>ææªä¸ä¼ </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { getConfigure, getLiveData } from "@/api/svg/equipmentfile" |
| | | import { onMounted } from "vue" |
| | | const { proxy } = getCurrentInstance() |
| | | let props = defineProps(["nodeId"]) |
| | | const emit = defineEmits(["getList"]) |
| | | const currentNode = ref({}) |
| | | const filePath = ref("") |
| | | const svgHtml = ref("") |
| | | const form = ref({ |
| | | nodeId: "", |
| | | fileName: "", |
| | | svgType: "", |
| | | }) |
| | | const tags = ref([]) |
| | | const tagCodes = ref([]) |
| | | const valueItems = ref(null) |
| | | const timer = ref(null) |
| | | |
| | | function show(nodeId) { |
| | | console.log(nodeId) |
| | | tagCodes.value = [] |
| | | filePath.value = "" |
| | | getConfigure(nodeId).then((response) => { |
| | | tags.value = [] |
| | | svgHtml.value = "" |
| | | if (response.code === 200) { |
| | | if (response.data) { |
| | | filePath.value = response.data.filePath |
| | | tags.value = response.data.infoList |
| | | getSvg() |
| | | refresh() |
| | | } |
| | | } else { |
| | | proxy.$modal.msgError(response.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | function refresh() { |
| | | if (tagCodes.value.length === 0) { |
| | | return |
| | | } |
| | | getLiveData(tagCodes.value).then((response) => { |
| | | if (response.code === 200) { |
| | | if (response.data) { |
| | | response.data.forEach((tagValue) => { |
| | | let value = "" |
| | | if (tagValue.value) { |
| | | value = parseFloat(tagValue.value).toFixed(2) |
| | | } else { |
| | | value = "0" |
| | | } |
| | | |
| | | let el = document.getElementById(tagValue.tagCode) |
| | | if (el) { |
| | | el.textContent = value |
| | | } |
| | | }) |
| | | //è¿åæ¯åç¬å ç ç¨æ¥å¤ç æ²¡æææ æè
ææ æ²¡æç»æç é½è®¾ç½®0 |
| | | let allText = document.getElementsByTagName("text") |
| | | for (let i = 0; i < allText.length; i++) { |
| | | // console.log(i + "textContent=" + allText[i].textContent); |
| | | if (allText[i].textContent == null || allText[i].textContent == "") { |
| | | allText[i].textContent = "0" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | function refreshData() { |
| | | timer.value = setInterval(() => { |
| | | refresh() |
| | | }, 3000) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | refreshData() |
| | | }) |
| | | |
| | | onBeforeUnmount(() => { |
| | | clearInterval(timer.value) |
| | | }) |
| | | |
| | | // åå§åsvg |
| | | function getSvg() { |
| | | /* å建xhr对象 */ |
| | | const xhr = new XMLHttpRequest() |
| | | xhr.open("GET", filePath.value, true) |
| | | xhr.send() |
| | | /* çå¬xhr对象 */ |
| | | xhr.addEventListener("load", () => { |
| | | const resXML = xhr.responseXML |
| | | let svgDom = resXML.documentElement.cloneNode(true) |
| | | let values = svgDom.getElementsByTagName("text") |
| | | for (let i = 0; i < values.length; i++) { |
| | | let tag = tags.value.filter((f) => f.param === values[i].textContent) |
| | | if (tag && tag.length > 0) { |
| | | let tagCode = tag[0].tag |
| | | values[i].textContent = "" |
| | | if (tagCode) { |
| | | values[i].setAttribute("id", tagCode) |
| | | tagCodes.value.push(tagCode) |
| | | } |
| | | } |
| | | } |
| | | let oSerializer = new XMLSerializer() |
| | | svgHtml.value = oSerializer.serializeToString(svgDom) |
| | | }) |
| | | } |
| | | |
| | | defineExpose({ show }) |
| | | </script> |
| | | |
| | | <style lang="scss" scoped></style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="page"> |
| | | <div class="page-container"> |
| | | <div class="page-container-left"> |
| | | <LeftTree ref="leftTreeRef" @handleNodeClick="handleNodeClick" /> |
| | | </div> |
| | | <div class="page-container-right"> |
| | | <BaseCard :title="queryParams.nodeName"> |
| | | <ConfigureChartView ref="ConfigureChartViewRef" /> |
| | | </BaseCard> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <script setup name="energy-real-time-monitor"> |
| | | import ConfigureChartView from "../components/configureView.vue" |
| | | import { listEnergyRealTimeMonitor } from "@/api/realTimeMonitor/realTimeMonitor" |
| | | import { getConfigure } from "@/api/svg/equipmentfile" |
| | | const { proxy } = getCurrentInstance() |
| | | import { useRoute } from "vue-router" |
| | | import useSettingsStore from "@/store/modules/settings" |
| | | const settingsStore = useSettingsStore() |
| | | watch( |
| | | () => settingsStore.sideTheme, |
| | | (val) => { |
| | | // getList() |
| | | } |
| | | ) |
| | | const loading = ref(false) |
| | | const data = reactive({ |
| | | queryParams: { |
| | | nodeId: null, |
| | | nodeName: null, |
| | | energyType: null, |
| | | }, |
| | | query: { ...useRoute().query }, |
| | | }) |
| | | const { queryParams, query } = toRefs(data) |
| | | const ConfigureChartViewRef = ref() |
| | | /** èç¹åå»äºä»¶ */ |
| | | function handleNodeClick(data) { |
| | | queryParams.value.nodeId = data.id |
| | | queryParams.value.nodeName = data.label |
| | | if (!data.id) { |
| | | return |
| | | } |
| | | getConfigure(data.id).then((response) => { |
| | | if (response.code === 200) { |
| | | let tagCodes = [] |
| | | if (response.data) { |
| | | response.data.infoList.forEach((tag) => { |
| | | tagCodes.push(tag.tag) |
| | | }) |
| | | } else { |
| | | tagCodes = [] |
| | | } |
| | | ConfigureChartViewRef.value.show(data.id) |
| | | } else { |
| | | proxy.$modal.msgError(response.msg) |
| | | } |
| | | }) |
| | | } |
| | | </script> |
| | | <style scoped lang="scss"> |
| | | @import "@/assets/styles/page.scss"; |
| | | |
| | | .themeDark { |
| | | .card-box { |
| | | margin: 0 18px; |
| | | padding: 10px 18px; |
| | | box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.12); |
| | | border-radius: 8px 8px 8px 8px; |
| | | border: 1px solid #22408c; |
| | | margin-bottom: 20px; |
| | | |
| | | &-title { |
| | | // margin: 10px 0 10px; |
| | | color: rgba(255, 255, 255, 0.8); |
| | | text-align: left; |
| | | font-weight: bold; |
| | | font-family: OPPOSans, OPPOSans; |
| | | font-weight: 500; |
| | | font-size: 16px; |
| | | font-style: normal; |
| | | text-transform: none; |
| | | } |
| | | |
| | | &-ul { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | } |
| | | |
| | | &-li { |
| | | width: 18%; |
| | | margin: 1%; |
| | | border-radius: 5px; |
| | | border: 1px solid #22408c; |
| | | margin-bottom: 5px; |
| | | background: #1a235d; |
| | | box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.12); |
| | | border-radius: 8px 8px 8px 8px; |
| | | padding: 0 10px; |
| | | |
| | | .title { |
| | | font-size: 14px; |
| | | color: rgba(255, 255, 255, 0.8); |
| | | font-family: OPPOSans, OPPOSans; |
| | | font-weight: 500; |
| | | font-size: 16px; |
| | | line-height: 19px; |
| | | text-align: left; |
| | | font-style: normal; |
| | | text-transform: none; |
| | | } |
| | | |
| | | .num { |
| | | font-size: 22px; |
| | | color: #36d3ff; |
| | | font-family: OPPOSans, OPPOSans; |
| | | font-weight: 800; |
| | | font-size: 32px; |
| | | text-align: left; |
| | | font-style: normal; |
| | | text-transform: none; |
| | | } |
| | | |
| | | .time { |
| | | color: rgba(255, 253, 253, 0.7); |
| | | font-family: Poppins, Poppins; |
| | | font-weight: 400; |
| | | text-align: left; |
| | | font-style: normal; |
| | | text-transform: none; |
| | | } |
| | | } |
| | | |
| | | dd { |
| | | padding: 0; |
| | | margin-left: 5px; |
| | | margin-bottom: 10px; |
| | | } |
| | | } |
| | | |
| | | .hamburger { |
| | | display: inline-block; |
| | | vertical-align: middle; |
| | | width: 20px; |
| | | height: 20px; |
| | | } |
| | | |
| | | .hamburger.is-active { |
| | | transform: rotate(180deg); |
| | | } |
| | | |
| | | .item-box { |
| | | display: flex; |
| | | justify-items: center; |
| | | align-items: center; |
| | | flex-wrap: wrap; |
| | | margin: 10px 18px; |
| | | |
| | | .item-tag { |
| | | // width: 13%; |
| | | text-align: center; |
| | | margin: 5px 8px; |
| | | border-radius: 8px; |
| | | padding: 7px 10px; |
| | | font-family: OPPOSans, OPPOSans; |
| | | font-weight: 500; |
| | | font-size: 16px; |
| | | color: #ffffff; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .themeLight { |
| | | .card-box { |
| | | margin: 0 18px; |
| | | padding: 10px 18px; |
| | | box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.12); |
| | | border-radius: 8px 8px 8px 8px; |
| | | margin-bottom: 20px; |
| | | |
| | | &-title { |
| | | // margin: 10px 0 10px; |
| | | text-align: left; |
| | | font-weight: bold; |
| | | font-family: OPPOSans, OPPOSans; |
| | | font-weight: 500; |
| | | font-size: 16px; |
| | | font-style: normal; |
| | | text-transform: none; |
| | | } |
| | | |
| | | &-ul { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | } |
| | | |
| | | &-li { |
| | | width: 240px; |
| | | margin-right: 10px; |
| | | margin-top: 16px; |
| | | border-radius: 5px; |
| | | border: 1px solid #ebebeb; |
| | | margin-bottom: 5px; |
| | | background: #fff; |
| | | // box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.12); |
| | | border-radius: 8px 8px 8px 8px; |
| | | padding: 0 10px; |
| | | |
| | | .title { |
| | | font-size: 14px; |
| | | color: #676767; |
| | | font-family: OPPOSans, OPPOSans; |
| | | font-weight: 500; |
| | | font-size: 16px; |
| | | line-height: 19px; |
| | | text-align: left; |
| | | font-style: normal; |
| | | text-transform: none; |
| | | } |
| | | |
| | | .num { |
| | | font-size: 22px; |
| | | color: #3271eb; |
| | | font-family: OPPOSans, OPPOSans; |
| | | font-weight: 800; |
| | | font-size: 32px; |
| | | text-align: left; |
| | | font-style: normal; |
| | | text-transform: none; |
| | | } |
| | | |
| | | .time { |
| | | color: #676767; |
| | | font-family: Poppins, Poppins; |
| | | font-weight: 400; |
| | | text-align: left; |
| | | font-style: normal; |
| | | text-transform: none; |
| | | } |
| | | } |
| | | |
| | | dd { |
| | | padding: 0; |
| | | margin-left: 5px; |
| | | margin-bottom: 10px; |
| | | } |
| | | } |
| | | |
| | | .hamburger { |
| | | display: inline-block; |
| | | vertical-align: middle; |
| | | width: 20px; |
| | | height: 20px; |
| | | } |
| | | |
| | | .hamburger.is-active { |
| | | transform: rotate(180deg); |
| | | } |
| | | |
| | | .item-box { |
| | | display: flex; |
| | | justify-items: center; |
| | | align-items: center; |
| | | flex-wrap: wrap; |
| | | margin: 10px 18px; |
| | | |
| | | .item-tag { |
| | | // width: 13%; |
| | | text-align: center; |
| | | margin: 5px 8px; |
| | | border-radius: 8px; |
| | | padding: 7px 3px; |
| | | font-family: OPPOSans, OPPOSans; |
| | | font-weight: 500; |
| | | font-size: 16px; |
| | | color: #ffffff; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .scrollbar-flex-content { |
| | | display: flex; |
| | | margin: 10px 18px; |
| | | } |
| | | .scrollbar-demo-item { |
| | | flex-shrink: 0; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | // width: 100px; |
| | | // height: 50px; |
| | | // margin: 10px; |
| | | text-align: center; |
| | | border-radius: 4px; |
| | | background: var(--el-color-danger-light-9); |
| | | color: var(--el-color-danger); |
| | | } |
| | | |
| | | .item-tag { |
| | | // width: 13%; |
| | | text-align: center; |
| | | margin: 5px 8px; |
| | | border-radius: 8px; |
| | | padding: 7px 10px; |
| | | font-family: OPPOSans, OPPOSans; |
| | | font-weight: 500; |
| | | font-size: 16px; |
| | | color: #ffffff; |
| | | cursor: pointer; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="page"> |
| | | <div class="page-container"> |
| | | <div class="page-container-left"> |
| | | <div class="tree page-box"> |
| | | <div class="select-box mb20"> |
| | | æ°æ®æ¨¡åï¼ |
| | | <el-select |
| | | style="width: 180px" |
| | | v-model="modelData" |
| | | placeholder="è¯·éæ©æ¨¡å" |
| | | filterable |
| | | @change="changeModel" |
| | | > |
| | | <el-option |
| | | v-for="model in modelInfoOptions" |
| | | :key="model.modelCode" |
| | | :label="model.modelName" |
| | | :value="model.modelCode" |
| | | /> |
| | | </el-select> |
| | | </div> |
| | | <div class="tree-box" v-loading="treeLoading"> |
| | | <el-tree |
| | | ref="treeRef" |
| | | :props="defaultProps" |
| | | :data="treeData" |
| | | node-key="id" |
| | | highlight-current |
| | | :filter-node-method="filterNode" |
| | | :default-expanded-keys="treeExpandData" |
| | | :expand-on-click-node="false" |
| | | @node-click="changeNode" |
| | | accordion |
| | | > |
| | | <template #default="{ node, data }"> |
| | | <span> |
| | | <el-tooltip |
| | | v-if="node.label.length > 16" |
| | | class="item" |
| | | effect="dark" |
| | | :content="node.label" |
| | | placement="top-end" |
| | | > |
| | | <span>{{ node.label.slice(0, 16) + "..." }}</span> |
| | | </el-tooltip> |
| | | <span v-else id="b">{{ node.label }}</span> |
| | | </span> |
| | | </template> |
| | | </el-tree> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="page-container-right"> |
| | | <BaseCard :title="currentNode ? currentNode.label + '--èç¹é
ç½®' : 'ææ èç¹é
ç½®'"> |
| | | <div class="content-box"> |
| | | <ConfigureView ref="configureViewRef" /> |
| | | </div> |
| | | </BaseCard> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { listModel } from "@/api/modelConfiguration/businessModel" |
| | | import { treeList } from "@/api/modelConfiguration/indexWarehouse" |
| | | import ConfigureView from "../components/configure.vue" |
| | | import { nextTick } from "vue" |
| | | import { useRoute } from "vue-router" |
| | | let { proxy } = getCurrentInstance() |
| | | let treeLoading = ref(true) |
| | | let modelData = ref(null) |
| | | let modelInfoOptions = ref([]) //䏿å表 |
| | | const configureViewRef = ref() |
| | | //è·å䏿å表 |
| | | function searchList(flag) { |
| | | listModel({ isShow: 1 }).then((response) => { |
| | | modelInfoOptions.value = response.data |
| | | if (flag) { |
| | | if (modelInfoOptions.value.length > 0) { |
| | | if (proxy.$route.query.modelCode) { |
| | | modelData.value = proxy.$route.query.modelCode |
| | | } else { |
| | | modelData.value = modelInfoOptions.value[0].modelCode |
| | | } |
| | | getTreeList(modelData.value) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | searchList(true) |
| | | |
| | | //䏿éä¸è§¦åæ å表 |
| | | function changeModel(item) { |
| | | // console.log('changeModel', item) |
| | | getTreeList(item) |
| | | } |
| | | |
| | | let treeRef = ref(null) |
| | | let treeData = ref([]) |
| | | |
| | | const defaultProps = ref({ |
| | | children: "children", |
| | | label: "label", |
| | | }) |
| | | |
| | | //æ£ç´¢æ |
| | | let filterText = ref("") |
| | | |
| | | const filterNode = (value, data) => { |
| | | if (!value) return true |
| | | return data.label.includes(value) |
| | | } |
| | | watch(filterText, (val) => { |
| | | // æ£æ¥treeRef.valueæ¯å¦æ¯ä¸ä¸ªææçElTreeå®ä¾ |
| | | if (treeRef.value && typeof treeRef.value.filter === "function") { |
| | | // è°ç¨filteræ¹æ³ |
| | | treeRef.value.filter(val) |
| | | } else { |
| | | // treeRef.valueæ æï¼å¤çé误 |
| | | console.error("error") |
| | | } |
| | | }) |
| | | |
| | | let currentNode = ref(null) |
| | | let treeExpandData = ref([]) |
| | | let isFirstLeafNode = ref(false) |
| | | let deviceConfigRef = ref(null) |
| | | let collectIndicatorsRef = ref(null) |
| | | let statisticalIndicatorsRef = ref(null) |
| | | |
| | | //è·åæ å表 |
| | | function getTreeList(modelCode) { |
| | | treeLoading.value = true |
| | | treeList({ modelCode }).then((res) => { |
| | | treeLoading.value = false |
| | | let { data } = res |
| | | treeData.value = data |
| | | let chooseNode = null |
| | | if (data.length > 0) { |
| | | if (data[0].children && data[0].children.length !== 0 && isFirstLeafNode.value) { |
| | | if (data[0].children[0].children && data[0].children[0].children.length !== 0) { |
| | | chooseNode = data[0].children[0].children[0] |
| | | } else { |
| | | chooseNode = data[0].children[0] |
| | | } |
| | | } else { |
| | | chooseNode = data[0] |
| | | } |
| | | currentNode.value = chooseNode |
| | | changeNode(currentNode.value) |
| | | treeExpandData.value.push(chooseNode.id) |
| | | nextTick(() => { |
| | | treeRef.value.setCurrentKey(chooseNode.id) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | //æ ç¹å» |
| | | function changeNode(data, node, ev) { |
| | | console.log("æ ç¹å»", data) |
| | | currentNode.value = data |
| | | configureViewRef.value.changeModelNode(data) |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | @import "@/assets/styles/page.scss"; |
| | | |
| | | .page-box { |
| | | height: calc(100vh - 145px); |
| | | padding-top: 12px; |
| | | |
| | | .tree-box { |
| | | height: calc(100% - 70px); |
| | | overflow-y: auto !important; |
| | | } |
| | | |
| | | .select-box { |
| | | display: flex; |
| | | align-items: center; |
| | | color: #3371eb; |
| | | margin-left: 10px; |
| | | |
| | | :deep .el-icon { |
| | | color: #fff; |
| | | margin: 0 10px 0 15px; |
| | | font-size: 14px; |
| | | } |
| | | } |
| | | |
| | | .node-opt { |
| | | flex: 1; |
| | | text-align: right; |
| | | margin-right: 5px; |
| | | |
| | | :deep .el-icon { |
| | | color: #fff; |
| | | margin-right: 5px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | :deep .el-tabs__nav-wrap:after { |
| | | background: transparent; |
| | | } |
| | | |
| | | :deep .el-tabs__item { |
| | | color: #fff; |
| | | font-size: 20px; |
| | | padding: 0 20px; |
| | | |
| | | &.is-active, |
| | | &:hover { |
| | | color: #999 !important; |
| | | } |
| | | } |
| | | |
| | | .tab-box { |
| | | display: flex; |
| | | align-items: center; |
| | | color: #fff; |
| | | border-bottom: 1px solid #3371eb; |
| | | margin-right: 20px; |
| | | |
| | | .tab-li { |
| | | cursor: pointer; |
| | | border: 1px solid #3371eb; |
| | | padding: 10px 25px; |
| | | border-radius: 5px 5px 0 0; |
| | | } |
| | | |
| | | .is-tab { |
| | | background: #3371eb; |
| | | } |
| | | } |
| | | |
| | | .content-box { |
| | | height: calc(100vh - 206px) !important; |
| | | } |
| | | </style> |