暂降治理一期工作内容
This commit is contained in:
@@ -54,6 +54,24 @@ public enum AdvanceResponseEnum {
|
||||
SG_PRODUCT_LINE_ID_MISS("A0102","生产线id缺失"),
|
||||
|
||||
SG_MACHINE_ID_MISS("A0102","设备id缺失"),
|
||||
|
||||
IMPORT_EVENT_DATA_FAIL("A0102","请检查导入数据的准确性"),
|
||||
|
||||
PRODUCT_LINE_DATA_MISS("A0102","生产线数据缺失"),
|
||||
|
||||
MACHINE_DATA_MISS("A0102","设备数据缺失"),
|
||||
|
||||
INCOMING_LINE_DATA_MISS("A0102","进线数据缺失"),
|
||||
|
||||
EVENT_DATA_MISS("A0102","没有可供参考的暂降数据"),
|
||||
|
||||
USER_HAS_PRODUCT("A0102","当前用户存在生产线"),
|
||||
|
||||
PRODUCT_HAS_MACHINE("A0102","当前生产线存在设备"),
|
||||
|
||||
MACHINE_HAS_UNIT("A0102","当前设备存在元器件"),
|
||||
|
||||
EVENT_TIME_ERROR("A0102","暂降事件时间格式有误,请检查"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.njcn.advance.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年04月13日 10:50
|
||||
*/
|
||||
@Getter
|
||||
public enum GovernSchemeEnum {
|
||||
|
||||
|
||||
UPS(0, "UPS治理方案"),
|
||||
|
||||
AVC(1, "AVC治理方案"),
|
||||
|
||||
AVC_RTS(2, "AVC-RTS治理方案"),
|
||||
|
||||
QUICK(3, "快切开关治理方案"),
|
||||
|
||||
NO_SCHEME(4, "未采取任何治理措施"),
|
||||
;
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String message;
|
||||
|
||||
GovernSchemeEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取对应的枚举
|
||||
*/
|
||||
public static GovernSchemeEnum getSchemeByCode(int code) {
|
||||
for (GovernSchemeEnum governSchemeEnum : GovernSchemeEnum.values()) {
|
||||
if (governSchemeEnum.code == code) {
|
||||
return governSchemeEnum;
|
||||
}
|
||||
}
|
||||
return GovernSchemeEnum.NO_SCHEME;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.njcn.advance.pojo.dto.govern.voltage;
|
||||
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgMachine;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgMachineVO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用于计算生产线损失各项数据的实体类
|
||||
*/
|
||||
@Data
|
||||
public class ProductLineComputeData implements Serializable {
|
||||
|
||||
/**
|
||||
* 生产线id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 业务用户id
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 进线id
|
||||
*/
|
||||
private String incomingLineId;
|
||||
|
||||
/**
|
||||
* 生产线名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 计算模式 0-模式一(单次中断不计算设备、原料损失);1-模式二(计算)
|
||||
*/
|
||||
private Integer calcMode;
|
||||
|
||||
/**
|
||||
* 中断导致的产能损失(默认为0)
|
||||
*/
|
||||
private Double capacityLoss;
|
||||
|
||||
/**
|
||||
* 生产线下所有的设备集合
|
||||
* 默认为串联形式的
|
||||
*/
|
||||
private List<SgMachineVO> machineVOList;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.njcn.advance.pojo.dto.govern.voltage;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.handler.inter.IExcelModel;
|
||||
import com.njcn.device.pq.pojo.constant.DeviceValidMessage;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
public class SgEventExcel implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 暂降起始时间
|
||||
*/
|
||||
@Excel(name="暂降发生时间(yyyy-MM-dd HH:mm:ss)",format = "yyyy-MM-dd HH:mm:ss",width = 45)
|
||||
@NotBlank(message = "暂降时间不能为空")
|
||||
private String startTime;
|
||||
|
||||
/**
|
||||
* 暂降发生毫秒
|
||||
*/
|
||||
@Excel(name="暂降发生毫秒",width = 45)
|
||||
@NotBlank(message = "暂降发生毫秒不能为空")
|
||||
private String ms;
|
||||
|
||||
/**
|
||||
* 持续时间(单位:秒)
|
||||
*/
|
||||
@Excel(name="持续时间(ms)",width = 25)
|
||||
@NotNull(message = "持续时间不能为空")
|
||||
private Double duration;
|
||||
|
||||
/**
|
||||
* 特征幅值
|
||||
*/
|
||||
@Excel(name="暂降幅值(范围0p.u.~1p.u.)",width = 28)
|
||||
@NotNull(message = "暂降幅值不能为空")
|
||||
@Min(value = 0)
|
||||
@Max(value = 1)
|
||||
private Double featureAmplitude;
|
||||
|
||||
|
||||
/**
|
||||
* 事件描述
|
||||
*/
|
||||
@Excel(name="事件描述(非必填)",width = 30)
|
||||
private String eventDescribe;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class SgEventExcelMsg extends SgEventExcel implements Serializable, IExcelModel {
|
||||
@Excel(name = "错误信息描述")
|
||||
private String errorMsg;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.njcn.advance.pojo.param.govern.voltage;
|
||||
|
||||
|
||||
import com.njcn.web.constant.ValidMessage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 通用方案的参数,UPS/AVC
|
||||
*/
|
||||
@Data
|
||||
public class CommonSchemeParam implements Serializable {
|
||||
|
||||
/**
|
||||
* 采购单价
|
||||
*/
|
||||
@ApiModelProperty("采购单价")
|
||||
@NotNull(message = ValidMessage.MISS_PREFIX + "price")
|
||||
private Double price;
|
||||
|
||||
/**
|
||||
* 补偿能力
|
||||
*/
|
||||
@ApiModelProperty("补偿能力")
|
||||
@NotNull(message = ValidMessage.MISS_PREFIX + "compensation")
|
||||
private Double compensation;
|
||||
|
||||
/**
|
||||
* 维护费
|
||||
*/
|
||||
@ApiModelProperty("维护费")
|
||||
@NotNull(message = ValidMessage.MISS_PREFIX + "maintainFee")
|
||||
private Double maintainFee;
|
||||
|
||||
/**
|
||||
* 响应时间
|
||||
*/
|
||||
@ApiModelProperty("响应时间")
|
||||
@NotNull(message = ValidMessage.MISS_PREFIX + "responseTime")
|
||||
private Double responseTime;
|
||||
|
||||
/**
|
||||
* 后备时间
|
||||
*/
|
||||
@ApiModelProperty("后备时间")
|
||||
@NotNull(message = ValidMessage.MISS_PREFIX + "backupTime")
|
||||
private Double backupTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.njcn.advance.pojo.param.govern.voltage;
|
||||
|
||||
import com.njcn.web.constant.ValidMessage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 快切评估参数
|
||||
*/
|
||||
@Data
|
||||
public class QuickSchemeParam implements Serializable {
|
||||
|
||||
/**
|
||||
* 备用进线ID
|
||||
*/
|
||||
@ApiModelProperty("备用进线ID")
|
||||
@NotBlank(message = ValidMessage.MISS_PREFIX + "incomingLineId")
|
||||
private String incomingLineId;
|
||||
|
||||
/**
|
||||
* 治理容量
|
||||
*/
|
||||
@ApiModelProperty("治理容量")
|
||||
@NotNull(message = ValidMessage.MISS_PREFIX + "governMachinePower")
|
||||
private Double governMachinePower;
|
||||
|
||||
/**
|
||||
* 采购价格
|
||||
*/
|
||||
@ApiModelProperty("采购价格")
|
||||
@NotNull(message = ValidMessage.MISS_PREFIX + "price")
|
||||
private Double price;
|
||||
|
||||
/**
|
||||
* 建设费用
|
||||
*/
|
||||
@ApiModelProperty("建设费用")
|
||||
@NotNull(message = ValidMessage.MISS_PREFIX + "buildFee")
|
||||
private Double buildFee;
|
||||
|
||||
/**
|
||||
* 快切维护费用
|
||||
*/
|
||||
@ApiModelProperty("快切维护费用")
|
||||
@NotNull(message = ValidMessage.MISS_PREFIX + "quickMaintainFee")
|
||||
private Double quickMaintainFee;
|
||||
|
||||
/**
|
||||
* 动作时间
|
||||
*/
|
||||
@ApiModelProperty("动作时间")
|
||||
@NotNull(message = ValidMessage.MISS_PREFIX + "actionTime")
|
||||
private Double actionTime;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -88,6 +88,12 @@ public class SgEventParam {
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class SgEventParamQueryParam extends BaseParam {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@ApiModelProperty("用户id")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 生产线id
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.njcn.advance.pojo.param.govern.voltage;
|
||||
|
||||
import com.njcn.web.constant.ValidMessage;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @since 2024-03-27
|
||||
*/
|
||||
@Data
|
||||
public class SgGovernSchemeHistoryParam implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 生产线索引
|
||||
*/
|
||||
@ApiModelProperty("生产线索引")
|
||||
@NotBlank(message = ValidMessage.MISS_PREFIX + "productLineId")
|
||||
private String productLineId;
|
||||
|
||||
|
||||
/**
|
||||
* 参数数据的起始时间
|
||||
*/
|
||||
@ApiModelProperty("参数数据的起始时间")
|
||||
@NotBlank(message = ValidMessage.MISS_PREFIX + "startTime")
|
||||
private String startTime;
|
||||
|
||||
/**
|
||||
* 参考数据的截止时间
|
||||
*/
|
||||
@ApiModelProperty("参考数据的截止时间")
|
||||
@NotBlank(message = ValidMessage.MISS_PREFIX + "endTime")
|
||||
private String endTime;
|
||||
|
||||
|
||||
/**
|
||||
* 评估人期望的回收周期
|
||||
*/
|
||||
@ApiModelProperty("评估人期望的回收周期")
|
||||
@NotNull(message = ValidMessage.MISS_PREFIX + "payBackPeriod")
|
||||
private Integer payBackPeriod;
|
||||
|
||||
/**
|
||||
* UPS评估需要的参数
|
||||
*/
|
||||
@NotNull(message = "UPS评估参数缺失")
|
||||
private CommonSchemeParam ups;
|
||||
|
||||
/**
|
||||
* AVC评估需要的参数
|
||||
*/
|
||||
@NotNull(message = "AVC评估参数缺失")
|
||||
private CommonSchemeParam avc;
|
||||
|
||||
/**
|
||||
* 快切评估需要的参数
|
||||
*/
|
||||
@NotNull(message = "快切评估参数缺失")
|
||||
private QuickSchemeParam quick;
|
||||
|
||||
|
||||
/**
|
||||
* 评估批次
|
||||
*/
|
||||
private String evaluationBatch;
|
||||
|
||||
/**
|
||||
* 最佳方案id
|
||||
*/
|
||||
private String bestSchemeId;
|
||||
|
||||
|
||||
/**
|
||||
* 治理容量(kW)
|
||||
*/
|
||||
private Double governPower;
|
||||
|
||||
/**
|
||||
* 暂降次数
|
||||
*/
|
||||
private Integer eventCount;
|
||||
|
||||
/**
|
||||
* 中断次数
|
||||
*/
|
||||
private Integer breakCount;
|
||||
|
||||
/**
|
||||
* 不做治理,可能造成的经济损失
|
||||
*/
|
||||
private Double loss;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class SgSchemeHistoryQueryParam extends BaseParam {
|
||||
|
||||
/**
|
||||
* 生产线id
|
||||
*/
|
||||
@ApiModelProperty("用户id")
|
||||
private String userId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public class SgSensitiveUnitParam {
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class SgSensitiveUnitUpdateParam extends SgMachineParam {
|
||||
public static class SgSensitiveUnitUpdateParam extends SgSensitiveUnitParam {
|
||||
|
||||
/**
|
||||
* 表Id
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.njcn.advance.pojo.po.govern.harmonic;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-04-17
|
||||
*/
|
||||
@Data
|
||||
@TableName("sg_harmonic_file")
|
||||
public class SgHarmonicFile extends BaseEntity implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 谐波文件表id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 文件名
|
||||
*/
|
||||
private String dataName;
|
||||
|
||||
/**
|
||||
* 文件服务器的路径
|
||||
*/
|
||||
private String dataPath;
|
||||
|
||||
/**
|
||||
* 状态 0-删除;1-正常;默认正常
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -5,7 +5,10 @@ import com.njcn.db.bo.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
@@ -19,7 +22,9 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("sg_event")
|
||||
public class SgEvent {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SgEvent implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -28,6 +33,11 @@ public class SgEvent {
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 生产线id
|
||||
*/
|
||||
private String productLineId;
|
||||
|
||||
/**
|
||||
* 进线id
|
||||
*/
|
||||
@@ -78,5 +88,15 @@ public class SgEvent {
|
||||
*/
|
||||
private Integer dataSource;
|
||||
|
||||
private Integer state;
|
||||
|
||||
|
||||
public SgEvent(String incomingLineId, Double duration, Double featureAmplitude, String eventDescribe, Integer dataSource) {
|
||||
this.incomingLineId = incomingLineId;
|
||||
this.startTime = startTime;
|
||||
this.duration = duration;
|
||||
this.featureAmplitude = featureAmplitude;
|
||||
this.eventDescribe = eventDescribe;
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.njcn.advance.pojo.po.govern.voltage;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @since 2024-03-27
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("sg_govern_scheme_history")
|
||||
public class SgGovernSchemeHistory extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 治理评估历史数据表
|
||||
*/
|
||||
private String id;
|
||||
|
||||
|
||||
/**
|
||||
* 生产线ID
|
||||
*/
|
||||
private String productLineId;
|
||||
|
||||
/**
|
||||
* 评估批次
|
||||
*/
|
||||
private String evaluationBatch;
|
||||
|
||||
/**
|
||||
* 最佳方案id
|
||||
*/
|
||||
private String bestSchemeId;
|
||||
|
||||
/**
|
||||
* 期望回收周期
|
||||
*/
|
||||
private Integer payBackPeriod;
|
||||
|
||||
/**
|
||||
* 参考数据时间范围
|
||||
*/
|
||||
private String timeScope;
|
||||
|
||||
/**
|
||||
* 治理容量(kW)
|
||||
*/
|
||||
private Double governPower;
|
||||
|
||||
/**
|
||||
* 暂降次数
|
||||
*/
|
||||
private Integer eventCount;
|
||||
|
||||
/**
|
||||
* 中断次数
|
||||
*/
|
||||
private Integer breakCount;
|
||||
|
||||
/**
|
||||
* 不做治理,可能造成的经济损失
|
||||
*/
|
||||
private Double loss;
|
||||
|
||||
/**
|
||||
* 用户状态 0-删除;1-正常;默认正常
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.njcn.advance.pojo.po.govern.voltage;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-03-27
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("sg_govern_scheme_history_detail")
|
||||
public class SgGovernSchemeHistoryDetail extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 治理方案详细结果
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 评估批次
|
||||
*/
|
||||
private String evaluationBatch;
|
||||
|
||||
/**
|
||||
* 方案参数
|
||||
*/
|
||||
private String schemeParamId;
|
||||
|
||||
/**
|
||||
* 参数类型(0 ups;1 avc;2 avc-rts;3 快切)
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 暂降次数
|
||||
*/
|
||||
private Integer eventCount;
|
||||
|
||||
/**
|
||||
* 中断次数
|
||||
*/
|
||||
private Integer breakCount;
|
||||
|
||||
/**
|
||||
* 治理设备总价格(万元)
|
||||
*/
|
||||
private Double equipment;
|
||||
|
||||
/**
|
||||
* 年维护费(万元/年)
|
||||
*/
|
||||
private Double maintain;
|
||||
|
||||
/**
|
||||
* 治理后的经济损失
|
||||
*/
|
||||
private Double loss;
|
||||
|
||||
/**
|
||||
* 曲线图的X轴
|
||||
*/
|
||||
private String years;
|
||||
|
||||
/**
|
||||
* 用户每年的投资,由集合转为字符的
|
||||
*/
|
||||
private String investYear;
|
||||
|
||||
/**
|
||||
* 用户每年的收益,由集合转为字符的
|
||||
*/
|
||||
private String payBack;
|
||||
|
||||
|
||||
/**
|
||||
* 5年 10年 15年的成本
|
||||
*/
|
||||
private String cost;
|
||||
|
||||
/**
|
||||
* 5年 10年 15年的投资收益率
|
||||
*/
|
||||
private String investYield;
|
||||
|
||||
/**
|
||||
* 实际回报年份
|
||||
*/
|
||||
private int actualPayBack;
|
||||
|
||||
|
||||
/**
|
||||
* 尺寸(快切没有尺寸)
|
||||
*/
|
||||
private String size;
|
||||
|
||||
/**
|
||||
* 设备总数量
|
||||
*/
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* 设备总功率
|
||||
*/
|
||||
private Double power;
|
||||
|
||||
/**
|
||||
* 治理前风险等级
|
||||
*/
|
||||
private String riskLevelBefore;
|
||||
|
||||
/**
|
||||
* 治理后风险等级
|
||||
*/
|
||||
private String riskLevelAfter;
|
||||
|
||||
/**
|
||||
* 治理效果
|
||||
*/
|
||||
private Double radarResult;
|
||||
|
||||
/**
|
||||
* 去风险能力
|
||||
*/
|
||||
private Double radarRisk;
|
||||
|
||||
/**
|
||||
* 投资意愿
|
||||
*/
|
||||
private Double radarWish;
|
||||
|
||||
/**
|
||||
* 暂降免疫能力
|
||||
*/
|
||||
private Double sagImmunity;
|
||||
|
||||
/**
|
||||
* 投资综合评估
|
||||
*/
|
||||
private Double investmentResult;
|
||||
|
||||
/**
|
||||
* 状态 0-删除;1-正常;默认正常
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.njcn.advance.pojo.po.govern.voltage;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-03-27
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("sg_govern_scheme_param")
|
||||
public class SgGovernSchemeParam extends BaseEntity implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 方案初始参数
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 购置价格(万元/kVA)
|
||||
*/
|
||||
private Double price;
|
||||
|
||||
/**
|
||||
* 补偿能力(p.u.)
|
||||
*/
|
||||
private Double compensation;
|
||||
|
||||
/**
|
||||
* 年维护费(万元/kVA)
|
||||
*/
|
||||
private Double maintainFee;
|
||||
|
||||
/**
|
||||
* 响应时间(ms)
|
||||
*/
|
||||
private Integer responseTime;
|
||||
|
||||
/**
|
||||
* 后备时间(s)
|
||||
*/
|
||||
private Integer backupTime;
|
||||
|
||||
/**
|
||||
* 治理设备容量(kVA)
|
||||
*/
|
||||
private Double governMachinePower;
|
||||
|
||||
/**
|
||||
* 建设成本(万元)
|
||||
*/
|
||||
private Double buildFee;
|
||||
|
||||
/**
|
||||
* 快切的年维护费(万元)
|
||||
*/
|
||||
private Double quickMaintainFee;
|
||||
|
||||
/**
|
||||
* 动作时间(ms)
|
||||
*/
|
||||
private Double actionTime;
|
||||
|
||||
/**
|
||||
* 备用进线id
|
||||
*/
|
||||
private String incomingLineId;
|
||||
|
||||
/**
|
||||
* 用户状态 0-删除;1-正常;默认正常
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
|
||||
}
|
||||
@@ -51,10 +51,10 @@ public class SgProductLine extends BaseEntity {
|
||||
/**
|
||||
* 中断导致的产能损失(默认为0)
|
||||
*/
|
||||
private Float capacityLoss;
|
||||
private Double capacityLoss;
|
||||
|
||||
/**
|
||||
* 用户状态 0-删除;1-正常;默认正常
|
||||
* 数据状态 0-删除;1-正常;默认正常
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
package com.njcn.advance.pojo.vo.govern.voltage;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
public class SgEventVO {
|
||||
public class SgEventVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -27,15 +29,18 @@ public class SgEventVO {
|
||||
*/
|
||||
private String incomingLineId;
|
||||
|
||||
|
||||
/**
|
||||
* 进线名称
|
||||
*/
|
||||
private String lineName;
|
||||
@Excel(name="进线名称",width = 25)
|
||||
private String incomingLineName;
|
||||
|
||||
/**
|
||||
* 暂降起始时间
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
@Excel(name="暂降发生时间",width = 35)
|
||||
private String startTime;
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
@@ -45,21 +50,25 @@ public class SgEventVO {
|
||||
/**
|
||||
* 持续时间(单位:秒)
|
||||
*/
|
||||
@Excel(name="持续时间(单位:秒)",width = 25)
|
||||
private Double duration;
|
||||
|
||||
/**
|
||||
* 特征幅值
|
||||
*/
|
||||
@Excel(name="暂降幅值")
|
||||
private Double featureAmplitude;
|
||||
|
||||
/**
|
||||
* 预估损失(单位:万元)
|
||||
*/
|
||||
@Excel(name="预估损失(单位:万元)",width = 25)
|
||||
private Double estimatedLoss;
|
||||
|
||||
/**
|
||||
* 事件描述
|
||||
*/
|
||||
@Excel(name="事件描述",width = 25)
|
||||
private String eventDescribe;
|
||||
|
||||
/**
|
||||
@@ -67,15 +76,18 @@ public class SgEventVO {
|
||||
*/
|
||||
private Integer fileFlag;
|
||||
|
||||
/**
|
||||
* 数据来源(0-离线导入 1-监测点实际数据同步)
|
||||
*/
|
||||
@Excel(name="数据来源", replace = { "监测点实际同步_1", "离线导入_0" },width = 25)
|
||||
private Integer dataSource;
|
||||
|
||||
/**
|
||||
* 波形路径
|
||||
*/
|
||||
private String wavePath;
|
||||
|
||||
/**
|
||||
* 数据来源(0-离线导入 1-监测点实际数据同步)
|
||||
*/
|
||||
private Integer dataSource;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.advance.pojo.vo.govern.voltage;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SgGovernSchemeHistoryAllVO extends SgGovernSchemeHistoryVO {
|
||||
|
||||
|
||||
/**
|
||||
* UPS的三条曲线数据
|
||||
*/
|
||||
private SgGovernSchemeHistoryDetailVO upsData;
|
||||
|
||||
|
||||
/**
|
||||
* AVC的三条曲线数据
|
||||
*/
|
||||
private SgGovernSchemeHistoryDetailVO avcData;
|
||||
|
||||
|
||||
/**
|
||||
* AVC+UPS的三条曲线数据
|
||||
*/
|
||||
private SgGovernSchemeHistoryDetailVO upsRtsData;
|
||||
|
||||
|
||||
/**
|
||||
* 快切的三条曲线数据
|
||||
*/
|
||||
private SgGovernSchemeHistoryDetailVO quickData;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.njcn.advance.pojo.vo.govern.voltage;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-03-27
|
||||
*/
|
||||
@Data
|
||||
public class SgGovernSchemeHistoryDetailVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 治理方案详细结果
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 评估批次
|
||||
*/
|
||||
private String evaluationBatch;
|
||||
|
||||
/**
|
||||
* 方案参数
|
||||
*/
|
||||
private String schemeParamId;
|
||||
|
||||
/**
|
||||
* 参数类型(0 ups;1 avc;2 avc-rts;3 快切)
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 暂降次数
|
||||
*/
|
||||
private Integer eventCount;
|
||||
|
||||
/**
|
||||
* 中断次数
|
||||
*/
|
||||
private Integer breakCount;
|
||||
|
||||
/**
|
||||
* 治理后的经济损失
|
||||
*/
|
||||
private Double loss;
|
||||
|
||||
/**
|
||||
* 治理可能的经济损失(万元/年)
|
||||
*/
|
||||
private Double yearLoss;
|
||||
|
||||
/**
|
||||
* 尺寸(快切没有尺寸)
|
||||
*/
|
||||
private String size;
|
||||
|
||||
/**
|
||||
* 设备总数量
|
||||
*/
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* 设备总功率
|
||||
*/
|
||||
private Double power;
|
||||
|
||||
|
||||
/**
|
||||
* 治理设备总价格(万元)
|
||||
*/
|
||||
private Double equipment;
|
||||
|
||||
/**
|
||||
* 年维护费(万元/年)
|
||||
*/
|
||||
private Double maintain;
|
||||
|
||||
|
||||
/**
|
||||
* 曲线图的X轴
|
||||
*/
|
||||
private List<String> yearsArray;
|
||||
|
||||
/**
|
||||
* 用户每年的投资,由集合转为字符的
|
||||
*/
|
||||
private List<Double> investYearArray;
|
||||
|
||||
/**
|
||||
* 治理效果每年
|
||||
*/
|
||||
private List<Double> governEffectArray;
|
||||
|
||||
/**
|
||||
* 用户每年的收益,由集合转为字符的
|
||||
*/
|
||||
private List<Double> payBackArray;
|
||||
|
||||
/**
|
||||
* 5年 10年 15年的成本
|
||||
*/
|
||||
private List<Double> costArray;
|
||||
|
||||
/**
|
||||
* 5年 10年 15年的投资收益率
|
||||
*/
|
||||
private List<Double> investYieldArray;
|
||||
|
||||
/**
|
||||
* 实际回报年份
|
||||
*/
|
||||
private int actualPayBack;
|
||||
|
||||
|
||||
/**
|
||||
* 治理前风险等级
|
||||
*/
|
||||
private String riskLevelBefore;
|
||||
|
||||
/**
|
||||
* 治理后风险等级
|
||||
*/
|
||||
private String riskLevelAfter;
|
||||
|
||||
/**
|
||||
* 治理效果
|
||||
*/
|
||||
private Double radarResult;
|
||||
|
||||
/**
|
||||
* 去风险能力
|
||||
*/
|
||||
private Double radarRisk;
|
||||
|
||||
/**
|
||||
* 投资意愿
|
||||
*/
|
||||
private Double radarWish;
|
||||
|
||||
/**
|
||||
* 暂降免疫能力
|
||||
*/
|
||||
private Double sagImmunity;
|
||||
|
||||
/**
|
||||
* 投资综合评估
|
||||
*/
|
||||
private Double investmentResult;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.njcn.advance.pojo.vo.govern.voltage;
|
||||
|
||||
import com.njcn.advance.pojo.param.govern.voltage.CommonSchemeParam;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.QuickSchemeParam;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 页面表格治理结果展示
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-03-27
|
||||
*/
|
||||
@Data
|
||||
public class SgGovernSchemeHistoryVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 治理评估历史数据表
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 生产线ID
|
||||
*/
|
||||
private String productLineId;
|
||||
|
||||
/**
|
||||
* 生产线名称
|
||||
*/
|
||||
private String productLineName;
|
||||
|
||||
/**
|
||||
* 进线名称
|
||||
*/
|
||||
private String inComingLineName;
|
||||
|
||||
/**
|
||||
* 评估批次
|
||||
*/
|
||||
private String evaluationBatch;
|
||||
|
||||
/**
|
||||
* 最佳方案id
|
||||
*/
|
||||
private String bestSchemeId;
|
||||
|
||||
/**
|
||||
* 期望回收周期
|
||||
*/
|
||||
private Integer payBackPeriod;
|
||||
|
||||
/**
|
||||
* 参考数据时间范围
|
||||
*/
|
||||
private String timeScope;
|
||||
|
||||
/**
|
||||
* 治理容量(kW)
|
||||
*/
|
||||
private Double governPower;
|
||||
|
||||
/**
|
||||
* 暂降次数
|
||||
*/
|
||||
private Integer eventCount;
|
||||
|
||||
/**
|
||||
* 中断次数
|
||||
*/
|
||||
private Integer breakCount;
|
||||
|
||||
/**
|
||||
* 不做治理,可能造成的经济损失
|
||||
*/
|
||||
private Double loss;
|
||||
|
||||
/**
|
||||
* 做治理,可能造成的经济损失
|
||||
*/
|
||||
private Double governLoss;
|
||||
|
||||
/**
|
||||
* 治理效果,未治理-治理的
|
||||
*/
|
||||
private Double governEffect;
|
||||
|
||||
/**
|
||||
* 不做治理,可能造成的经济损失
|
||||
*/
|
||||
private Double yearLoss;
|
||||
|
||||
/**
|
||||
* 初期投资(万元)=设备费用+年维护费
|
||||
*/
|
||||
private Double initialInvest;
|
||||
|
||||
/**
|
||||
* 设备费用(万元)
|
||||
*/
|
||||
private Double schemeEquipment;
|
||||
|
||||
/**
|
||||
* 年维护费(万元)
|
||||
*/
|
||||
private Double schemeMaintain;
|
||||
|
||||
/**
|
||||
* 投资回收期
|
||||
*/
|
||||
private Integer payBackYear;
|
||||
|
||||
/***
|
||||
* 治理效果每年
|
||||
*/
|
||||
private Double governEffectMoney;
|
||||
|
||||
/**
|
||||
* 最佳治理方案
|
||||
*/
|
||||
private Integer schemeType;
|
||||
|
||||
/**
|
||||
* UPS评估需要的参数
|
||||
*/
|
||||
private CommonSchemeParam ups;
|
||||
|
||||
/**
|
||||
* AVC评估需要的参数
|
||||
*/
|
||||
private CommonSchemeParam avc;
|
||||
|
||||
/**
|
||||
* 快切评估需要的参数
|
||||
*/
|
||||
private QuickSchemeParam quick;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.njcn.advance.pojo.vo.govern.voltage;
|
||||
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgSensitiveUnit;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SgMachineVO implements Serializable {
|
||||
@@ -46,4 +48,9 @@ public class SgMachineVO implements Serializable {
|
||||
* 功率(默认为0)
|
||||
*/
|
||||
private Double machinePower;
|
||||
|
||||
/**
|
||||
* 敏感元器件列表
|
||||
*/
|
||||
private List<SgSensitiveUnitVO> sgSensitiveUnitList;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.njcn.advance.pojo.vo.govern.voltage;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class SgOption implements Serializable {
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.njcn.advance.pojo.vo.govern.voltage;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表格分页数据对象
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class TableDataInfo implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 总记录数 */
|
||||
@ApiModelProperty("总记录数")
|
||||
private long total;
|
||||
|
||||
/** 数据列表 */
|
||||
@ApiModelProperty("数据列表")
|
||||
private List<?> rows;
|
||||
|
||||
/** 消息状态码 */
|
||||
@ApiModelProperty("消息状态码")
|
||||
private int code;
|
||||
|
||||
/** 消息内容 */
|
||||
@ApiModelProperty("消息内容")
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 表格数据对象
|
||||
*/
|
||||
public TableDataInfo()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param list 列表数据
|
||||
* @param total 总记录数
|
||||
*/
|
||||
public TableDataInfo(List<?> list, int total)
|
||||
{
|
||||
this.rows = list;
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public long getTotal()
|
||||
{
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(long total)
|
||||
{
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public List<?> getRows()
|
||||
{
|
||||
return rows;
|
||||
}
|
||||
|
||||
public void setRows(List<?> rows)
|
||||
{
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
public int getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg()
|
||||
{
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg)
|
||||
{
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.njcn.advance.pojo.vo.govern.voltage;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
public class TransientEventCount {
|
||||
|
||||
@ApiModelProperty("暂降幅值")
|
||||
private String amplitude;
|
||||
|
||||
@ApiModelProperty("持续时间(0.01-0.02)")
|
||||
private String D001_002s;
|
||||
|
||||
@ApiModelProperty("持续时间(0.02-0.05)")
|
||||
private String D002_005s;
|
||||
|
||||
@ApiModelProperty("持续时间(0.05-0.07)")
|
||||
private String D005_007s;
|
||||
|
||||
@ApiModelProperty("持续时间(0.07-0.10)")
|
||||
private String D007_010s;
|
||||
|
||||
@ApiModelProperty("持续时间(0.10-1.00)")
|
||||
private String D010_100s;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.njcn.advance.pojo.vo.govern.voltage;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TransientEventCountVO {
|
||||
|
||||
private String[][] values;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
package com.njcn.advance.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import static java.math.BigDecimal.ROUND_HALF_UP;
|
||||
|
||||
public class NumberUtil {
|
||||
private static final int DEFAULT_SCALE = 10;
|
||||
private static final RoundingMode DEFAULT_ROUNDINGMODE = RoundingMode.HALF_UP;
|
||||
|
||||
private static Random rand = new Random();
|
||||
|
||||
public static boolean isNumber(String str) {
|
||||
return isDouble(str);
|
||||
}
|
||||
|
||||
public static boolean isInt(String str) {
|
||||
if (StrUtil.isEmpty(str))
|
||||
return false;
|
||||
try
|
||||
{
|
||||
Integer.parseInt(str);
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isInteger(String str) {
|
||||
return isInt(str);
|
||||
}
|
||||
|
||||
public static boolean isLong(String str) {
|
||||
if (StrUtil.isEmpty(str))
|
||||
return false;
|
||||
try
|
||||
{
|
||||
Long.parseLong(str);
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isFloat(String str) {
|
||||
if (StrUtil.isEmpty(str))
|
||||
return false;
|
||||
try
|
||||
{
|
||||
Float.parseFloat(str);
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isDouble(String str) {
|
||||
if (StrUtil.isEmpty(str))
|
||||
return false;
|
||||
try
|
||||
{
|
||||
Double.parseDouble(str);
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static double round(double v, int scale) {
|
||||
BigDecimal b = new BigDecimal(Double.toString(v));
|
||||
return b.setScale(scale, ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
|
||||
public static int getRandomInt(int max) {
|
||||
return rand.nextInt(max);
|
||||
}
|
||||
|
||||
public static int toInt(byte[] bs) {
|
||||
return toInt(bs, 0);
|
||||
}
|
||||
|
||||
public static int toInt(byte[] bs, int start) {
|
||||
int i = 0;
|
||||
i += ((bs[start] & 0xFF) << 24);
|
||||
i += ((bs[(start + 1)] & 0xFF) << 16);
|
||||
i += ((bs[(start + 2)] & 0xFF) << 8);
|
||||
i += (bs[(start + 3)] & 0xFF);
|
||||
return i;
|
||||
}
|
||||
|
||||
public static byte[] toBytes(int i) {
|
||||
byte[] bs = new byte[4];
|
||||
bs[0] = ((byte)(i >> 24));
|
||||
bs[1] = ((byte)(i >> 16));
|
||||
bs[2] = ((byte)(i >> 8));
|
||||
bs[3] = ((byte)(i & 0xFF));
|
||||
return bs;
|
||||
}
|
||||
|
||||
public static void toBytes(int i, byte[] bs, int start) {
|
||||
bs[start] = ((byte)(i >> 24));
|
||||
bs[(start + 1)] = ((byte)(i >> 16));
|
||||
bs[(start + 2)] = ((byte)(i >> 8));
|
||||
bs[(start + 3)] = ((byte)(i & 0xFF));
|
||||
}
|
||||
|
||||
public static short toShort(byte[] bs) {
|
||||
return toShort(bs, 0);
|
||||
}
|
||||
|
||||
public static short toShort(byte[] bs, int start) {
|
||||
short i = 0;
|
||||
i = (short)(i + ((bs[(start + 0)] & 0xFF) << 8));
|
||||
i = (short)(i + (bs[(start + 1)] & 0xFF));
|
||||
return i;
|
||||
}
|
||||
|
||||
public static byte[] toBytes(short i) {
|
||||
byte[] bs = new byte[2];
|
||||
bs[0] = ((byte)(i >> 8));
|
||||
bs[1] = ((byte)(i & 0xFF));
|
||||
return bs;
|
||||
}
|
||||
|
||||
public static void toBytes(short i, byte[] bs, int start) {
|
||||
bs[(start + 0)] = ((byte)(i >> 8));
|
||||
bs[(start + 1)] = ((byte)(i & 0xFF));
|
||||
}
|
||||
|
||||
public static byte[] toBytes(long i) {
|
||||
byte[] bs = new byte[8];
|
||||
bs[0] = ((byte)(int)(i >> 56));
|
||||
bs[1] = ((byte)(int)(i >> 48));
|
||||
bs[2] = ((byte)(int)(i >> 40));
|
||||
bs[3] = ((byte)(int)(i >> 32));
|
||||
bs[4] = ((byte)(int)(i >> 24));
|
||||
bs[5] = ((byte)(int)(i >> 16));
|
||||
bs[6] = ((byte)(int)(i >> 8));
|
||||
bs[7] = ((byte)(int)(i & 0xFF));
|
||||
return bs;
|
||||
}
|
||||
|
||||
public static void toBytes(long l, byte[] bs, int start) {
|
||||
byte[] arr = toBytes(l);
|
||||
for (int i = 0; i < 8; i++)
|
||||
bs[(start + i)] = arr[i];
|
||||
}
|
||||
|
||||
public static long toLong(byte[] bs) {
|
||||
return toLong(bs, 0);
|
||||
}
|
||||
|
||||
public static long toLong(byte[] bs, int index) {
|
||||
return (bs[index] & 0xFF) << 56 | (bs[(index + 1)] & 0xFF) << 48 | (bs[(index + 2)] & 0xFF) << 40 |
|
||||
(bs[(index + 3)] & 0xFF) << 32 | (bs[(index + 4)] & 0xFF) << 24 | (bs[(index + 5)] & 0xFF) << 16 |
|
||||
(bs[(index + 6)] & 0xFF) << 8 | (bs[(index + 7)] & 0xFF) << 0;
|
||||
}
|
||||
|
||||
public static String format(Number n, String format) {
|
||||
DecimalFormat df = new DecimalFormat(format);
|
||||
return df.format(n);
|
||||
}
|
||||
public static Double formatNumber(Number n, String format) {
|
||||
return Double.valueOf(format(n,format));
|
||||
}
|
||||
public static Double formatNumber(Number n) {
|
||||
String format = "0.00";
|
||||
return Double.valueOf(format(n,format));
|
||||
}
|
||||
|
||||
public static ArrayList<Integer> getBinaryList(int num) {
|
||||
ArrayList<Integer> list = new ArrayList<Integer>();
|
||||
String binStr = Integer.toBinaryString(num);
|
||||
for (int i = 0; i < binStr.length(); i++) {
|
||||
if (binStr.charAt(i) == '1') {
|
||||
int intpow = (int)Math.pow(2.0D, binStr.length() - i - 1);
|
||||
list.add(Integer.valueOf(intpow));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public static BigDecimal getBigDecimal(Object number) {
|
||||
if (number == null) {
|
||||
return null;
|
||||
}
|
||||
if ((number instanceof BigDecimal))
|
||||
return (BigDecimal)number;
|
||||
if (((number instanceof Double)) || ((number instanceof Float)))
|
||||
return new BigDecimal(number.toString());
|
||||
if ((number instanceof Integer))
|
||||
return new BigDecimal(((Integer)number).intValue());
|
||||
if ((number instanceof Long)) {
|
||||
return new BigDecimal(((Long)number).longValue());
|
||||
}
|
||||
return new BigDecimal(number.toString());
|
||||
}
|
||||
|
||||
public static Number div(Number a, Number b) {
|
||||
return getBigDecimal(a).divide(getBigDecimal(b), DEFAULT_SCALE, DEFAULT_ROUNDINGMODE);
|
||||
}
|
||||
|
||||
public static Number div(Number a, Number b, int scale) {
|
||||
return getBigDecimal(a).divide(getBigDecimal(b), scale, DEFAULT_ROUNDINGMODE);
|
||||
}
|
||||
|
||||
public static Number sum(Number a, Number b) {
|
||||
return getBigDecimal(a).add(getBigDecimal(b));
|
||||
}
|
||||
|
||||
public static Number sub(Number a, Number b) {
|
||||
return getBigDecimal(a).subtract(getBigDecimal(b));
|
||||
}
|
||||
|
||||
public static Number mul(Number a, Number b) {
|
||||
return getBigDecimal(a).multiply(getBigDecimal(b));
|
||||
}
|
||||
|
||||
public static boolean equal(Number a, Number b) {
|
||||
if (((a instanceof Float)) || ((b instanceof Float)) || ((a instanceof Double)) || ((b instanceof Double))) {
|
||||
return Math.abs(a.floatValue() - b.floatValue()) < 1.0E-006D;
|
||||
}
|
||||
return a.equals(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断key在数组arr中是否存在
|
||||
* @param arr 数组
|
||||
* @param key 待查找值
|
||||
* @return key在数组arr中是否存在,true:存在,false:不存在
|
||||
*/
|
||||
public static boolean exist(Long[] arr, long key) {
|
||||
for(int i=0; i<arr.length; i++) {
|
||||
if(equal(arr[i], key)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user