Commit b696dbfb by 宋祥

Merge remote-tracking branch 'origin/dev-sx' into dev-sx

parents a634797c c97cf03d
package com.baosight.hggp.hg.sb.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/10/21
* @description
*/
public class HGSB010 extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id"; /* ID*/
public static final String FIELD_COMPANY_CODE = "companyCode";
public static final String FIELD_FILE_NAME = "fileName"; /* 文件名*/
public static final String FIELD_EQUIPMENT_TYPE = "equipmentType"; /* 设备状态*/
public static final String FIELD_EQUIPMENT_CODE = "equipmentCode"; /* 设备编码*/
public static final String FIELD_LOG_INIVALUE = "logInivalue"; /* 初始类容*/
public static final String FIELD_LOG_VALUE = "logValue"; /* 日志类容*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
public static final String FIELD_CREATED_TIME = "createdTime"; /* 创建时间*/
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 更新人*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 更新人名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 更新时间*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除0.否1.是*/
public static final String COL_ID = "ID"; /* ID*/
public static final String COL_COMPANY_CODE = "COMPANY_CODE";
public static final String COL_FILE_NAME = "FILE_NAME"; /* 文件名*/
public static final String COL_EQUIPMENT_TYPE = "EQUIPMENT_TYPE"; /* 设备状态*/
public static final String COL_EQUIPMENT_CODE = "EQUIPMENT_CODE"; /* 设备编码*/
public static final String COL_LOG_INIVALUE = "LOG_INIVALUE"; /* 初始类容*/
public static final String COL_LOG_VALUE = "LOG_VALUE"; /* 日志类容*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 创建时间*/
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 更新人*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 更新人名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除0.否1.是*/
public static final String QUERY = "HPSB002.query";
public static final String COUNT = "HPSB002.count";
public static final String INSERT = "HPSB002.insert";
public static final String UPDATE = "HPSB002.update";
public static final String DELETE = "HPSB002.delete";
private Long id = new Long(0); /* ID*/
private String companyCode = " ";
private String fileName = " "; /* 文件名*/
private String equipmentType = " "; /* 设备状态*/
private String equipmentCode = " "; /* 设备编码*/
private String logInivalue = " "; /* 初始类容*/
private String logValue = " "; /* 日志类容*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 更新人名称*/
private String updatedTime = " "; /* 更新时间*/
private Integer deleteFlag = new Integer(0); /* 是否删除0.否1.是*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_ID);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName("ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COMPANY_CODE);
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FILE_NAME);
eiColumn.setDescName("文件名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_EQUIPMENT_TYPE);
eiColumn.setDescName("设备状态");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_EQUIPMENT_CODE);
eiColumn.setDescName("设备编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LOG_INIVALUE);
eiColumn.setDescName("初始类容");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LOG_VALUE);
eiColumn.setDescName("日志类容");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_BY);
eiColumn.setDescName("创建人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_NAME);
eiColumn.setDescName("创建人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_TIME);
eiColumn.setDescName("创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_BY);
eiColumn.setDescName("更新人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_NAME);
eiColumn.setDescName("更新人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_TIME);
eiColumn.setDescName("更新时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("是否删除0.否1.是");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HGSB010() {
initMetaData();
}
/**
* get the id - ID.
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id - ID.
*
* @param id - ID
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the companyCode .
* @return the companyCode
*/
public String getCompanyCode() {
return this.companyCode;
}
/**
* set the companyCode .
*
* @param companyCode
*/
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
/**
* get the fileName - 文件名.
* @return the fileName
*/
public String getFileName() {
return this.fileName;
}
/**
* set the fileName - 文件名.
*
* @param fileName - 文件名
*/
public void setFileName(String fileName) {
this.fileName = fileName;
}
/**
* get the equipmentType - 设备状态.
* @return the equipmentType
*/
public String getEquipmentType() {
return this.equipmentType;
}
/**
* set the equipmentType - 设备状态.
*
* @param equipmentType - 设备状态
*/
public void setEquipmentType(String equipmentType) {
this.equipmentType = equipmentType;
}
/**
* get the equipmentCode - 设备编码.
* @return the equipmentCode
*/
public String getEquipmentCode() {
return this.equipmentCode;
}
/**
* set the equipmentCode - 设备编码.
*
* @param equipmentCode - 设备编码
*/
public void setEquipmentCode(String equipmentCode) {
this.equipmentCode = equipmentCode;
}
/**
* get the logInivalue - 初始类容.
* @return the logInivalue
*/
public String getLogInivalue() {
return this.logInivalue;
}
/**
* set the logInivalue - 初始类容.
*
* @param logInivalue - 初始类容
*/
public void setLogInivalue(String logInivalue) {
this.logInivalue = logInivalue;
}
/**
* get the logValue - 日志类容.
* @return the logValue
*/
public String getLogValue() {
return this.logValue;
}
/**
* set the logValue - 日志类容.
*
* @param logValue - 日志类容
*/
public void setLogValue(String logValue) {
this.logValue = logValue;
}
/**
* get the createdBy - 创建人.
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 创建人.
*
* @param createdBy - 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdName - 创建人名称.
* @return the createdName
*/
public String getCreatedName() {
return this.createdName;
}
/**
* set the createdName - 创建人名称.
*
* @param createdName - 创建人名称
*/
public void setCreatedName(String createdName) {
this.createdName = createdName;
}
/**
* get the createdTime - 创建时间.
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 创建时间.
*
* @param createdTime - 创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 更新人.
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 更新人.
*
* @param updatedBy - 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedName - 更新人名称.
* @return the updatedName
*/
public String getUpdatedName() {
return this.updatedName;
}
/**
* set the updatedName - 更新人名称.
*
* @param updatedName - 更新人名称
*/
public void setUpdatedName(String updatedName) {
this.updatedName = updatedName;
}
/**
* get the updatedTime - 更新时间.
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 更新时间.
*
* @param updatedTime - 更新时间
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the deleteFlag - 是否删除0.否1.是.
* @return the deleteFlag
*/
public Integer getDeleteFlag() {
return this.deleteFlag;
}
/**
* set the deleteFlag - 是否删除0.否1.是.
*
* @param deleteFlag - 是否删除0.否1.是
*/
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setFileName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FILE_NAME)), fileName));
setEquipmentType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_EQUIPMENT_TYPE)), equipmentType));
setEquipmentCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_EQUIPMENT_CODE)), equipmentCode));
setLogInivalue(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_LOG_INIVALUE)), logInivalue));
setLogValue(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_LOG_VALUE)), logValue));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID)));
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
map.put(FIELD_FILE_NAME, StringUtils.toString(fileName, eiMetadata.getMeta(FIELD_FILE_NAME)));
map.put(FIELD_EQUIPMENT_TYPE, StringUtils.toString(equipmentType, eiMetadata.getMeta(FIELD_EQUIPMENT_TYPE)));
map.put(FIELD_EQUIPMENT_CODE, StringUtils.toString(equipmentCode, eiMetadata.getMeta(FIELD_EQUIPMENT_CODE)));
map.put(FIELD_LOG_INIVALUE, StringUtils.toString(logInivalue, eiMetadata.getMeta(FIELD_LOG_INIVALUE)));
map.put(FIELD_LOG_VALUE, StringUtils.toString(logValue, eiMetadata.getMeta(FIELD_LOG_VALUE)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME)));
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
return map;
}
}
package com.baosight.hggp.hg.sb.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/10/21
* @description
*/
public class ServiceHGSB010 extends ServiceEPBase {
@OperationLogAnnotation(operModul = "设备监控",operType = "app查询",operDesc = "app查询设备状态")
public EiInfo queryAppBySbStatus(EiInfo inInfo) {
Map params = EiInfoUtils.getFirstRow(inInfo);
if (params.containsKey("date")){
params.put("date", DateUtils.formatShort(params.get("date")));
}
List<Map> result = DaoBase.getInstance().query("HGSB010.queryBySbStatus", params);
inInfo.set("result",result);
this.sbYes(inInfo, params);
this.sbNo(inInfo, params);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
return inInfo;
}
@OperationLogAnnotation(operModul = "设备监控",operType = "查询",operDesc = "查询设备状态")
public EiInfo queryBySbStatus(EiInfo inInfo) {
Map params = EiInfoUtils.getFirstRow(inInfo);
if (params.containsKey("date")){
params.put("date", DateUtils.formatShort(params.get("date")));
}
List<Map> result = DaoBase.getInstance().query("HGSB010.queryBySbStatus", params);
inInfo.set("result",result);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
return inInfo;
}
/**
* 近7日设备运行时长
* @param inInfo
* @return
*/
public EiInfo querySbYes(EiInfo inInfo){
Map params = EiInfoUtils.getFirstRow(inInfo);
if (params.containsKey("date")){
params.put("date", DateUtils.formatShort(params.get("date")));
}
params.put("logValues", Arrays.asList("1", "2", "4"));
List<Map> result = new ArrayList<>();
List<Map> listMap = DaoBase.getInstance().query("HGSB010.queryBySbYes", params, 0,100);
List listMap2 = listMap.stream().map(map -> map.get("date")).sorted().distinct().collect(Collectors.toList());
Map<Object, List<Map>> listMap1 = listMap.stream().collect(Collectors.groupingBy(m -> m.get("deviceCode")));
for (Object key: listMap1.keySet()) {
Map<Object, Object> map = new HashMap<>();
map.put("name", key);
map.put("type", "line");
map.put("stack", "Total");
List list1 = new ArrayList<>();
for (Map map1: listMap1.get(key)) {
list1.add(map1.get("num"));
}
map.put("data", list1);
result.add(map);
}
inInfo.set("date", listMap2);
inInfo.set("name", listMap1.keySet());
inInfo.set(EiConstant.resultBlock, result);
return inInfo;
}
/**
* 近7日设备运行时长
* @param inInfo
* @return
*/
public EiInfo querySbNo(EiInfo inInfo){
Map params = EiInfoUtils.getFirstRow(inInfo);
if (params.containsKey("date")){
params.put("date", DateUtils.formatShort(params.get("date")));
}
params.put("logValues", Arrays.asList("3", "5", "6"));
List<Map> result = new ArrayList<>();
List<Map> listMap = DaoBase.getInstance().query("HGSB010.queryBySbYes", params, 0,100);
List listMap2 = listMap.stream().map(map -> map.get("date")).sorted().distinct().collect(Collectors.toList());
Map<Object, List<Map>> listMap1 = listMap.stream().collect(Collectors.groupingBy(m -> m.get("deviceCode")));
for (Object key: listMap1.keySet()) {
Map<Object, Object> map = new HashMap<>();
map.put("name", key);
map.put("type", "line");
map.put("stack", "Total");
List list1 = new ArrayList<>();
for (Map map1: listMap1.get(key)) {
list1.add(map1.get("num"));
}
map.put("data", list1);
result.add(map);
}
inInfo.set("date", listMap2);
inInfo.set("name", listMap1.keySet());
inInfo.set(EiConstant.resultBlock, result);
return inInfo;
}
public void sbYes(EiInfo inInfo, Map params){
params.put("logValues", Arrays.asList("1", "2", "4"));
List<Map> result = (List<Map>) inInfo.get(EiConstant.resultBlock);
List<Map> list = new ArrayList<>();
List<Map> listMap = DaoBase.getInstance().query("HGSB010.queryBySbYes", params, 0,100);
List listMap2 = listMap.stream().map(map -> map.get("date")).sorted().distinct().collect(Collectors.toList());
Map<Object, List<Map>> listMap1 = listMap.stream().collect(Collectors.groupingBy(m -> m.get("deviceCode")));
for (Object key: listMap1.keySet()) {
Map<Object, Object> map = new HashMap<>();
map.put("name", key);
List list1 = new ArrayList<>();
for (Map map1: listMap1.get(key)) {
Map map2 = new HashMap();
map2.put(map1.get("date"), map1.get("num"));
list1.add(map2);
}
map.put("data", list1);
list.add(map);
}
for (Map map: result) {
Map resultMap = list.stream().filter(m -> m.get("name").equals(map.get("deviceCode"))).findAny().get();
map.put("runTime", resultMap.get("data"));
}
}
public void sbNo(EiInfo inInfo, Map params){
params.put("logValues", Arrays.asList("3", "5", "6"));
List<Map> result = (List<Map>) inInfo.get(EiConstant.resultBlock);
List<Map> list = new ArrayList<>();
List<Map> listMap = DaoBase.getInstance().query("HGSB010.queryBySbYes", params, 0,100);
List listMap2 = listMap.stream().map(map -> map.get("date")).sorted().distinct().collect(Collectors.toList());
Map<Object, List<Map>> listMap1 = listMap.stream().collect(Collectors.groupingBy(m -> m.get("deviceCode")));
for (Object key: listMap1.keySet()) {
Map<Object, Object> map = new HashMap<>();
map.put("name", key);
List list1 = new ArrayList<>();
for (Map map1: listMap1.get(key)) {
Map map2 = new HashMap();
map2.put(map1.get("date"), map1.get("num"));
list1.add(map2);
}
map.put("data", list1);
list.add(map);
}
for (Map map: result) {
Map resultMap = list.stream().filter(m -> m.get("name").equals(map.get("deviceCode"))).findAny().get();
map.put("errerTime", resultMap.get("data"));
}
//inInfo.set("errerDate", listMap2);
//inInfo.set("errerTime", result);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="HGSB010">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileName">
FILE_NAME = #fileName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="equipmentType">
EQUIPMENT_TYPE = #equipmentType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="equipmentCode">
EQUIPMENT_CODE LIKE CONCAT('%', #equipmentCode#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="logInivalue">
LOG_INIVALUE = #logInivalue#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="logValue">
LOG_VALUE = #logValue#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sb.domain.HGSB010">
SELECT
ID as "id", <!-- ID -->
ACCOUNT_CODE as "accountCode",
FILE_NAME as "fileName", <!-- 文件名 -->
EQUIPMENT_TYPE as "equipmentType", <!-- 设备状态 -->
EQUIPMENT_CODE as "equipmentCode", <!-- 设备编码 -->
LOG_INIVALUE as "logInivalue", <!-- 初始类容 -->
LOG_VALUE as "logValue", <!-- 日志类容 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag" <!-- 是否删除0.否1.是 -->
FROM ${hggpSchema}.HGSB010 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME DESC
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSB010 WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileName">
FILE_NAME = #fileName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="equipmentType">
EQUIPMENT_TYPE = #equipmentType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="equipmentCode">
EQUIPMENT_CODE = #equipmentCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="logInivalue">
LOG_INIVALUE = #logInivalue#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="logValue">
LOG_VALUE = #logValue#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSB010 (ID, <!-- ID -->
ACCOUNT_CODE,
FILE_NAME, <!-- 文件名 -->
EQUIPMENT_TYPE, <!-- 设备状态 -->
EQUIPMENT_CODE, <!-- 设备编码 -->
LOG_INIVALUE, <!-- 初始类容 -->
LOG_VALUE, <!-- 日志类容 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 -->
UPDATED_NAME, <!-- 更新人名称 -->
UPDATED_TIME, <!-- 更新时间 -->
DELETE_FLAG <!-- 是否删除0.否1.是 -->
)
VALUES (#id#, #accountCode#, #fileName#, #equipmentType#, #equipmentCode#, #logInivalue#, #logValue#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGSB010 WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGSB010
SET
ACCOUNT_CODE = #accountCode#,
FILE_NAME = #fileName#, <!-- 文件名 -->
EQUIPMENT_TYPE = #equipmentType#, <!-- 设备状态 -->
EQUIPMENT_CODE = #equipmentCode#, <!-- 设备编码 -->
LOG_INIVALUE = #logInivalue#, <!-- 初始类容 -->
LOG_VALUE = #logValue#, <!-- 日志类容 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除0.否1.是 -->
WHERE
ID = #id#
</update>
<delete id="deleteByCreatedTime">
DELETE FROM ${hggpSchema}.HGSB010 WHERE
SUBSTR(CREATED_TIME,1,8) &lt; DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 30 day),'%Y%m%d')
</delete>
<select id="queryBySbStatus" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
select
a.DEVICE_CODE as "deviceCode",
a.DEVICE_NAME as "deviceName",
a.DEVICE_MODEL as "deviceModel",
ifnull(c.LOG_VALUE, 0) as "status"
from ${hggpSchema}.HGSB001 a
left join (
select EQUIPMENT_CODE, LOG_VALUE
from ${hggpSchema}.HGSB010 where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="date">
CREATED_TIME =(
select MAX(CREATED_TIME)
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE' and left(CREATED_TIME,8) = #date#
)
</isNotEmpty>
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where a.DELETE_FLAG = 0 and a.DEVICE_STATUS = 1
<isNotEmpty prepend=" AND " property="accountCode">
a.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceCode">
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
order by a.DEVICE_CODE
</select>
<select id="queryBySbYes" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
select
a.DEVICE_CODE as "deviceCode",
a.DEVICE_MODEL as "deviceModel",
a.DATE as "date",
a.NUM as "num"
from (
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 6 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 6 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hggpSchema}.HGSB001 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty prepend=" AND " property="logValues">
LOG_VALUE IN <iterate close=")" open="(" conjunction="," property="logValues">#logValues[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="date">
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 6 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0 and DEVICE_STATUS = 1
<isNotEmpty prepend=" AND " property="companyCode">
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceCode">
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 5 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 5 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hggpSchema}.HGSB001 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty prepend=" AND " property="logValues">
LOG_VALUE IN <iterate close=")" open="(" conjunction="," property="logValues">#logValues[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="date">
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 5 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0
and DEVICE_STATUS = 1
<isNotEmpty prepend=" AND " property="companyCode">
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceCode">
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 4 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 4 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hggpSchema}.HGSB001 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty prepend=" AND " property="logValues">
LOG_VALUE IN <iterate close=")" open="(" conjunction="," property="logValues">#logValues[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="date">
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 4 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0 and DEVICE_STATUS = 1
<isNotEmpty prepend=" AND " property="companyCode">
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceCode">
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 3 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 3 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hggpSchema}.HGSB001 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty prepend=" AND " property="logValues">
LOG_VALUE IN <iterate close=")" open="(" conjunction="," property="logValues">#logValues[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="date">
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 3 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0 and DEVICE_STATUS = 1
<isNotEmpty prepend=" AND " property="companyCode">
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceCode">
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 2 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 2 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hggpSchema}.HGSB001 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty prepend=" AND " property="logValues">
LOG_VALUE IN <iterate close=")" open="(" conjunction="," property="logValues">#logValues[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="date">
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 2 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0
and DEVICE_STATUS = 1
<isNotEmpty prepend=" AND " property="companyCode">
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceCode">
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 1 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 1 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hggpSchema}.HGSB001 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty prepend=" AND " property="logValues">
LOG_VALUE IN <iterate close=")" open="(" conjunction="," property="logValues">#logValues[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="date">
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 1 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0 and DEVICE_STATUS = 1
<isNotEmpty prepend=" AND " property="companyCode">
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceCode">
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
right(replace(#date#, '-', ''), 4) as DATE,
ifnull(c.NUM, 0) NUM
from ${hggpSchema}.HGSB001 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty prepend=" AND " property="logValues">
LOG_VALUE IN <iterate close=")" open="(" conjunction="," property="logValues">#logValues[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="date">
left(CREATED_TIME,8) = replace(#date#, '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0 and DEVICE_STATUS = 1
<isNotEmpty prepend=" AND " property="companyCode">
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceCode">
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
) a
order by a.DEVICE_CODE
</select>
</sqlMap>
\ No newline at end of file
...@@ -174,8 +174,11 @@ ...@@ -174,8 +174,11 @@
<div class="device-title " style="padding-top: 0.2vh;margin-left: 2vw;display: flex"> <div class="device-title " style="padding-top: 0.2vh;margin-left: 2vw;display: flex">
<div class="device-span" style="width: 50%">{{ item.deviceName }}</div> <div class="device-span" style="width: 50%">{{ item.deviceName }}</div>
<div style="display: flex;width: 50%"> <div style="display: flex;width: 50%">
<div class="openOn-span" style="margin-left: 0.5vw;margin-right: 0.5vw">设备{{ item.status }}</div> <div class="openOn-span" style="margin-left: 0.5vw;margin-right: 0.5vw" v-if="item.status == '3' || item.status == '5' ||item.status == '6'">设备关机</div>
<img src="${ctx}/common/img/powerOn.png" style="width: 1.5vw;height: 3vh" v-if="item.status != '关机' " alt/> <div class="openOn-span" style="margin-left: 0.5vw;margin-right: 0.5vw" v-else-if="item.status == '1' || item.status == '2' ||item.status == '4' ">设备开机</div>
<div class="openOn-span" style="margin-left: 0.5vw;margin-right: 0.5vw" v-else="item.status == '0'">设备异常</div>
<img src="${ctx}/common/img/powerOn.png" style="width: 1.5vw;height: 3vh" v-if="item.status == '1' || item.status == '2' ||item.status == '4' " alt/>
<img src="${ctx}/common/img/powerDown.png" style="width: 1.5vw;height: 3vh" v-else alt/> <img src="${ctx}/common/img/powerDown.png" style="width: 1.5vw;height: 3vh" v-else alt/>
</div> </div>
</div> </div>
...@@ -191,25 +194,27 @@ ...@@ -191,25 +194,27 @@
</div> </div>
</div> </div>
<div class="left-device device" style="margin-left: 2vw;"> <div class="left-device device" style="margin-left: 2vw;">
<div class="device-echarts-background"> <div v-for="(item,index) in querySbYesList"
<manage-echarts :option="testOption1" :width="17" :height="24"></manage-echarts> :key="index" class="device-echarts-background">
<manage-echarts :option="item.option" :width="17" :height="23"></manage-echarts>
</div> </div>
<div class="device-echarts-background"> <div class="device-echarts-background">
<manage-echarts :option="testOption1" :width="17" :height="24"></manage-echarts> <manage-echarts :option="lineOption1" :width="17" :height="23"></manage-echarts>
</div> </div>
<div class="device-echarts-background"> <div class="device-echarts-background">
<manage-echarts :option="testOption1" :width="17" :height="24"></manage-echarts> <manage-echarts :option="lineOption1" :width="17" :height="23"></manage-echarts>
</div> </div>
</div> </div>
<div class="left-device device" style="margin-left: 2vw;"> <div class="left-device device" style="margin-left: 2vw;">
<div class="device-echarts-background"> <div v-for="(item,index) in querySbNoList"
<manage-echarts :option="testOption2" :width="17" :height="24"></manage-echarts> :key="index" class="device-echarts-background">
<manage-echarts :option="item.option" :width="17" :height="23"></manage-echarts>
</div> </div>
<div class="device-echarts-background"> <div class="device-echarts-background">
<manage-echarts :option="testOption2" :width="17" :height="24"></manage-echarts> <manage-echarts :option="lineOption2" :width="17" :height="23"></manage-echarts>
</div> </div>
<div class="device-echarts-background"> <div class="device-echarts-background">
<manage-echarts :option="testOption2" :width="17" :height="24"></manage-echarts> <manage-echarts :option="lineOption2" :width="17" :height="23"></manage-echarts>
</div> </div>
</div> </div>
</div> </div>
...@@ -230,23 +235,155 @@ ...@@ -230,23 +235,155 @@
data() { data() {
return { return {
date: new Date(), date: new Date(),
option1: {}, option1: {},
optionDate1: {}, optionDate1: {},
option2: {}, option2: {},
optionDate2: {}, optionDate2: {},
option3: {}, option3: {},
optionDate3: {}, optionDate3: {},
testOption1:{ testOption1:{},
testOption2:{},
factory:'',
factoryList:[],
dataPicker: '',
queryBySbStatusList:[],
querySbYesList:[],
querySbYesDate:[],
querySbNoList:[],
querySbNODate:[],
};
},
mounted() {
this.getYesterdayDateFormatted();
setInterval(() => {
this.date = new Date(); // 更新日期时间
}, 1000);
this.getRoleFactory();
this.queryBySbStatus();
this.querySbYes();
this.querySbNo();
this.setOption();
this.setOption2();
// var self = this;
// setTimeout(function() {
// self.init();
// }, 60000);
setTimeout(function() {
window.location.reload();
}, 60000);
},
methods: {
// init(){
// console.log(1)
// this.getYesterdayDateFormatted();
// this.getRoleFactory();
// this.queryBySbStatus();
// this.querySbYes();
// this.querySbNo();
// },
formatTime(currentTime) {
const formattedTime =
currentTime.getFullYear() +
"-" +
(currentTime.getMonth() + 1) +
"-" +
currentTime.getDate() +
" " +
currentTime.getHours() +
":" +
currentTime.getMinutes() +
":" +
currentTime.getSeconds();
return formattedTime;
},
getYesterdayDateFormatted() {
const today = new Date();
today.setDate(today.getDate() - 1);
const year = today.getFullYear();
const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以要加1
const day = String(today.getDate()).padStart(2, '0');
const formattedDate = year+month+day;
this.dataPicker = formattedDate;
},
getRoleFactory(){
let _this = this;
var inInfo = new EiInfo();
IPLAT.EiCommunicator.send('HGSC007', 'getByRoleFactory', inInfo, {
onSuccess: function (res) {
_this.factoryList = res.extAttr.result
_this.factory = res.extAttr.result[0].factoryCode
console.log('_this.factoryList',_this.factoryList)
console.log('factory',_this.factory)
},
onFail: function (err) {
console.error('request_tools----------------->错误信息', err);
}
},
{async: false}
);
},
handledataPicker(){
this.queryBySbStatus();
this.querySbYes();
this.querySbNo();
},
queryBySbStatus(){
let _this = this;
var inInfo = new EiInfo();
inInfo.set('inqu_status-0-factoryCode',this.factory)
inInfo.set('inqu_status-0-date',this.dataPicker)
IPLAT.EiCommunicator.send('HGSB010', 'queryBySbStatus', inInfo, {
onSuccess: function (res) {
console.log('queryBySbStatus',res)
if(undefined != res.extAttr.result){
_this.queryBySbStatusList = res.extAttr.result;
}
_this.queryBySbStatusList.push({
deviceName:'切割机',
status:'3',
deviceModel:'MZ-1250',
})
_this.queryBySbStatusList.push({
deviceName:'焊接机',
status:'3',
deviceModel:'H9830',
})
},
onFail: function (err) {
console.error('request_tools----------------->错误信息', err);
}
},
{async: false}
);
},
querySbYes(){
let _this = this;
var inInfo = new EiInfo();
inInfo.set('inqu_status-0-factoryCode',this.factory)
inInfo.set('inqu_status-0-date',this.dataPicker)
IPLAT.EiCommunicator.send('HGSB010', 'querySbYes', inInfo, {
onSuccess: function (res) {
console.log('querySbYes',res)
if(undefined != res.extAttr.result[0]){
const dataList = res.extAttr.result;
_this.querySbYesDate = res.extAttr.date;
_this.querySbYesList = dataList.map((item, index) => {
const getChartOptionByIndex = (index) => {
return {
title: { title: {
left: 'left', left: 'left',
text: '设备作业时长/小时', text: '设备作业时长/分钟',
textStyle: { textStyle: {
color: '#ffffff' // 设置标题字体颜色为白色 color: '#ffffff' // 设置标题字体颜色为白色
} }
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ['0', '0', '0', '0', '0', '0', '0'], data: _this.querySbYesDate,
axisLabel: { axisLabel: {
textStyle: { textStyle: {
color: '#ffffff' // 设置y轴标签字体颜色为白色 color: '#ffffff' // 设置y轴标签字体颜色为白色
...@@ -264,7 +401,7 @@ ...@@ -264,7 +401,7 @@
}, },
grid: { grid: {
top: '13%', // 图表距离容器顶部的距离 top: '17%', // 图表距离容器顶部的距离
bottom: '2%', // 图表距离容器底部的距离,为下方的文字留出空间 bottom: '2%', // 图表距离容器底部的距离,为下方的文字留出空间
left: '2%', left: '2%',
right: '2%', right: '2%',
...@@ -272,7 +409,7 @@ ...@@ -272,7 +409,7 @@
}, },
series: [ series: [
{ {
data: [0, 0, 0, 0, 0, 0, 0], data: dataList[index].data,
type: 'line', type: 'line',
smooth: true, smooth: true,
itemStyle: { itemStyle: {
...@@ -284,19 +421,53 @@ ...@@ -284,19 +421,53 @@
} }
] ]
};
};
// 返回包含正确 option 属性的对象
return {
...item,
option: getChartOptionByIndex(index) // 现在这里是一个对象,而不是字符串
};
});
}
else {
_this.querySbYesList = []
_this.querySbYesDate = []
}
console.log('querySbYesList',_this.querySbYesList)
},
onFail: function (err) {
console.error('request_tools----------------->错误信息', err);
}
}, },
testOption2:{ {async: false}
);
},
querySbNo(){
let _this = this;
var inInfo = new EiInfo();
inInfo.set('inqu_status-0-factoryCode',this.factory)
inInfo.set('inqu_status-0-date',this.dataPicker)
IPLAT.EiCommunicator.send('HGSB010', 'querySbNo', inInfo, {
onSuccess: function (res) {
console.log('querySbNo',res)
if(undefined != res.extAttr.result[0]){
const dataList = res.extAttr.result;
_this.querySbNODate = res.extAttr.date;
_this.querySbNoList = dataList.map((item, index) => {
const getChartOptionByIndex = (index) => {
return {
title: { title: {
left: 'left', left: 'left',
text: '设备故障次数/小时', text: '设备故障次数/分钟',
textStyle: { textStyle: {
color: '#ffffff' // 设置标题字体颜色为白色 color: '#ffffff' // 设置标题字体颜色为白色
} }
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ['0', '0', '0', '0', '0', '0', '0'], data: _this.querySbNODate,
axisLabel: { axisLabel: {
textStyle: { textStyle: {
color: '#ffffff' // 设置y轴标签字体颜色为白色 color: '#ffffff' // 设置y轴标签字体颜色为白色
...@@ -305,7 +476,7 @@ ...@@ -305,7 +476,7 @@
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
data: ['24', '24', '24', '24', '24', '24', '24'], data: ['0', '0', '0', '0', '0', '0', '0'],
axisLabel: { axisLabel: {
textStyle: { textStyle: {
color: '#ffffff' // 设置y轴标签字体颜色为白色 color: '#ffffff' // 设置y轴标签字体颜色为白色
...@@ -322,7 +493,7 @@ ...@@ -322,7 +493,7 @@
}, },
series: [ series: [
{ {
data: [24, 24, 24, 24, 24, 24, 24], data: dataList[index].data,
type: 'line', type: 'line',
smooth: true, smooth: true,
itemStyle: { itemStyle: {
...@@ -334,88 +505,141 @@ ...@@ -334,88 +505,141 @@
} }
] ]
};
};
// 返回包含正确 option 属性的对象
return {
...item,
option: getChartOptionByIndex(index) // 现在这里是一个对象,而不是字符串
};
});
}else{
_this.querySbNoList = []
_this.querySbNODate = []
}
}, },
factory:'', onFail: function (err) {
factoryList:[], console.error('request_tools----------------->错误信息', err);
dataPicker: '', }
queryBySbStatusList:[
{
deviceName:'切割机',
status:'关机',
deviceModel:'MZ-1250',
}, },
{ {async: false}
deviceName:'切割机', );
status:'关机',
deviceModel:'MZ-1250',
}, },
{
deviceName:'焊接机', setOption(){
status:'关机', this.testOption1 = {
deviceModel:'H9830', title: {
left: 'left',
text: '设备作业时长/分钟',
textStyle: {
color: '#ffffff' // 设置标题字体颜色为白色
} }
],
querySbYesList:[],
querySbYesDate:[],
querySbNoList:[],
querySbNODate:[],
};
}, },
mounted() { xAxis: {
this.getYesterdayDateFormatted(); type: 'category',
setInterval(() => { data: this.querySbYesDate,
this.date = new Date(); // 更新日期时间 axisLabel: {
}, 1000); textStyle: {
this.getRoleFactory(); color: '#ffffff' // 设置y轴标签字体颜色为白色
}
}
}, },
methods: { yAxis: {
formatTime(currentTime) { type: 'value',
const formattedTime = axisLabel: {
currentTime.getFullYear() + textStyle: {
"-" + color: '#ffffff' // 设置y轴标签字体颜色为白色
(currentTime.getMonth() + 1) + }
"-" + }
currentTime.getDate() +
" " +
currentTime.getHours() +
":" +
currentTime.getMinutes() +
":" +
currentTime.getSeconds();
return formattedTime;
}, },
getYesterdayDateFormatted() { grid: {
const today = new Date(); top: '17%', // 图表距离容器顶部的距离
today.setDate(today.getDate() - 1); bottom: '2%', // 图表距离容器底部的距离,为下方的文字留出空间
const year = today.getFullYear(); left: '2%',
const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以要加1 right: '2%',
const day = String(today.getDate()).padStart(2, '0'); containLabel: true // 确保标签(如坐标轴标签)在网格内
const formattedDate = year+month+day;
this.dataPicker = formattedDate;
}, },
getRoleFactory(){ series: [
let _this = this; {
var inInfo = new EiInfo(); data: [0, 0, 0, 0, 0, 0, 0],
IPLAT.EiCommunicator.send('HGSC007', 'getByRoleFactory', inInfo, { type: 'line',
onSuccess: function (res) { smooth: true,
_this.factoryList = res.extAttr.result itemStyle: {
_this.factory = res.extAttr.result[0].factoryCode color: '#01b9ff'
console.log('_this.factoryList',_this.factoryList)
console.log('factory',_this.factory)
}, },
onFail: function (err) { areaStyle: {
console.error('request_tools----------------->错误信息', err); color: '#245085'
},
}
]
} }
}, },
{async: false} setOption2(){
); this.testOption2 ={
title: {
left: 'left',
text: '设备故障次数/分钟',
textStyle: {
color: '#ffffff' // 设置标题字体颜色为白色
}
}, },
handledataPicker(){ xAxis: {
type: 'category',
data: this.querySbYesDate,
axisLabel: {
textStyle: {
color: '#ffffff' // 设置y轴标签字体颜色为白色
}
}
},
yAxis: {
type: 'value',
axisLabel: {
textStyle: {
color: '#ffffff' // 设置y轴标签字体颜色为白色
}
}
}, },
grid: {
top: '17%', // 图表距离容器顶部的距离
bottom: '2%', // 图表距离容器底部的距离,为下方的文字留出空间
left: '2%',
right: '2%',
containLabel: true // 确保标签(如坐标轴标签)在网格内
},
series: [
{
data: [24, 24, 24, 24, 24, 24, 24],
type: 'line',
smooth: true,
itemStyle: {
color: '#01b9ff'
},
areaStyle: {
color: '#245085'
},
}
]
}
},
}, },
computed:{ computed:{
lineOption1() {
// 这里我们不需要再次调用 setOption,因为 Vue 会自动处理绑定
return this.testOption1;
},
lineOption2() {
// 这里我们不需要再次调用 setOption,因为 Vue 会自动处理绑定
return this.testOption2;
},
currentTime() { currentTime() {
return this.formatTime(this.date); return this.formatTime(this.date);
}, },
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</div> </div>
<div style="width: 79%;margin-left: 3.2vw;height: 28vh;margin-top: 2vh"> <div style="width: 79%;margin-left: 3.2vw;height: 28vh;margin-top: 2vh">
<div class="content-device-img img"> <div class="content-device-img img">
<div class="title-content-device img">库库 1283</div> <div class="title-content-device img">品库</div>
</div> </div>
<img src="../../hggp/common/img/architectureDiagram.png" style="width: 100%;height: 100%" alt/> <img src="../../hggp/common/img/architectureDiagram.png" style="width: 100%;height: 100%" alt/>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment