diff --git a/business-service-api/src/main/java/com/ho/business/entity/Device.java b/business-service-api/src/main/java/com/ho/business/entity/Device.java index d20f024..f36010a 100644 --- a/business-service-api/src/main/java/com/ho/business/entity/Device.java +++ b/business-service-api/src/main/java/com/ho/business/entity/Device.java @@ -55,6 +55,12 @@ public class Device implements Serializable { @ApiModelProperty(value = "设备名字") private String deviceName; + /** + * 设备名字-英文 + */ + @ApiModelProperty(value = "设备名字-英文") + private String deviceNameEn; + @ApiModelProperty(value = "设备类型") private String deviceType; diff --git a/business-service-api/src/main/java/com/ho/business/entity/DeviceCall.java b/business-service-api/src/main/java/com/ho/business/entity/DeviceCall.java index 90102b3..dd32468 100644 --- a/business-service-api/src/main/java/com/ho/business/entity/DeviceCall.java +++ b/business-service-api/src/main/java/com/ho/business/entity/DeviceCall.java @@ -55,6 +55,12 @@ public class DeviceCall implements Serializable { @ApiModelProperty(value = "设备名字") private String deviceName; + /** + * 设备名字-英文 + */ + @ApiModelProperty(value = "设备名字-英文") + private String deviceNameEn; + @ApiModelProperty(value = "设备类型") private String deviceType; diff --git a/business-service-api/src/main/java/com/ho/business/entity/HisCurveRelate.java b/business-service-api/src/main/java/com/ho/business/entity/HisCurveRelate.java index 68e1c87..3c43b80 100644 --- a/business-service-api/src/main/java/com/ho/business/entity/HisCurveRelate.java +++ b/business-service-api/src/main/java/com/ho/business/entity/HisCurveRelate.java @@ -42,6 +42,13 @@ public class HisCurveRelate implements Serializable { private String modelName; + /** + * 模板名称-英文 + */ + + private String modelNameEn; + + /** * srcId */ @@ -59,6 +66,11 @@ public class HisCurveRelate implements Serializable { */ private String colName; + /** + * 字段英文名称 + */ + private String colNameEn; + /** * 设备类型 */ @@ -67,4 +79,7 @@ public class HisCurveRelate implements Serializable { List list; + @ApiModelProperty(value = "中英切换-查询字段") + private String lang; + } \ No newline at end of file diff --git a/business-service-api/src/main/java/com/ho/business/entity/PlanCurveOperationRecordReq.java b/business-service-api/src/main/java/com/ho/business/entity/PlanCurveOperationRecordReq.java index 056c179..13653ab 100644 --- a/business-service-api/src/main/java/com/ho/business/entity/PlanCurveOperationRecordReq.java +++ b/business-service-api/src/main/java/com/ho/business/entity/PlanCurveOperationRecordReq.java @@ -21,9 +21,15 @@ public class PlanCurveOperationRecordReq { @ApiModelProperty(value = "操作内容") String operateContent; + @ApiModelProperty(value = "操作内容-英文") + String operateContentEn; + @ApiModelProperty(value = "操作结果") String operateResult; + @ApiModelProperty(value = "操作结果-英文") + String operateResultEn; + @ApiModelProperty(value = "生效时间") String effectiveTime; diff --git a/business-service-api/src/main/java/com/ho/business/entity/PlanningCurveTemplate.java b/business-service-api/src/main/java/com/ho/business/entity/PlanningCurveTemplate.java index 83542bd..bdaecca 100644 --- a/business-service-api/src/main/java/com/ho/business/entity/PlanningCurveTemplate.java +++ b/business-service-api/src/main/java/com/ho/business/entity/PlanningCurveTemplate.java @@ -26,6 +26,9 @@ public class PlanningCurveTemplate { /* 模板名称 */ private String templateName; + /* 模板名称-英文 */ + private String templateNameEn; + /* 电价模板id */ //private Integer elecTemplateId; @@ -69,4 +72,7 @@ public class PlanningCurveTemplate { /* 计划曲线列表数据 */ private List planningCurves; + + @ApiModelProperty(value = "中英切换-查询字段") + private String lang; } diff --git a/business-service-api/src/main/java/com/ho/business/entity/PlanningIssueDevice.java b/business-service-api/src/main/java/com/ho/business/entity/PlanningIssueDevice.java index 2c7a4ca..03d9b02 100644 --- a/business-service-api/src/main/java/com/ho/business/entity/PlanningIssueDevice.java +++ b/business-service-api/src/main/java/com/ho/business/entity/PlanningIssueDevice.java @@ -1,6 +1,7 @@ package com.ho.business.entity; import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; @@ -22,4 +23,6 @@ public class PlanningIssueDevice { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private Date operationDate; + @ApiModelProperty(value = "中英切换-查询字段") + private String lang; } diff --git a/business-service-api/src/main/java/com/ho/business/entity/PointConfig.java b/business-service-api/src/main/java/com/ho/business/entity/PointConfig.java index a596623..132f181 100644 --- a/business-service-api/src/main/java/com/ho/business/entity/PointConfig.java +++ b/business-service-api/src/main/java/com/ho/business/entity/PointConfig.java @@ -25,6 +25,9 @@ public class PointConfig implements Serializable { @ApiModelProperty(value = "默认值") private String defaultValue; + @ApiModelProperty(value = "默认值-英文") + private String defaultValueEn; + @ApiModelProperty(value = "配置点类型") private Integer pointType; diff --git a/business-service-api/src/main/java/com/ho/business/entity/TranslateNation.java b/business-service-api/src/main/java/com/ho/business/entity/TranslateName.java similarity index 80% rename from business-service-api/src/main/java/com/ho/business/entity/TranslateNation.java rename to business-service-api/src/main/java/com/ho/business/entity/TranslateName.java index 2628b5a..faaa502 100644 --- a/business-service-api/src/main/java/com/ho/business/entity/TranslateNation.java +++ b/business-service-api/src/main/java/com/ho/business/entity/TranslateName.java @@ -5,11 +5,12 @@ import lombok.Data; import java.io.Serializable; + /** - * @TableName translate_nation + * @author kerwin */ @Data -public class TranslateNation implements Serializable { +public class TranslateName implements Serializable { @ApiModelProperty(value = "id") private Integer id; diff --git a/business-service-api/src/main/java/com/ho/business/entity/VirtualDeviceCol.java b/business-service-api/src/main/java/com/ho/business/entity/VirtualDeviceCol.java index f71f355..e181f7e 100644 --- a/business-service-api/src/main/java/com/ho/business/entity/VirtualDeviceCol.java +++ b/business-service-api/src/main/java/com/ho/business/entity/VirtualDeviceCol.java @@ -41,5 +41,8 @@ public class VirtualDeviceCol implements Serializable { private String name; //查询条件,非数据库中列 - List typeList;; + List typeList; + + @ApiModelProperty(value = "中英切换-查询字段") + private String lang; } \ No newline at end of file diff --git a/business-service-api/src/main/java/com/ho/business/vo/req/DeviceReqVO.java b/business-service-api/src/main/java/com/ho/business/vo/req/DeviceReqVO.java index 3290816..1c35056 100644 --- a/business-service-api/src/main/java/com/ho/business/vo/req/DeviceReqVO.java +++ b/business-service-api/src/main/java/com/ho/business/vo/req/DeviceReqVO.java @@ -77,4 +77,7 @@ public class DeviceReqVO { @ApiModelProperty(hidden = true,value = "获取设备类型不为空的第一个设备") private Integer needDeviceTypeNotNull; + + @ApiModelProperty(value = "中英切换-查询字段") + private String lang; } diff --git a/business-service-api/src/main/java/com/ho/business/vo/req/DeviceTypeColReqVO.java b/business-service-api/src/main/java/com/ho/business/vo/req/DeviceTypeColReqVO.java index 7f39d3e..06632c9 100644 --- a/business-service-api/src/main/java/com/ho/business/vo/req/DeviceTypeColReqVO.java +++ b/business-service-api/src/main/java/com/ho/business/vo/req/DeviceTypeColReqVO.java @@ -32,4 +32,7 @@ public class DeviceTypeColReqVO { * 遥信遥测 1遥信 2遥测 3遥控 默认送2 */ Integer sensType; + + @ApiModelProperty(value = "中英切换-查询字段") + private String lang; } diff --git a/business-service-api/src/main/java/com/ho/business/vo/req/StationReq.java b/business-service-api/src/main/java/com/ho/business/vo/req/StationReq.java index 6a98918..3897ae6 100644 --- a/business-service-api/src/main/java/com/ho/business/vo/req/StationReq.java +++ b/business-service-api/src/main/java/com/ho/business/vo/req/StationReq.java @@ -29,4 +29,8 @@ public class StationReq implements Serializable { @ApiModelProperty(value = "设备类型",hidden = true) String deviceType; + + @ApiModelProperty(value = "中英切换-查询字段") + String lang; + } diff --git a/business-service-api/src/main/java/com/ho/business/vo/req/carbin/EarningsCalculateReq.java b/business-service-api/src/main/java/com/ho/business/vo/req/carbin/EarningsCalculateReq.java index d5749f5..e1b50d7 100644 --- a/business-service-api/src/main/java/com/ho/business/vo/req/carbin/EarningsCalculateReq.java +++ b/business-service-api/src/main/java/com/ho/business/vo/req/carbin/EarningsCalculateReq.java @@ -34,6 +34,7 @@ public class EarningsCalculateReq { @ApiModelProperty(value = "结束时间",hidden = true) String endTime; - + @ApiModelProperty(value = "中英切换-查询字段") + private String lang; } diff --git a/business-service-api/src/main/java/com/ho/business/vo/req/device/DeviceTreeReq.java b/business-service-api/src/main/java/com/ho/business/vo/req/device/DeviceTreeReq.java index 86cdacd..19c591d 100644 --- a/business-service-api/src/main/java/com/ho/business/vo/req/device/DeviceTreeReq.java +++ b/business-service-api/src/main/java/com/ho/business/vo/req/device/DeviceTreeReq.java @@ -17,4 +17,7 @@ public class DeviceTreeReq { @ApiModelProperty(value = "src_id") Integer srcId; + @ApiModelProperty(value = "中英切换-查询字段") + private String lang; + } diff --git a/business-service-api/src/main/java/com/ho/business/vo/req/dynamicConfig/DynamicConfigQuery.java b/business-service-api/src/main/java/com/ho/business/vo/req/dynamicConfig/DynamicConfigQuery.java index 525e52f..bded2b7 100644 --- a/business-service-api/src/main/java/com/ho/business/vo/req/dynamicConfig/DynamicConfigQuery.java +++ b/business-service-api/src/main/java/com/ho/business/vo/req/dynamicConfig/DynamicConfigQuery.java @@ -35,4 +35,7 @@ public class DynamicConfigQuery { @ApiModelProperty(value = "是否隐藏(0否,1是,默认0)",hidden = true) private Integer isHide; + + @ApiModelProperty(value = "中英切换-查询字段") + private String lang; } diff --git a/business-service-api/src/main/java/com/ho/business/vo/req/dynamicConfig/PointConfigAdd.java b/business-service-api/src/main/java/com/ho/business/vo/req/dynamicConfig/PointConfigAdd.java index 64e7725..5250e5d 100644 --- a/business-service-api/src/main/java/com/ho/business/vo/req/dynamicConfig/PointConfigAdd.java +++ b/business-service-api/src/main/java/com/ho/business/vo/req/dynamicConfig/PointConfigAdd.java @@ -21,6 +21,9 @@ public class PointConfigAdd { @ApiModelProperty(value = "默认值") private String defaultValue; + @ApiModelProperty(value = "默认值-英文") + private String defaultValueEn; + @ApiModelProperty(value = "配置点类型") private Integer pointType; diff --git a/business-service-api/src/main/java/com/ho/business/vo/req/dynamicConfig/PointConfigQuery.java b/business-service-api/src/main/java/com/ho/business/vo/req/dynamicConfig/PointConfigQuery.java index a99f3cc..fd1a525 100644 --- a/business-service-api/src/main/java/com/ho/business/vo/req/dynamicConfig/PointConfigQuery.java +++ b/business-service-api/src/main/java/com/ho/business/vo/req/dynamicConfig/PointConfigQuery.java @@ -20,4 +20,7 @@ public class PointConfigQuery { @ApiModelProperty(value = "设备id(用以区分属于哪个设备页)") private Integer deviceId; + + @ApiModelProperty(value = "中英切换-查询字段") + private String lang; } diff --git a/business-service-api/src/main/java/com/ho/business/vo/req/modelType/ModelTypeQueryReq.java b/business-service-api/src/main/java/com/ho/business/vo/req/modelType/ModelTypeQueryReq.java index f1c3b0f..aa06428 100644 --- a/business-service-api/src/main/java/com/ho/business/vo/req/modelType/ModelTypeQueryReq.java +++ b/business-service-api/src/main/java/com/ho/business/vo/req/modelType/ModelTypeQueryReq.java @@ -28,4 +28,7 @@ public class ModelTypeQueryReq { @ApiModelProperty(value = "用户id",hidden = true) private String userId; + + @ApiModelProperty(value = "中英切换-查询字段") + private String lang; } diff --git a/business-service-api/src/main/java/com/ho/business/vo/req/point/PointCurveReq.java b/business-service-api/src/main/java/com/ho/business/vo/req/point/PointCurveReq.java index 596ea6f..1c41b08 100644 --- a/business-service-api/src/main/java/com/ho/business/vo/req/point/PointCurveReq.java +++ b/business-service-api/src/main/java/com/ho/business/vo/req/point/PointCurveReq.java @@ -49,4 +49,7 @@ public class PointCurveReq { @ApiModelProperty(value = "是否为策略总览页面(1:是;0:否)") Integer isStrategy; + + @ApiModelProperty(value = "中英切换-查询字段") + private String lang; } diff --git a/business-service-api/src/main/java/com/ho/business/vo/req/point/PointReq.java b/business-service-api/src/main/java/com/ho/business/vo/req/point/PointReq.java index 97d648b..d651065 100644 --- a/business-service-api/src/main/java/com/ho/business/vo/req/point/PointReq.java +++ b/business-service-api/src/main/java/com/ho/business/vo/req/point/PointReq.java @@ -42,5 +42,8 @@ public class PointReq { @ApiModelProperty(value = "值2的定义 大于1 小于2 等于3 大于等于4 小于等于5") private BigDecimal Value2; + @ApiModelProperty(value = "中英切换-查询字段") + private String lang; + } diff --git a/business-service-api/src/main/java/com/ho/business/vo/req/point/PointVo.java b/business-service-api/src/main/java/com/ho/business/vo/req/point/PointVo.java index e800ab1..ecf8c70 100644 --- a/business-service-api/src/main/java/com/ho/business/vo/req/point/PointVo.java +++ b/business-service-api/src/main/java/com/ho/business/vo/req/point/PointVo.java @@ -24,6 +24,9 @@ public class PointVo { @ApiModelProperty(value = "遥信遥测 1遥信 2遥测 默认送2") private Integer sensType; + + @ApiModelProperty(value = "中英切换-查询字段") + private String lang; } diff --git a/business-service-api/src/main/java/com/ho/business/vo/resp/elecPriceCurve/ElecPriceTemplateExcelEn.java b/business-service-api/src/main/java/com/ho/business/vo/resp/elecPriceCurve/ElecPriceTemplateExcelEn.java new file mode 100644 index 0000000..0e770a0 --- /dev/null +++ b/business-service-api/src/main/java/com/ho/business/vo/resp/elecPriceCurve/ElecPriceTemplateExcelEn.java @@ -0,0 +1,66 @@ +package com.ho.business.vo.resp.elecPriceCurve; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Date; + +/** + * @author kerwin + */ +public class ElecPriceTemplateExcelEn { + + + // @ExcelProperty(value = "模板编号") + @ExcelIgnore + private String templateNo; + + @ExcelProperty(value = "Time period starts", index = 1) + private String beginTime; + + @ExcelProperty(value = "End of time period", index = 2) + private String endTime; + + @ExcelProperty(value = "Electricity type", index = 3) + private String type; + + @ExcelProperty(value = "price", index = 4) + private String price; + + @ExcelProperty(value = "Template Name", index = 0) + private String templateName; + + @ExcelProperty(value = "Enable or not", index = 5) + private String isEnable; + + + //@ExcelProperty(value = "电价曲线类型", index = 6) + //private String elecType; + + @ExcelProperty(value = "Modification time", index = 9) + private String updateTime; + + //电站id + @ExcelIgnore + private Integer stationId; + //集团id + @ExcelIgnore + private Integer groupId; + + @ApiModelProperty(value="模板有效期开始时间") + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") + @ExcelProperty(value = "Template validity period start time", index = 6) + private Date validityStartTime; + + @ApiModelProperty(value="模板有效期结束时间") + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") + @ExcelProperty(value = "End time of template validity period", index = 7) + private Date validityEndTime; + + @ApiModelProperty(value="电价折扣(%)") + @ExcelProperty(value = "Electricity price discount (%)", index = 8) + private Double discount; + +} diff --git a/business-service-api/src/main/java/com/ho/business/vo/resp/point/PointRespEnVO.java b/business-service-api/src/main/java/com/ho/business/vo/resp/point/PointRespEnVO.java new file mode 100644 index 0000000..2fa42dd --- /dev/null +++ b/business-service-api/src/main/java/com/ho/business/vo/resp/point/PointRespEnVO.java @@ -0,0 +1,74 @@ +package com.ho.business.vo.resp.point; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ho.common.tools.constant.CommonConstant; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author kerwin + */ +@Data +@ExcelIgnoreUnannotated +public class PointRespEnVO { + + @ApiModelProperty(value = "id") + private Integer id; + + @ApiModelProperty(value = "设备映射表的id") + Integer deviceTypeColId; + + @ApiModelProperty(value = "站点id") + Integer stationId; + + @ApiModelProperty(value = "设备id") + Integer srcId; + + @ApiModelProperty(value = "设备类型") + @ExcelProperty(value = "device type",index = 3) + String deviceType; + + @ApiModelProperty(value = "1遥信 2遥测 3遥控") + private Integer sensType; + + @ApiModelProperty(value = "设备名") + @ExcelProperty(value = "associated device",index = 2) + String deviceName; + + @ApiModelProperty(value = "点表字段") + @ExcelProperty(value = "code",index = 1) + String col; + + @ApiModelProperty(value = "点表字段名称") + @ExcelProperty(value = "name",index = 0) + String colName; + + @ApiModelProperty(value = "当前值") + @ExcelProperty(value = "current value",index = 7) + BigDecimal value; + + @ApiModelProperty(value = "单位") + @ExcelProperty(value = "unit",index = 8) + String unit; + + @ApiModelProperty(value = "最大值") + @ExcelProperty(value = "maximum",index = 4) + BigDecimal maxValue; + + @ApiModelProperty(value = "最小值") + @ExcelProperty(value = "minimum",index = 5) + BigDecimal minValue; + + @ApiModelProperty(value = "更新时间") + @JsonFormat(pattern = CommonConstant.DATE) + @ExcelProperty(value = "update time",index = 6) + String updateTime; + + @ApiModelProperty(value = "是否具有品质位 1是 2否") + private Integer qualityLevel; + +} diff --git a/business-service-dao/src/main/java/com/ho/business/mapper/DeviceMapper.java b/business-service-dao/src/main/java/com/ho/business/mapper/DeviceMapper.java index b22712a..24573c0 100644 --- a/business-service-dao/src/main/java/com/ho/business/mapper/DeviceMapper.java +++ b/business-service-dao/src/main/java/com/ho/business/mapper/DeviceMapper.java @@ -54,7 +54,7 @@ public interface DeviceMapper { * @param needAccessPoint 是否需要接入点,不为空表示需要 * @return */ - List selectByIdAndSrcIdNotZero(Integer stationId,Integer needHide,Integer needAccessPoint); + List selectByIdAndSrcIdNotZero(Integer stationId,Integer needHide,Integer needAccessPoint,String lang); int insertBatch(@Param("list")List deviceList); diff --git a/business-service-dao/src/main/java/com/ho/business/mapper/DeviceTypeColMapper.java b/business-service-dao/src/main/java/com/ho/business/mapper/DeviceTypeColMapper.java index 1c29036..28d4bc2 100644 --- a/business-service-dao/src/main/java/com/ho/business/mapper/DeviceTypeColMapper.java +++ b/business-service-dao/src/main/java/com/ho/business/mapper/DeviceTypeColMapper.java @@ -32,7 +32,7 @@ public interface DeviceTypeColMapper { int updateList(@Param("deviceTypeColList")List deviceTypeColList); //deviceType查询 - List selectByDeviceType(String deviceType); + List selectByDeviceType(@Param("deviceType")String deviceType,@Param("lang") String lang); List selectByParam(@Param("deviceTypeCol") DeviceTypeCol deviceTypeCol); @@ -53,7 +53,7 @@ public interface DeviceTypeColMapper { List getCompListByType(@Param("type") String type, @Param("typeName") String typeName, @Param("modelCol") String modelCol); - List selectSameCol(@Param("deviceType") String deviceType, @Param("list") List collect); + List selectSameCol(@Param("deviceType") String deviceType, @Param("list") List collect,@Param("lang") String lang); //批量新增设备表字段 void addBatchDevice(@Param("list") List deviceTypeColList); @@ -65,7 +65,7 @@ public interface DeviceTypeColMapper { void deleteBatchModel(List ids); - DeviceTypeCol selectTypeAndCol(String col, String deviceType); + DeviceTypeCol selectTypeAndCol(String col, String deviceType,String lang); Integer selectCountByDeviceType(@Param("deviceTypeCol")DeviceTypeCol deviceTypeCol); diff --git a/business-service-dao/src/main/java/com/ho/business/mapper/PlanningCurveIssueMapper.java b/business-service-dao/src/main/java/com/ho/business/mapper/PlanningCurveIssueMapper.java index 82f549a..57ee011 100644 --- a/business-service-dao/src/main/java/com/ho/business/mapper/PlanningCurveIssueMapper.java +++ b/business-service-dao/src/main/java/com/ho/business/mapper/PlanningCurveIssueMapper.java @@ -33,7 +33,7 @@ public interface PlanningCurveIssueMapper { void addPlanningCurveHistory(@Param("condition") List PlanningCurveHistory); - List getPlanCurveOperationList(@Param("stationId") String stationId); + List getPlanCurveOperationList(@Param("stationId") String stationId,@Param("lang") String lang); List getPlanningCurveHistory(@Param("planningCurveId") String planningCurveId); diff --git a/business-service-dao/src/main/java/com/ho/business/mapper/PointConfigMapper.java b/business-service-dao/src/main/java/com/ho/business/mapper/PointConfigMapper.java index 9f4d429..13654c3 100644 --- a/business-service-dao/src/main/java/com/ho/business/mapper/PointConfigMapper.java +++ b/business-service-dao/src/main/java/com/ho/business/mapper/PointConfigMapper.java @@ -63,4 +63,13 @@ public interface PointConfigMapper { */ int updateList(List list); + /** + * 查询所有name_en 为空的数据 + * @return + */ + List selectTableList(@Param("tableName") String tableName,@Param("name") String name,@Param("nameEn") String nameEn); + + int updateNameEnById(@Param("id") Integer id, @Param("tableName") String tableName,@Param("nameEn") String nameEn,@Param("translateName") String translateName); + + } diff --git a/business-service-dao/src/main/java/com/ho/business/mapper/PointPolysemyConfigMapper.java b/business-service-dao/src/main/java/com/ho/business/mapper/PointPolysemyConfigMapper.java index 7fd1418..c7076e1 100644 --- a/business-service-dao/src/main/java/com/ho/business/mapper/PointPolysemyConfigMapper.java +++ b/business-service-dao/src/main/java/com/ho/business/mapper/PointPolysemyConfigMapper.java @@ -38,7 +38,7 @@ public interface PointPolysemyConfigMapper { * @param ids * @return */ - List selectByPointIds(@Param("ids") List ids); + List selectByPointIds(@Param("ids") List ids,@Param("lang") String lang); /** * 根据id删除配置信息 diff --git a/business-service-dao/src/main/java/com/ho/business/mapper/TranslateNameMapper.java b/business-service-dao/src/main/java/com/ho/business/mapper/TranslateNameMapper.java new file mode 100644 index 0000000..64c26d1 --- /dev/null +++ b/business-service-dao/src/main/java/com/ho/business/mapper/TranslateNameMapper.java @@ -0,0 +1,28 @@ +package com.ho.business.mapper; + +import com.ho.business.entity.TranslateName; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** +* @author xwz +* @description 针对表【Dict_Province】的数据库操作Mapper +* @createDate 2024-12-18 +*/ +@Mapper +public interface TranslateNameMapper { + + List getDictNation(); + + TranslateName selectNameEN(@Param("name")String name); + + int insert(@Param("vo")TranslateName vo); + + int updateNameEnById(@Param("id") Integer id, @Param("nameEn") String nameEn); +} + + + + diff --git a/business-service-dao/src/main/java/com/ho/business/mapper/TranslateNationMapper.java b/business-service-dao/src/main/java/com/ho/business/mapper/TranslateNationMapper.java deleted file mode 100644 index 3522be2..0000000 --- a/business-service-dao/src/main/java/com/ho/business/mapper/TranslateNationMapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ho.business.mapper; - -import com.ho.business.entity.TranslateNation; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -/** -* @author xwz -* @description 针对表【Dict_Province】的数据库操作Mapper -* @createDate 2024-12-18 -*/ -@Mapper -public interface TranslateNationMapper { - - List getDictNation(); -} - - - - diff --git a/business-service-dao/src/main/java/com/ho/business/service/DeviceService.java b/business-service-dao/src/main/java/com/ho/business/service/DeviceService.java index 77e6d58..3c61354 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/DeviceService.java +++ b/business-service-dao/src/main/java/com/ho/business/service/DeviceService.java @@ -89,11 +89,14 @@ public interface DeviceService { //根据电站id和srcId查询 Device selectByStationIdAndSrcId(Integer stationId, Integer srcId); + Device selectByStationIdAndSrcIdAndLng(Integer stationId, Integer srcId,String lang); + + List selectByGroup(Integer groupId); List selectDistinctDeviceTypeByStationId(Integer stationId); - List getDeviceByStationId(Integer stationId); + List getDeviceByStationId(Integer stationId,String lang); List getDeviceByStationIds(List stationIds); @@ -138,7 +141,7 @@ public interface DeviceService { * @param stationId * @return */ - List selectByIdAndSrcIdNotZero(Integer stationId); + List selectByIdAndSrcIdNotZero(Integer stationId,String lang); /** * 查询设备需要设备接入点 @@ -146,7 +149,7 @@ public interface DeviceService { * @param stationId * @return */ - List selectDeviceByStationId(Integer stationId); + List selectDeviceByStationId(Integer stationId,String lang); /** * 查询所有设备,不包含接入点 @@ -154,7 +157,7 @@ public interface DeviceService { * @param stationId * @return */ - List selectAllDeviceAndSrcIdNotZero(Integer stationId); + List selectAllDeviceAndSrcIdNotZero(Integer stationId,String lang); /** * 获取单个设备电压电流正太分布数据 diff --git a/business-service-dao/src/main/java/com/ho/business/service/DeviceTypeColService.java b/business-service-dao/src/main/java/com/ho/business/service/DeviceTypeColService.java index f3e574a..a8ec5d1 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/DeviceTypeColService.java +++ b/business-service-dao/src/main/java/com/ho/business/service/DeviceTypeColService.java @@ -19,14 +19,14 @@ public interface DeviceTypeColService { int insertList(List list,Integer GroupId); - List selectByDeviceType(String deviceType); + List selectByDeviceType(String deviceType,String lang); DeviceTypeCol selectById(Integer id); - DeviceTypeCol selectTypeAndCol(String col, String deviceType); + DeviceTypeCol selectTypeAndCol(String col, String deviceType,String lang); - List selectDeviceTypeColList(String deviceType,List collect); + List selectDeviceTypeColList(String deviceType,List collect,String lang); Integer selectCountByDeviceType(DeviceTypeCol deviceTypeCol); diff --git a/business-service-dao/src/main/java/com/ho/business/service/DynamicConfigService.java b/business-service-dao/src/main/java/com/ho/business/service/DynamicConfigService.java index 39bd63a..082b702 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/DynamicConfigService.java +++ b/business-service-dao/src/main/java/com/ho/business/service/DynamicConfigService.java @@ -119,4 +119,12 @@ public interface DynamicConfigService { * @return */ int delDynamicConfigTitle(DynamicConfigTitle vo); + + /** + * 修改点名称英文 + * @return + */ + int updatePointNameEn(String tableName,String name,String nameEn); + + String getNameEn(String name); } diff --git a/business-service-dao/src/main/java/com/ho/business/service/OpenStationService.java b/business-service-dao/src/main/java/com/ho/business/service/OpenStationService.java index 12671e7..651c176 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/OpenStationService.java +++ b/business-service-dao/src/main/java/com/ho/business/service/OpenStationService.java @@ -42,7 +42,7 @@ public interface OpenStationService { * @param req * @param response */ - void exportEleData(PcsStationReq req, HttpServletResponse response); + void exportEleData(PcsStationReq req, HttpServletResponse response,String lang); /** * 查询日冻结数据 diff --git a/business-service-dao/src/main/java/com/ho/business/service/PlanningCurveIssueService.java b/business-service-dao/src/main/java/com/ho/business/service/PlanningCurveIssueService.java index 8c82b35..0b14e70 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/PlanningCurveIssueService.java +++ b/business-service-dao/src/main/java/com/ho/business/service/PlanningCurveIssueService.java @@ -28,7 +28,7 @@ public interface PlanningCurveIssueService { public void planCurveOperationRecord(PlanCurveOperationRecordReq planCurveOperationRecordReq); - List getPlanCurveOperationList(String stationId); + List getPlanCurveOperationList(String stationId,String lang); Map getPlanningCurveHistory(List planningCurveIds); } diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceModelServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceModelServiceImpl.java index 60958e7..01a0b3c 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceModelServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceModelServiceImpl.java @@ -89,7 +89,7 @@ public class DeviceModelServiceImpl implements DeviceModelService { List addCollect = addColList.stream().map(DeviceCol::getCol) .collect(Collectors.toList()); if (!addCollect.isEmpty()) { - List deviceTypeCols = deviceTypeColMapper.selectSameCol(vo.getDeviceType(), addCollect); + List deviceTypeCols = deviceTypeColMapper.selectSameCol(vo.getDeviceType(), addCollect,null); if (!deviceTypeCols.isEmpty()) { throw new BusinessException(BaseResponseCode.THE_SAME_DATA_EXISTS_DATABASE_PLEASE_CHECK); } @@ -158,7 +158,7 @@ public class DeviceModelServiceImpl implements DeviceModelService { @Override public void addDeviceTypeCol(DeviceTypeColAddReq vo) { - DeviceTypeCol deviceCol = deviceTypeColMapper.selectTypeAndCol(vo.getCol(), vo.getDeviceType()); + DeviceTypeCol deviceCol = deviceTypeColMapper.selectTypeAndCol(vo.getCol(), vo.getDeviceType(),null); if (deviceCol != null && vo.getId() == null) { throw new BusinessException(BaseResponseCode.THE_SAME_DATA_EXISTS_DATABASE_PLEASE_CHECK); } diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceServiceImpl.java index 505f5fa..055c37f 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceServiceImpl.java @@ -106,6 +106,10 @@ public class DeviceServiceImpl implements DeviceService { @Autowired Snowflake snowflake; + @Autowired + DynamicConfigService dynamicConfigService; + + @Override public PageResult getPageListByInfo(DeviceReqVO deviceReqVO) { //是否是多个电站 @@ -391,6 +395,7 @@ public class DeviceServiceImpl implements DeviceService { String dName = adddevice.getDeviceName() + (i + 1); newSrcIdList.add(newSrcId); device.setDeviceName(dName); + device.setDeviceNameEn(dynamicConfigService.getNameEn(dName)); device.setSrcId(newSrcId); device.setDeptId(adddevice.getDeptId()); device.setDeviceType(adddevice.getDeviceType()); @@ -517,6 +522,21 @@ public class DeviceServiceImpl implements DeviceService { return device; } + @Override +// @Cacheable(value = "device", sync = true) + public Device selectByStationIdAndSrcIdAndLng(Integer stationId, Integer srcId,String lang) { + Device device = new Device(); + DeviceReqVO deviceReqVO = new DeviceReqVO(); + deviceReqVO.setStationId(stationId); + deviceReqVO.setSrcId(srcId); + deviceReqVO.setLang(lang); + List deviceRespVOList = getList(deviceReqVO); + if(deviceRespVOList!=null && !deviceRespVOList.isEmpty()){ + device = deviceRespVOList.get(0); + } + return device; + } + @Override public List selectByGroup(Integer groupId) { Device device = new Device(); @@ -532,9 +552,10 @@ public class DeviceServiceImpl implements DeviceService { } @Override - public List getDeviceByStationId(Integer stationId) { + public List getDeviceByStationId(Integer stationId,String lang) { DeviceReqVO reqVO = new DeviceReqVO(); reqVO.setStationId(stationId); + reqVO.setLang(lang); List deviceRespVOS = deviceMapper.selectByCondition(reqVO); deviceRespVOS = getDeviceRespVOS(deviceRespVOS); return deviceRespVOS; @@ -814,26 +835,26 @@ public class DeviceServiceImpl implements DeviceService { } @Override - public List selectByIdAndSrcIdNotZero(Integer stationId) { - List list = deviceMapper.selectByIdAndSrcIdNotZero(stationId, null, null); + public List selectByIdAndSrcIdNotZero(Integer stationId,String lang) { + List list = deviceMapper.selectByIdAndSrcIdNotZero(stationId, null, null,lang); return list; } @Override - public List selectDeviceByStationId(Integer stationId) { - List list = deviceMapper.selectByIdAndSrcIdNotZero(stationId, null, CommonConstant.ONE); + public List selectDeviceByStationId(Integer stationId,String lang) { + List list = deviceMapper.selectByIdAndSrcIdNotZero(stationId, null, CommonConstant.ONE,lang); return list; } @Override - public List selectAllDeviceAndSrcIdNotZero(Integer stationId) { - List list = deviceMapper.selectByIdAndSrcIdNotZero(stationId, CommonConstant.ONE, null); + public List selectAllDeviceAndSrcIdNotZero(Integer stationId,String lang) { + List list = deviceMapper.selectByIdAndSrcIdNotZero(stationId, CommonConstant.ONE, null,lang); return list; } @Override public TemperatureVoltageResp getTemperatureVoltageData(DeviceTreeReq vo) { - List deviceRespVOS = selectByIdAndSrcIdNotZero(vo.getStationId()); + List deviceRespVOS = selectByIdAndSrcIdNotZero(vo.getStationId(),vo.getLang()); List treeDevices = new ArrayList<>(); if (!deviceRespVOS.isEmpty()) { treeDevices = deviceTypeConfigService.getTreeDevices(deviceRespVOS, vo.getSrcId()); @@ -1118,7 +1139,7 @@ public class DeviceServiceImpl implements DeviceService { List deviceRespVOS = deviceMapper.selectByCondition(deviceReqVO); List srcIdList = deviceRespVOS.stream().map(s -> s.getSrcId()).collect(Collectors.toList()); //查询对应的设备 - List deviceStation = selectByIdAndSrcIdNotZero(vo.getStationId()); + List deviceStation = selectByIdAndSrcIdNotZero(vo.getStationId(),vo.getLang()); List treeDevices = new ArrayList<>(); if (!deviceRespVOS.isEmpty()) { for (Integer srcId : srcIdList) { @@ -1140,7 +1161,7 @@ public class DeviceServiceImpl implements DeviceService { List deviceRespVOS = deviceMapper.selectByCondition(deviceReqVO); List srcIdList = deviceRespVOS.stream().map(s -> s.getSrcId()).collect(Collectors.toList()); //查询对应的设备 - List deviceStation = selectByIdAndSrcIdNotZero(vo.getStationId()); + List deviceStation = selectByIdAndSrcIdNotZero(vo.getStationId(),vo.getLang()); List treeDevices = new ArrayList<>(); if (!deviceRespVOS.isEmpty()) { for (Integer srcId : srcIdList) { diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceTypeColServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceTypeColServiceImpl.java index c8452f9..d943ad4 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceTypeColServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceTypeColServiceImpl.java @@ -50,7 +50,7 @@ public class DeviceTypeColServiceImpl implements DeviceTypeColService { DeviceTypeCol deviceTypeCol = null; for (Map.Entry> src : mapList.entrySet()) { //已经存在的 - List isSaveList = deviceTypeColMapper.selectByDeviceType(src.getKey()); + List isSaveList = deviceTypeColMapper.selectByDeviceType(src.getKey(),null); Map isSaveMap = isSaveList.stream().collect(Collectors.toMap(k -> k.getDeviceType() + "_" + k.getCol(), DeviceTypeCol -> DeviceTypeCol)); Map> addMap = new HashMap<>(); @@ -118,8 +118,8 @@ public class DeviceTypeColServiceImpl implements DeviceTypeColService { } @Override - public List selectByDeviceType(String deviceType) { - List deviceTypeColList = deviceTypeColMapper.selectByDeviceType(deviceType); + public List selectByDeviceType(String deviceType,String lang) { + List deviceTypeColList = deviceTypeColMapper.selectByDeviceType(deviceType,lang); return deviceTypeColList; } @@ -130,14 +130,14 @@ public class DeviceTypeColServiceImpl implements DeviceTypeColService { } @Override - public DeviceTypeCol selectTypeAndCol(String col, String deviceType) { - DeviceTypeCol deviceTypeCol = deviceTypeColMapper.selectTypeAndCol(col, deviceType); + public DeviceTypeCol selectTypeAndCol(String col, String deviceType,String lang) { + DeviceTypeCol deviceTypeCol = deviceTypeColMapper.selectTypeAndCol(col, deviceType,lang); return deviceTypeCol; } @Override - public List selectDeviceTypeColList(String deviceType, List collect) { - List deviceTypeCols = deviceTypeColMapper.selectSameCol(deviceType, collect); + public List selectDeviceTypeColList(String deviceType, List collect,String lang) { + List deviceTypeCols = deviceTypeColMapper.selectSameCol(deviceType, collect,lang); return deviceTypeCols; } diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/DynamicConfigServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/DynamicConfigServiceImpl.java index 5a6d84f..803ae46 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/DynamicConfigServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/DynamicConfigServiceImpl.java @@ -18,7 +18,9 @@ import com.ho.business.vo.resp.DeviceRespVO; import com.ho.business.vo.resp.dynamicConfig.*; import com.ho.common.tools.constant.CommonConstant; import com.ho.common.tools.service.RedisService; +import com.ho.common.tools.util.TranslateUtils; import com.ho.datacollect.api.constant.DataCollectConstant; +import jodd.util.StringUtil; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; import org.springframework.beans.BeanUtils; @@ -27,6 +29,7 @@ import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.*; +import java.util.concurrent.CompletableFuture; import java.util.function.Function; import java.util.stream.Collectors; @@ -70,6 +73,9 @@ public class DynamicConfigServiceImpl implements DynamicConfigService { @Autowired DynamicConfigTitleMapper configTitleMapper; + @Autowired + TranslateNameMapper translateNameMapper; + @Override public int insertList(List list) { List insertList = list.stream().filter(i -> i.getId() == null).collect(Collectors.toList()); @@ -153,6 +159,8 @@ public class DynamicConfigServiceImpl implements DynamicConfigService { List insertList = new ArrayList<>(); CurveConfig config = null; for (CurveConfigAdd c:list) { + //curveName 设置英文翻译 20250821 + c.setCurveNameEn(getNameEn(c.getCurveName())); config = new CurveConfig(); BeanUtils.copyProperties(c,config); if(c.getId() == null){ @@ -180,6 +188,7 @@ public class DynamicConfigServiceImpl implements DynamicConfigService { list.get(i).setId(id); List dList = list.get(i).getList(); if(null != dList && !dList.isEmpty()){ + dList.stream().forEach(s->{s.setColNameEn(getNameEn(s.getColName()));}); //动态配置点国际化 result = dynamicConfigMapper.insertList(dList); log.info("插入动态配置结果,{}",result); @@ -293,6 +302,11 @@ public class DynamicConfigServiceImpl implements DynamicConfigService { if(srcPoint.getSort()==null){ srcPoint.setSort(i); } + //name defaultValue 设置英文翻译 20250821 + srcPoint.setNameEn(getNameEn(srcPoint.getName())); + if(StringUtil.isNotBlank(srcPoint.getDefaultValue())){ + srcPoint.setDefaultValueEn(getNameEn(srcPoint.getDefaultValue())); + } pointConfig = new PointConfig(); BeanUtils.copyProperties(srcPoint,pointConfig); if(srcPoint.getId()==null){ @@ -337,6 +351,7 @@ public class DynamicConfigServiceImpl implements DynamicConfigService { List dynamicConfigs = list.get(i).getList(); //插入动态配置点 if(!dynamicConfigs.isEmpty()){ + dynamicConfigs.stream().forEach(s->{s.setColNameEn(getNameEn(s.getColName()));}); result = dynamicConfigMapper.insertList(dynamicConfigs); for (DynamicConfig d:dynamicConfigs) { relation = new PointConfigRelation(); @@ -359,6 +374,8 @@ public class DynamicConfigServiceImpl implements DynamicConfigService { p.getPolysemyList().forEach(i->i.setPointId(p.getId())); pList.addAll(p.getPolysemyList()); } + //name 设置英文翻译 20250821 + pList.stream().forEach(i->{i.setNameEn(getNameEn(i.getName()));}); result = polysemyMapper.insertList(pList); log.info("插入一点多义表结果:{}",result); } @@ -386,7 +403,7 @@ public class DynamicConfigServiceImpl implements DynamicConfigService { List polysemyList = pointConfigResultList.stream().filter(i -> CommonConstant.TWO.equals(i.getPointType()) || CommonConstant.ELEVEN.equals(i.getPointType())).map(PointConfigResultResp::getId).distinct().collect(Collectors.toList()); Map> vMap = new HashMap<>(); if(!polysemyList.isEmpty()){ - List list = polysemyMapper.selectByPointIds(polysemyList); + List list = polysemyMapper.selectByPointIds(polysemyList,vo.getLang()); vMap = list.stream().collect(Collectors.groupingBy(PointPolysemyConfig::getPointId)); } //拆电芯 @@ -445,14 +462,14 @@ public class DynamicConfigServiceImpl implements DynamicConfigService { List polysemyList = pointConfigResultList.stream().filter(i -> CommonConstant.TWO.equals(i.getPointType())).map(PointConfigResultResp::getId).distinct().collect(Collectors.toList()); Map vMap = new HashMap<>(); if(!polysemyList.isEmpty()){ - List list = polysemyMapper.selectByPointIds(polysemyList); + List list = polysemyMapper.selectByPointIds(polysemyList,vo.getLang()); vMap = list.stream().filter(s->s.getValue()!=null&&s.getName()!=null).collect(Collectors.toMap(s -> s.getPointId() + "," + s.getValue().intValue(), s -> s.getName(), (k1, k2) -> k1)); } //范围内的一点多义 List rangePolysemyList = pointConfigResultList.stream().filter(i -> CommonConstant.ELEVEN.equals(i.getPointType())).map(PointConfigResultResp::getId).distinct().collect(Collectors.toList()); Map> rMap = new HashMap<>(); if(!rangePolysemyList.isEmpty()){ - List list = polysemyMapper.selectByPointIds(rangePolysemyList); + List list = polysemyMapper.selectByPointIds(rangePolysemyList,vo.getLang()); rMap = list.stream().filter(s -> s.getValue() != null && s.getName() != null && s.getSymbol() != null).collect(Collectors.groupingBy(PointPolysemyConfig::getPointId)); } //拆电芯 @@ -762,6 +779,51 @@ public class DynamicConfigServiceImpl implements DynamicConfigService { return result; } + @Override + public int updatePointNameEn(String tableName,String name,String nameEn) { + int a=0; + //查询所有name_en 为空的数据 + List pointList = pointConfigMapper.selectTableList(tableName,name,nameEn); + for (PointConfigResp vo:pointList){ + if(StringUtil.isNotBlank(vo.getName())){ + String translateName = getNameEn(vo.getName()); + int resoult=pointConfigMapper.updateNameEnById(vo.getId(),tableName,nameEn,translateName); + a=a+resoult; + log.info("修改进度:{}",a); + } + } + return a; + } + + @Override + public String getNameEn(String name) { + // 查询数据库中有预先翻译的中文字段 + String nameEn = null; + TranslateName vo = translateNameMapper.selectNameEN(name); + if(vo == null){ + nameEn = TranslateUtils.translate(name); + // 插入中文预翻译表 + TranslateName translate = new TranslateName(); + translate.setName(name); + translate.setNameEn(nameEn); + CompletableFuture.runAsync(()->{ + translateNameMapper.insert(translate); + }); + }else{ + if(StringUtil.isEmpty(vo.getNameEn())){ + nameEn = TranslateUtils.translate(name); + String finalNameEn = nameEn; + CompletableFuture.runAsync(()->{ + translateNameMapper.updateNameEnById(vo.getId(), finalNameEn); + }); + }else{ + nameEn = vo.getNameEn(); + } + } + return nameEn; + } + + private void getConfigAddList(SyncDynamicConfigParam vo, List pointList, List pointAddList,Integer deviceId,Map map) { PointConfigAdd configAdd = null; for (PointConfigResultResp p: pointList) { diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/EarningsCalculateServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/EarningsCalculateServiceImpl.java index 5568cf2..e91aef0 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/EarningsCalculateServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/EarningsCalculateServiceImpl.java @@ -194,11 +194,17 @@ public class EarningsCalculateServiceImpl implements EarningsCalculateService { String time = earningsCalculateReq.getTime(); ec.setMonth(time.substring(time.length() - 2, time.length())); + String reportName = CommonConstant.REPORT_NAME; + String billName = CommonConstant.BILL_NAME; + if(RedisKeyConstant.User.EN_US.equals(earningsCalculateReq.getLang())){ + reportName = CommonConstant.REPORT_NAME_EN; + billName = CommonConstant.BILL_NAME_EN; + } // 电站名称(报表标题) if (type == 0) { - ec.setStationName(station.getName() + "( " + time + " ) 月度报表"); + ec.setStationName(station.getName() + "( " + time + " ) "+reportName); } else { - ec.setStationName(station.getName() + "( " + time + " ) 月度账单"); + ec.setStationName(station.getName() + "( " + time + " ) "+billName); } ec.setList(list); //充电收益 diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/HisCurveRelateServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/HisCurveRelateServiceImpl.java index 1e2ab9e..a456d3d 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/HisCurveRelateServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/HisCurveRelateServiceImpl.java @@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo; import com.ho.business.entity.ElecMeterValue; import com.ho.business.entity.HisCurveRelate; import com.ho.business.mapper.HisCurveRelateMapper; +import com.ho.business.service.DynamicConfigService; import com.ho.business.service.HisCurveRelateService; import com.ho.business.vo.req.modelType.ModelTypeQueryReq; import com.ho.business.vo.req.point.HisPointReqVo; @@ -38,6 +39,10 @@ public class HisCurveRelateServiceImpl implements HisCurveRelateService { @Autowired private HisCurveRelateMapper hisCurveRelateMapper; + @Autowired + private DynamicConfigService dynamicConfigService; + + @Override public void add(HisPointReqVo hisPointReqVo, SimpleUser user) { List list =new ArrayList<>(); @@ -49,10 +54,12 @@ public class HisCurveRelateServiceImpl implements HisCurveRelateService { hisCurveRelate.setDeviceType(hisPointCurveReqVo.getDeviceType()); hisCurveRelate.setModelId(String.valueOf(modelId)); hisCurveRelate.setColName(hisPointCurveReqVo.getColName()); + hisCurveRelate.setColNameEn(dynamicConfigService.getNameEn(hisPointCurveReqVo.getColName())); hisCurveRelate.setStationId(hisPointCurveReqVo.getStationId()); //modelname 不能重复 //hisCurveRelateMapper.selectName(hisPointReqVo.getModelName()); hisCurveRelate.setModelName(hisPointReqVo.getModelName()); + hisCurveRelate.setModelNameEn(dynamicConfigService.getNameEn(hisPointReqVo.getModelName())); hisCurveRelate.setSrcId(hisPointCurveReqVo.getSrcId()); hisCurveRelate.setUserId(user.getUserId()); list.add(hisCurveRelate); @@ -69,6 +76,7 @@ public class HisCurveRelateServiceImpl implements HisCurveRelateService { HisCurveRelate queryVo = new HisCurveRelate(); queryVo.setStationId(vo.getStationId()); queryVo.setUserId(vo.getUserId()); + queryVo.setLang(vo.getLang()); List hisCurveRelateList = hisCurveRelateMapper.selectAll(queryVo); Map> chargeMap = hisCurveRelateList.stream().collect(Collectors.groupingBy(HisCurveRelate::getModelId)); List resultList = new ArrayList<>(); diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/IargeScreenShowServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/IargeScreenShowServiceImpl.java index 303f53c..b09bf11 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/IargeScreenShowServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/IargeScreenShowServiceImpl.java @@ -967,48 +967,15 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService { } private List getProvince(List stations) { - //地址选取前三个字 -// Map> provincesMap = stations.stream().sorted(Comparator.comparing(Station::getName)).collect(Collectors.groupingBy(s -> { -// return s.getAddress().substring(0, 3); -// })); -// //创建返回值集合 -// List provinceList = new ArrayList<>(); -// provincesMap.forEach((k, v) -> { -// ProvinceStation provinceStation = new ProvinceStation(); -// if (k.contains("省")) { -// provinceStation.setName(k.replace("省", "")); -// } else if (k.contains("广西")) { -// provinceStation.setName(CommonConstant.ChineseProvinces.guangxi); -// } else if (k.contains("宁夏")) { -// provinceStation.setName(CommonConstant.ChineseProvinces.ningxia); -// } else if (k.contains("内蒙古")) { -// provinceStation.setName(CommonConstant.ChineseProvinces.neimenggu); -// } else if (k.contains("新疆")) { -// provinceStation.setName(CommonConstant.ChineseProvinces.xinjiang); -// } else if (k.contains("西藏")) { -// provinceStation.setName(CommonConstant.ChineseProvinces.xizang); -// } else if (k.contains("香港")) { -// provinceStation.setName(CommonConstant.ChineseProvinces.xianggang); -// } else if (k.contains("澳门")) { -// provinceStation.setName(CommonConstant.ChineseProvinces.aomen); -// } else { -// provinceStation.setName(k.replaceFirst("市", "")); -// } -// provinceStation.setList(v); -// provinceList.add(provinceStation); -// }); - List dictProvince = translateProvinceMapper.getDictProvince(); - Map provinceMap = dictProvince.stream().collect(Collectors.toMap(s -> s.getName(), s -> s.getNameEn(), (k1, k2) -> k1)); - Map> provincesMap = stations.stream().filter(s->s.getProvince()!=null).collect(Collectors.groupingBy(Station::getProvince)); - List provinceList = new ArrayList<>(); - provincesMap.forEach((k, v) -> { + Map> natioMap = stations.stream().filter(s->s.getProvince()!=null).collect(Collectors.groupingBy(Station::getNation)); + List list = new ArrayList<>(); + natioMap.forEach((k, v) -> { ProvinceStation provinceStation = new ProvinceStation(); provinceStation.setName(k); - provinceStation.setNameEn(provinceMap.get(k)); provinceStation.setList(v); - provinceList.add(provinceStation); + list.add(provinceStation); }); - return provinceList; + return list; } @Override @@ -1306,16 +1273,16 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService { } List list = getCountStations(stationIds); List regionList = new ArrayList<>(); - Map> provinceMap = list.stream().filter(i -> i.getProvince() != null).collect(Collectors.groupingBy(Station::getProvince)); - if (provinceMap.size() > CommonConstant.ONE) { - regionList = getListSubdata(provinceMap); + Map> nationMap = list.stream().filter(i -> i.getProvince() != null).collect(Collectors.groupingBy(Station::getNation)); + if (nationMap.size() > CommonConstant.ONE) { + regionList = getListSubdata(nationMap); } else { - Map> cityMap = list.stream().filter(i -> i.getCity() != null).collect(Collectors.groupingBy(Station::getCity)); - if (cityMap.size() > CommonConstant.ONE) { - regionList = getListSubdata(cityMap); + Map> provinceMap = list.stream().filter(i -> i.getCity() != null).collect(Collectors.groupingBy(Station::getProvince)); + if (provinceMap.size() > CommonConstant.ONE) { + regionList = getListSubdata(provinceMap); } else { - Map> districtMap = list.stream().filter(i -> i.getDistrict() != null).collect(Collectors.groupingBy(Station::getDistrict)); - regionList = getListSubdata(districtMap); + Map> cityMap = list.stream().filter(i -> i.getDistrict() != null).collect(Collectors.groupingBy(Station::getCity)); + regionList = getListSubdata(cityMap); } } return regionList; diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/InverterServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/InverterServiceImpl.java index 394b0bc..a2838e7 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/InverterServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/InverterServiceImpl.java @@ -1081,7 +1081,7 @@ public class InverterServiceImpl implements InverterService { //查询设备映射字段 List colMappingList = modelDeviceService.getCompListByType(CommonConstant.ModelDeviceType.DEVICE, device.getDeviceType(), null); //查询没有映射字段 - List deviceTypeCols = deviceTypeColMapper.selectByDeviceType(device.getDeviceType()); + List deviceTypeCols = deviceTypeColMapper.selectByDeviceType(device.getDeviceType(),null); //拼接缓存key String inverterRedisKey = device.getDeviceType() + ":" + vo.getStationId() + ":" + vo.getSrcId(); //先判断缓存中是否存在 diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/ModelDeviceServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/ModelDeviceServiceImpl.java index 6feb7d8..a23bd78 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/ModelDeviceServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/ModelDeviceServiceImpl.java @@ -104,7 +104,7 @@ public class ModelDeviceServiceImpl implements ModelDeviceService { if(redisService.hasKey(key)){ deviceTypeCols =(List) redisService.get(key); }else{ - deviceTypeCols = deviceTypeColMapper.selectByDeviceType(deviceType); + deviceTypeCols = deviceTypeColMapper.selectByDeviceType(deviceType,null); redisService.set(key,deviceTypeCols); redisService.expire(key,1, TimeUnit.HOURS); } diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/OpenStationServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/OpenStationServiceImpl.java index b41d1d7..2b804db 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/OpenStationServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/OpenStationServiceImpl.java @@ -27,6 +27,7 @@ import com.ho.business.vo.resp.pcsStation.*; import com.ho.business.vo.resp.station.ActiveReactivePower; import com.ho.common.tools.constant.CommonConstant; import com.ho.common.tools.constant.DefineConstant; +import com.ho.common.tools.constant.RedisKeyConstant; import com.ho.common.tools.entity.PointCurveSrcCol; import com.ho.common.tools.exception.BaseResponseCode; import com.ho.common.tools.exception.BusinessException; @@ -554,7 +555,7 @@ public class OpenStationServiceImpl implements OpenStationService { } @Override - public void exportEleData(PcsStationReq req, HttpServletResponse response) { + public void exportEleData(PcsStationReq req, HttpServletResponse response,String lang) { try { List stationIds = req.getStationIds(); List stations = stationService.selectStationsByIds(stationIds); @@ -567,6 +568,10 @@ public class OpenStationServiceImpl implements OpenStationService { String name = ""; String summary = DefineConstant.SUMMARY; String summaryData = DefineConstant.SUMMARY_DATA_STATION; + if(RedisKeyConstant.User.EN_US.equals(lang)){ + summary = DefineConstant.SUMMARY_EN; + summaryData = DefineConstant.SUMMARY_DATA_STATION_EN; + } if("segment".equals(segmentType)){ List totalList = new ArrayList<>(); BigDecimal chargeTip = BigDecimal.ZERO; @@ -595,7 +600,7 @@ public class OpenStationServiceImpl implements OpenStationService { name = idNameMap.get(stationId); if(dataList.size()>0){ dataList.add(calculateData); - setSheetEarningsData(sheetsList, name==null?"":name.replaceAll("/", " "), dataList); + setSheetEarningsData(sheetsList, name==null?"":name.replaceAll("/", " "), dataList,lang); } charge = charge.add(calculateData.getChargeElec()); discharge = discharge.add(calculateData.getDischargeElec()); @@ -626,7 +631,7 @@ public class OpenStationServiceImpl implements OpenStationService { calculateData.setDischargeElec(discharge); calculateData.setDate(summary); totalList.add(calculateData); - setSheetEarningsData(sheetsList, summaryData, totalList); + setSheetEarningsData(sheetsList, summaryData, totalList,lang); } ExcelUtil.exportExcel(sheetsList,response); }else{ @@ -649,7 +654,7 @@ public class OpenStationServiceImpl implements OpenStationService { name = idNameMap.get(stationId); if(dataList.size()>0){ dataList.add(pcsElecData); - setSheetElecData(sheetsList, name==null?"":name.replaceAll("/", " "), dataList); + setSheetElecData(sheetsList, name==null?"":name.replaceAll("/", " "), dataList,lang); } charge = charge.add(pcsElecData.getChargeElec()); discharge = discharge.add(pcsElecData.getDischargeElec()); @@ -664,7 +669,7 @@ public class OpenStationServiceImpl implements OpenStationService { pcsElecData.setDischargeElec(discharge); pcsElecData.setDate(summary); totalList.add(pcsElecData); - setSheetElecData(sheetsList, summaryData, totalList); + setSheetElecData(sheetsList, summaryData, totalList,lang); } ExcelUtil.exportExcel(sheetsList,response); } @@ -1024,7 +1029,7 @@ public class OpenStationServiceImpl implements OpenStationService { return data; } - private void setSheetElecData(List> sheetsList, String name, List dataList) { + private void setSheetElecData(List> sheetsList, String name, List dataList,String lang) { // 创建参数对象(用来设定excel的sheet1内容等信息) ExportParams userExportParams = new ExportParams(); // 设置sheet得名称 @@ -1034,13 +1039,25 @@ public class OpenStationServiceImpl implements OpenStationService { // title的参数为ExportParams类型,目前仅仅在ExportParams中设置了sheetName userExportMap.put("title", userExportParams); // 模版导出对应得实体类型 - userExportMap.put("entity", PcsElecData.class); - // sheet1中要填充得数据 - userExportMap.put("data", dataList); + if(RedisKeyConstant.User.EN_US.equals(lang)){ + userExportMap.put("entity", PcsElecDataEn.class); + List enList=new ArrayList<>(); + dataList.stream().forEach(s->{ + PcsElecDataEn en = new PcsElecDataEn(); + BeanUtils.copyProperties(s, en); + enList.add(en); + }); + // sheet1中要填充得数据 + userExportMap.put("data", enList); + }else{ + userExportMap.put("entity", PcsElecData.class); + // sheet1中要填充得数据 + userExportMap.put("data", dataList); + } sheetsList.add(userExportMap); } - private void setSheetEarningsData(List> sheetsList, String name, List dataList) { + private void setSheetEarningsData(List> sheetsList, String name, List dataList,String lang) { // 创建参数对象(用来设定excel的sheet1内容等信息) ExportParams userExportParams = new ExportParams(); // 设置sheet得名称 @@ -1050,9 +1067,21 @@ public class OpenStationServiceImpl implements OpenStationService { // title的参数为ExportParams类型,目前仅仅在ExportParams中设置了sheetName userExportMap.put("title", userExportParams); // 模版导出对应得实体类型 - userExportMap.put("entity", EarningsCalculateData.class); - // sheet1中要填充得数据 - userExportMap.put("data", dataList); + if(RedisKeyConstant.User.EN_US.equals(lang)){ + userExportMap.put("entity", EarningsCalculateDataEn.class); + List enList=new ArrayList<>(); + dataList.stream().forEach(s->{ + EarningsCalculateDataEn en = new EarningsCalculateDataEn(); + BeanUtils.copyProperties(s, en); + enList.add(en); + }); + // sheet1中要填充得数据 + userExportMap.put("data", enList); + }else{ + userExportMap.put("entity", EarningsCalculateData.class); + // sheet1中要填充得数据 + userExportMap.put("data", dataList); + } sheetsList.add(userExportMap); } } diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/PlanningCurveIssueServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/PlanningCurveIssueServiceImpl.java index e0bf446..dc3706a 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/PlanningCurveIssueServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/PlanningCurveIssueServiceImpl.java @@ -7,6 +7,7 @@ import com.ho.business.entity.*; import com.ho.business.feignclient.UserFeignClient; import com.ho.business.mapper.PlanningCurveIssueMapper; import com.ho.business.mapper.PlanningCurveMapper; +import com.ho.business.service.DynamicConfigService; import com.ho.business.service.PlanningCurveIssueService; import com.ho.business.vo.DeviceTransfer; import com.ho.business.vo.resp.planningCurve.PlanningIssueQueryVo; @@ -18,6 +19,7 @@ import com.ho.common.tools.service.RedisService; import com.ho.datacollect.api.constant.DataCollectConstant; import com.ho.user.api.entity.SysUser; import com.ho.user.api.vo.req.QueryUserReqVO; +import jodd.util.StringUtil; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -42,6 +44,9 @@ public class PlanningCurveIssueServiceImpl implements PlanningCurveIssueService @Autowired private PlanningCurveMapper planningMapper; + @Autowired + private DynamicConfigService dynamicConfigService; + @Override public List> getIssueDevices(PlanningIssueDevice issueDevice) { return issueMapper.getIssueDevices(issueDevice); @@ -358,21 +363,27 @@ public class PlanningCurveIssueServiceImpl implements PlanningCurveIssueService planCurveOperationRecordReq.setLatestPlanningCurve(lastestOperateId); //获取电站的上一次计划曲线模板id String previousOperateId = null; - List result = issueMapper.getPlanCurveOperationList(String.valueOf(planCurveOperationRecordReq.getStationId())); + List result = issueMapper.getPlanCurveOperationList(String.valueOf(planCurveOperationRecordReq.getStationId()),null); //取成功下发的操作记录 result = result.stream().filter(e ->1==e.getStatus()).collect(Collectors.toList()); if(result.size()>0){ previousOperateId = result.get(0).getLatestPlanningCurve(); } planCurveOperationRecordReq.setPreviousPlanningCurve(previousOperateId); - + // 英文字段处理 + if(StringUtil.isNotBlank(planCurveOperationRecordReq.getOperateContent())){ + planCurveOperationRecordReq.setOperateContentEn(dynamicConfigService.getNameEn(planCurveOperationRecordReq.getOperateContent())); + } + if(StringUtil.isNotBlank(planCurveOperationRecordReq.getOperateResult())){ + planCurveOperationRecordReq.setOperateResultEn(dynamicConfigService.getNameEn(planCurveOperationRecordReq.getOperateResult())); + } //插入操作记录 issueMapper.planCurveOperationRecord(planCurveOperationRecordReq); } @Override - public List getPlanCurveOperationList(String stationId) { - List result = issueMapper.getPlanCurveOperationList(stationId); + public List getPlanCurveOperationList(String stationId,String lang) { + List result = issueMapper.getPlanCurveOperationList(stationId,lang); return result; } diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/PlanningCurveServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/PlanningCurveServiceImpl.java index ebe5048..6739fe0 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/PlanningCurveServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/PlanningCurveServiceImpl.java @@ -10,10 +10,12 @@ import com.ho.business.entity.PlanningCurveTemplate; import com.ho.business.entity.Station; import com.ho.business.mapper.PlanningCurveMapper; import com.ho.business.mapper.PlanningCurveTacticsMapper; +import com.ho.business.service.DynamicConfigService; import com.ho.business.service.PlanningCurveService; import com.ho.business.service.StationService; import com.ho.common.tools.constant.DefineConstant; import com.ho.common.tools.entity.UserDetailRespVO; +import jodd.util.StringUtil; import lombok.extern.slf4j.Slf4j; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.*; @@ -48,6 +50,9 @@ public class PlanningCurveServiceImpl implements PlanningCurveService { @Autowired private PlanningCurveTacticsMapper planningCurveTacticsMapper; + @Autowired + private DynamicConfigService dynamicConfigService; + @Override public List> getPlanningCurveTemplates(PlanningCurveTemplate template) { return planningMapper.getPlanningCurveTemplates(template); @@ -62,6 +67,11 @@ public class PlanningCurveServiceImpl implements PlanningCurveService { try { if (null != template) { + if(StringUtil.isNotBlank(template.getTemplateName())){ + // 摸版名字英文处理 + template.setTemplateNameEn(dynamicConfigService.getNameEn(template.getTemplateName())); + } + if (template.getPlanningCurves().size() <= 0) { result.put("code", 500); result.put("msg", DefineConstant.PeakShaving.TEMPLATE_CHECK_SIZE); @@ -101,6 +111,10 @@ public class PlanningCurveServiceImpl implements PlanningCurveService { result.put("msg", DefineConstant.PeakShaving.EDIT_TEMPLATE_SUCCESS); try { if (null != template && null != template.getTemId()) { + if(StringUtil.isNotBlank(template.getTemplateName())){ + // 摸版名字英文处理 + template.setTemplateNameEn(dynamicConfigService.getNameEn(template.getTemplateName())); + } Integer templateId = template.getTemId(); Map check = this.checkData(template, templateId); if (null != check) { diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/PointDemoServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/PointDemoServiceImpl.java index bcc9d4e..a4d643f 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/PointDemoServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/PointDemoServiceImpl.java @@ -23,6 +23,7 @@ import com.ho.business.vo.req.configure.*; import com.ho.business.vo.resp.point.*; import com.ho.common.tools.constant.CommonConstant; import com.ho.common.tools.constant.DefineConstant; +import com.ho.common.tools.constant.RedisKeyConstant; import com.ho.common.tools.constant.TableConstant; import com.ho.common.tools.entity.PointCurveSrcCol; import com.ho.common.tools.exception.BaseResponseCode; @@ -108,6 +109,9 @@ public class PointDemoServiceImpl implements PointDemoService { @Autowired PlanningCurveService planningService; + @Autowired + DynamicConfigService dynamicConfigService; + @Override public List getPointList(PointReq pointReq) { Integer stationId = pointReq.getStationId(); @@ -121,13 +125,13 @@ public class PointDemoServiceImpl implements PointDemoService { return new ArrayList<>(); } if (srcId != null) { - deviceInfo = deviceService.selectByStationIdAndSrcId(stationId, srcId); + deviceInfo = deviceService.selectByStationIdAndSrcIdAndLng(stationId, srcId,pointReq.getLang()); if (deviceInfo != null && CommonConstant.ONE.equals(deviceInfo.getVirtual())) { realSrcId = deviceInfo.getFromId(); virtualDevice = true; virtualId = deviceInfo.getSrcId(); String deviceName = deviceInfo.getDeviceName(); - deviceInfo = deviceService.selectByStationIdAndSrcId(stationId, realSrcId); + deviceInfo = deviceService.selectByStationIdAndSrcIdAndLng(stationId, realSrcId,pointReq.getLang()); deviceInfo.setDeviceName(deviceName); } }else{ @@ -171,6 +175,7 @@ public class PointDemoServiceImpl implements PointDemoService { } deviceTypeColReqVO.setName("".equals(pointReq.getName()) ? null : pointReq.getName()); deviceTypeColReqVO.setSensType(pointReq.getSensType()); + deviceTypeColReqVO.setLang(pointReq.getLang()); //增加单位 List deviceTypeCols = modelDeviceService.selectByDeviceTypeList(deviceTypeColReqVO); Map deviceColMap = new HashMap<>(); @@ -400,7 +405,7 @@ public class PointDemoServiceImpl implements PointDemoService { if (device.getVirtual() == 0) { DeviceTypeConfig deviceTypeConfig = deviceTypeConfigService.selectByDeviceType(device.getDeviceType(), device.getGroupId()); if (deviceTypeConfig != null) { - deviceTypeCols = deviceTypeColService.selectByDeviceType(deviceTypeConfig.getDeviceType()); + deviceTypeCols = deviceTypeColService.selectByDeviceType(deviceTypeConfig.getDeviceType(),vo.getLang()); queryPointRespVo.setDeviceTypeName(deviceTypeConfig.getName()); } } else if (device.getVirtual() == 1) { @@ -408,6 +413,7 @@ public class PointDemoServiceImpl implements PointDemoService { VirtualDeviceCol virtualDeviceColReq = new VirtualDeviceCol(); virtualDeviceColReq.setStationId(vo.getStationId()); virtualDeviceColReq.setSrcId(srcId); + virtualDeviceColReq.setLang(vo.getLang()); List virtualColList = virtualDeviceColService.getList(virtualDeviceColReq); for (VirtualDeviceColResp virtualDeviceColResp : virtualColList) { DeviceTypeCol deviceTypeCol = new DeviceTypeCol(); @@ -455,7 +461,7 @@ public class PointDemoServiceImpl implements PointDemoService { if (device.getVirtual() == 0) { DeviceTypeConfig deviceTypeConfig = deviceTypeConfigService.selectByDeviceType(device.getDeviceType(), device.getGroupId()); if (deviceTypeConfig != null) { - deviceTypeCols = deviceTypeColService.selectByDeviceType(deviceTypeConfig.getDeviceType()); + deviceTypeCols = deviceTypeColService.selectByDeviceType(deviceTypeConfig.getDeviceType(),vo.getLang()); queryPointRespVo.setDeviceTypeName(deviceTypeConfig.getName()); } } @@ -661,7 +667,7 @@ public class PointDemoServiceImpl implements PointDemoService { Map colMaxMap = new HashMap<>(); Map colMinMap = new HashMap<>(); for (PointCurveSrcCol pointCurveSrcCol : deviceIdList) { - Device device = deviceService.selectByStationIdAndSrcId(pointCurveReq.getStationId(), pointCurveSrcCol.getSrcId()); + Device device = deviceService.selectByStationIdAndSrcIdAndLng(pointCurveReq.getStationId(), pointCurveSrcCol.getSrcId(),pointCurveReq.getLang()); DeviceTypeConfig deviceTypeConfig = new DeviceTypeConfig(); if (device != null && device.getDeviceType() != null) { deviceTypeConfig = deviceTypeConfigService.selectByDeviceType(device.getDeviceType(), device.getGroupId()); @@ -672,7 +678,7 @@ public class PointDemoServiceImpl implements PointDemoService { srcIdAndDeviceTypeMap.put(pointCurveSrcCol.getSrcId(), device.getDeviceType()); pointCurveSrcCol.setDeviceType(device.getDeviceType()); } - List deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols()); + List deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols(),pointCurveReq.getLang()); Map nameMap = deviceTypeCols.stream().collect(Collectors.toMap(s -> s.getDeviceType() + "_" + s.getCol(), DeviceTypeCol::getColName)); Map maxMap = deviceTypeCols.stream().collect(Collectors.toMap(s -> s.getDeviceType() + "_" + s.getCol(), DeviceTypeCol::getMaxValue)); Map minMap = deviceTypeCols.stream().collect(Collectors.toMap(s -> s.getDeviceType() + "_" + s.getCol(), DeviceTypeCol::getMinValue));; @@ -814,12 +820,12 @@ public class PointDemoServiceImpl implements PointDemoService { Map colMinMap = new HashMap<>(); for (PointCurveSrcCol pointCurveSrcCol : deviceIdList) { - Device device = deviceService.selectByStationIdAndSrcId(pointCurveReq.getStationId(), pointCurveSrcCol.getSrcId()); + Device device = deviceService.selectByStationIdAndSrcIdAndLng(pointCurveReq.getStationId(), pointCurveSrcCol.getSrcId(),pointCurveReq.getLang()); DeviceTypeConfig deviceTypeConfig = new DeviceTypeConfig(); if (device != null && device.getDeviceType() != null) { //若是虚拟设备,则取来自的真实设备 if (device.getSrcId() < 0) { - device = deviceService.selectByStationIdAndSrcId(pointCurveReq.getStationId(), device.getFromId()); + device = deviceService.selectByStationIdAndSrcIdAndLng(pointCurveReq.getStationId(), device.getFromId(),pointCurveReq.getLang()); pointCurveSrcCol.setSrcId(device.getSrcId()); } pointCurveSrcCol.setDeviceName(device.getDeviceName()); @@ -831,7 +837,7 @@ public class PointDemoServiceImpl implements PointDemoService { srcIdAndDeviceTypeMap.put(pointCurveSrcCol.getSrcId(), device.getDeviceType()); pointCurveSrcCol.setDeviceType(device.getDeviceType()); } - List deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols()); + List deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols(),pointCurveReq.getLang()); Map nameMap = deviceTypeCols.stream().collect(Collectors.toMap(s -> s.getDeviceType() + "_" + s.getCol(), DeviceTypeCol::getColName)); Map maxMap = deviceTypeCols.stream().collect(Collectors.toMap(s -> s.getDeviceType() + "_" + s.getCol(), DeviceTypeCol::getMaxValue)); Map minMap = deviceTypeCols.stream().collect(Collectors.toMap(s -> s.getDeviceType() + "_" + s.getCol(), DeviceTypeCol::getMinValue));; @@ -943,10 +949,10 @@ public class PointDemoServiceImpl implements PointDemoService { // srcIdAndNameMap.put(id, device.getDeviceName()); // srcIdAndDeviceTypeMap.put(id, device.getDeviceType()); // } - Device device = deviceService.selectByStationIdAndSrcId(pointCurveReq.getStationId(), pointCurveSrcCol.getSrcId()); + Device device = deviceService.selectByStationIdAndSrcIdAndLng(pointCurveReq.getStationId(), pointCurveSrcCol.getSrcId(),pointCurveReq.getLang()); Integer realSrcId = device.getFromId(); if (device != null && device.getVirtual() == 1) { - device = deviceService.selectByStationIdAndSrcId(pointCurveReq.getStationId(), device.getFromId()); + device = deviceService.selectByStationIdAndSrcIdAndLng(pointCurveReq.getStationId(), device.getFromId(),pointCurveReq.getLang()); //此时把 pointCurveSrcCol 的设备id设置为真实设备id pointCurveSrcCol.setSrcId(realSrcId); } @@ -982,7 +988,7 @@ public class PointDemoServiceImpl implements PointDemoService { List yxCols = new ArrayList<>(); List ycCols = new ArrayList<>(); for (String col : cols) { - DeviceTypeCol deviceTypeCol = deviceTypeColService.selectTypeAndCol(col, device.getDeviceType()); + DeviceTypeCol deviceTypeCol = deviceTypeColService.selectTypeAndCol(col, device.getDeviceType(),pointCurveReq.getLang()); if (deviceTypeCol != null) { if (CommonConstant.ONE.equals(pointCurveReq.getIsOriginal())) { yxCols.add(col); @@ -1123,7 +1129,7 @@ public class PointDemoServiceImpl implements PointDemoService { if (pointCurveResp.getSrcId().equals(pointCurveSrcCol.getSrcId())) { Device device = deviceService.selectByStationIdAndSrcId(pointCurveReq.getStationId(), pointCurveSrcCol.getSrcId()); //根据deviceType和col进行在deviceTypeCol表 - DeviceTypeCol deviceTypeCol = deviceTypeColService.selectTypeAndCol(pointCurveResp.getCol(), device.getDeviceType()); + DeviceTypeCol deviceTypeCol = deviceTypeColService.selectTypeAndCol(pointCurveResp.getCol(), device.getDeviceType(),pointCurveReq.getLang()); if (deviceTypeCol != null) { pointCurveResp.setUnit(deviceTypeCol.getUnit()); pointCurveResp.setColName(deviceTypeCol.getColName()); @@ -1141,7 +1147,7 @@ public class PointDemoServiceImpl implements PointDemoService { point.setCol(pointCurveResp.getCol()); point.setDeviceName(srcIdAndNameMap.get(pointCurveResp.getSrcId())); //根据deviceType 和col进行查询colName - DeviceTypeCol deviceTypeCol = deviceTypeColService.selectTypeAndCol(pointCurveResp.getCol(), deviceType); + DeviceTypeCol deviceTypeCol = deviceTypeColService.selectTypeAndCol(pointCurveResp.getCol(), deviceType,pointCurveReq.getLang()); point.setColName(deviceTypeCol.getColName()); point.setStaticCurveList(new ArrayList<>()); point.setUnit(deviceTypeCol.getUnit()); @@ -1162,7 +1168,7 @@ public class PointDemoServiceImpl implements PointDemoService { pointCurveResp.setCol(col); pointCurveResp.setDeviceName(srcIdAndNameMap.get(pointCurveSrcCol.getSrcId())); //根据deviceType 和col进行查询colName - deviceTypeCol = deviceTypeColService.selectTypeAndCol(pointCurveResp.getCol(), deviceType); + deviceTypeCol = deviceTypeColService.selectTypeAndCol(pointCurveResp.getCol(), deviceType,pointCurveReq.getLang()); pointCurveResp.setColName(deviceTypeCol.getColName()); pointCurveResp.setStaticCurveList(new ArrayList<>()); pointCurveResp.setUnit(deviceTypeCol.getUnit()); @@ -1363,7 +1369,12 @@ public class PointDemoServiceImpl implements PointDemoService { } } List titleList = new ArrayList<>(); - String time = DefineConstant.PointDemo.TIME; + String time; + if(RedisKeyConstant.User.EN_US.equals(pointCurveReq.getLang())){ + time = DefineConstant.PointDemo.TIME_EN; + }else{ + time = DefineConstant.PointDemo.TIME; + } if (!CommonConstant.ONE.equals(pointCurveReq.getPageType())) { titleList.add(time); } @@ -1550,12 +1561,12 @@ public class PointDemoServiceImpl implements PointDemoService { Map colNameMap = new HashMap<>(); for (PointCurveSrcCol pointCurveSrcCol : deviceIdList) { - Device device = deviceService.selectByStationIdAndSrcId(pointCurveReq.getStationId(), pointCurveSrcCol.getSrcId()); + Device device = deviceService.selectByStationIdAndSrcIdAndLng(pointCurveReq.getStationId(), pointCurveSrcCol.getSrcId(),pointCurveReq.getLang()); DeviceTypeConfig deviceTypeConfig = new DeviceTypeConfig(); if (device != null && device.getDeviceType() != null) { //若是虚拟设备,则取来自的真实设备 if (device.getSrcId() < 0) { - device = deviceService.selectByStationIdAndSrcId(pointCurveReq.getStationId(), device.getFromId()); + device = deviceService.selectByStationIdAndSrcIdAndLng(pointCurveReq.getStationId(), device.getFromId(),pointCurveReq.getLang()); pointCurveSrcCol.setSrcId(device.getSrcId()); } pointCurveSrcCol.setDeviceName(device.getDeviceName()); @@ -1567,7 +1578,7 @@ public class PointDemoServiceImpl implements PointDemoService { srcIdAndDeviceTypeMap.put(pointCurveSrcCol.getSrcId(), device.getDeviceType()); pointCurveSrcCol.setDeviceType(device.getDeviceType()); } - List deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols()); + List deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols(),pointCurveReq.getLang()); Map nameMap = deviceTypeCols.stream().collect(Collectors.toMap(s -> s.getDeviceType() + "_" + s.getCol(), DeviceTypeCol::getColName)); colNameMap.putAll(nameMap); } @@ -1762,12 +1773,12 @@ public class PointDemoServiceImpl implements PointDemoService { Map colNameMap = new HashMap<>(); for (PointCurveSrcCol pointCurveSrcCol : deviceIdList) { - Device device = deviceService.selectByStationIdAndSrcId(pointCurveReq.getStationId(), pointCurveSrcCol.getSrcId()); + Device device = deviceService.selectByStationIdAndSrcIdAndLng(pointCurveReq.getStationId(), pointCurveSrcCol.getSrcId(),pointCurveReq.getLang()); DeviceTypeConfig deviceTypeConfig = new DeviceTypeConfig(); if (device != null && device.getDeviceType() != null) { //若是虚拟设备,则取来自的真实设备 if (device.getSrcId() < 0) { - device = deviceService.selectByStationIdAndSrcId(pointCurveReq.getStationId(), device.getFromId()); + device = deviceService.selectByStationIdAndSrcIdAndLng(pointCurveReq.getStationId(), device.getFromId(),pointCurveReq.getLang()); pointCurveSrcCol.setSrcId(device.getSrcId()); } pointCurveSrcCol.setDeviceName(device.getDeviceName()); @@ -1779,7 +1790,7 @@ public class PointDemoServiceImpl implements PointDemoService { srcIdAndDeviceTypeMap.put(pointCurveSrcCol.getSrcId(), device.getDeviceType()); pointCurveSrcCol.setDeviceType(device.getDeviceType()); } - List deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols()); + List deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols(),pointCurveReq.getLang()); Map nameMap = deviceTypeCols.stream().collect(Collectors.toMap(s -> s.getDeviceType() + "_" + s.getCol(), DeviceTypeCol::getColName)); colNameMap.putAll(nameMap); } diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/StationHomeServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/StationHomeServiceImpl.java index abd5073..b2ec14a 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/StationHomeServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/StationHomeServiceImpl.java @@ -33,6 +33,7 @@ import com.ho.business.vo.resp.station.ActiveReactivePower; import com.ho.business.vo.resp.station.NewRealTimeCurveVo; import com.ho.common.tools.constant.CommonConstant; import com.ho.common.tools.constant.DefineConstant; +import com.ho.common.tools.constant.RedisKeyConstant; import com.ho.common.tools.entity.PointCurveSrcCol; import com.ho.common.tools.exception.BaseResponseCode; import com.ho.common.tools.exception.BusinessException; @@ -297,7 +298,7 @@ public class StationHomeServiceImpl implements StationHomeService { vo.setDeviceName(deviceRespVO.getDeviceName()); if (pointTableData != null) { //BMS过滤超过最大最小值的数据 - DeviceTypeCol deviceTypeCol = deviceTypeColService.selectTypeAndCol(socPowerData.getDeviceIdList().get(0).getCols().get(0), deviceRespVO.getDeviceType()); + DeviceTypeCol deviceTypeCol = deviceTypeColService.selectTypeAndCol(socPowerData.getDeviceIdList().get(0).getCols().get(0), deviceRespVO.getDeviceType(),null); BigDecimal maxValue = deviceTypeCol.getMaxValue(); BigDecimal minValue = deviceTypeCol.getMinValue(); if(maxValue!= null && minValue!= null){ @@ -554,7 +555,7 @@ public class StationHomeServiceImpl implements StationHomeService { if (cols.isEmpty()) { cols.add(compListByType.get(0).getDeviceCol()); } - DeviceTypeCol deviceTypeCol = deviceTypeColService.selectTypeAndCol(cols.get(0), deviceValue.getDeviceType()); + DeviceTypeCol deviceTypeCol = deviceTypeColService.selectTypeAndCol(cols.get(0), deviceValue.getDeviceType(),null); deviceColData.setSensType(deviceTypeCol.getSensType()); pointCurveSrcCol.setCols(cols); deviceIdList.add(pointCurveSrcCol); @@ -641,9 +642,19 @@ public class StationHomeServiceImpl implements StationHomeService { //计算运行天数 String operationDayStr = null; if (station.getStatus().equals(CommonConstant.TWO)) { - operationDayStr = DefineConstant.StationHome.BUILDING; + if(RedisKeyConstant.User.EN_US.equals(req.getLang())){ + //切换为英文 + operationDayStr = DefineConstant.StationHome.BUILDING_EN; + }else{ + operationDayStr = DefineConstant.StationHome.BUILDING; + } } else if (station.getStatus().equals(CommonConstant.THREE)) { - operationDayStr = DefineConstant.StationHome.PROPOSED; + if(RedisKeyConstant.User.EN_US.equals(req.getLang())){ + //切换为英文 + operationDayStr = DefineConstant.StationHome.PROPOSED_EN; + }else{ + operationDayStr = DefineConstant.StationHome.PROPOSED; + } } else { long operationDays = DateUtil.between(station.getGridTime(), new Date(), DateUnit.DAY); operationDayStr = Long.toString(operationDays); diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/StationServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/StationServiceImpl.java index 671664d..bb49fce 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/StationServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/StationServiceImpl.java @@ -10,7 +10,7 @@ import com.ho.business.entity.*; import com.ho.business.feignclient.FileCenterFeignClient; import com.ho.business.feignclient.FlowFeignClient; import com.ho.business.feignclient.UserFeignClient; -import com.ho.business.mapper.TranslateNationMapper; +import com.ho.business.mapper.TranslateNameMapper; import com.ho.business.mapper.TranslateProvinceMapper; import com.ho.business.mapper.StationMapper; import com.ho.business.service.*; @@ -100,9 +100,6 @@ public class StationServiceImpl implements StationService { @Autowired TranslateProvinceMapper translateProvinceMapper; - @Autowired - TranslateNationMapper translateNationMapper; - @Value("${station.timeDifference}") Integer minute; diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/VirtualDeviceColServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/VirtualDeviceColServiceImpl.java index b73a438..6cbff65 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/VirtualDeviceColServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/VirtualDeviceColServiceImpl.java @@ -119,7 +119,7 @@ public class VirtualDeviceColServiceImpl implements VirtualDeviceColService { } virtualDeviceColList = new ArrayList<>(); String deviceType = deviceValue.getDeviceType().replace(UNDERLINE + vo.getModelStationId(), UNDERLINE + vo.getStationId()); - List deviceTypeCols = deviceTypeColService.selectByDeviceType(deviceType); + List deviceTypeCols = deviceTypeColService.selectByDeviceType(deviceType,null); Map> modelMap = deviceTypeCols.stream().collect(Collectors.groupingBy(DeviceTypeCol::getCol)); //根据col进行数据对比,更换device_col_id for (VirtualDeviceColResp virtualDeviceColResp : virtualDeviceColRespList) { diff --git a/business-service-dao/src/main/resources/mapper/CurveConfigMapper.xml b/business-service-dao/src/main/resources/mapper/CurveConfigMapper.xml index 5065a55..d52077e 100644 --- a/business-service-dao/src/main/resources/mapper/CurveConfigMapper.xml +++ b/business-service-dao/src/main/resources/mapper/CurveConfigMapper.xml @@ -35,9 +35,14 @@ select @@ -81,7 +87,14 @@ select - + + + + + + + + from device_type_col @@ -103,7 +118,14 @@ select - + + + + + + + + from device_type_col @@ -197,7 +226,14 @@ select - + + + + + + + + from his_curve_relate diff --git a/business-service-dao/src/main/resources/mapper/PlanningCurveIssueMapper.xml b/business-service-dao/src/main/resources/mapper/PlanningCurveIssueMapper.xml index 94e755f..b3eec32 100644 --- a/business-service-dao/src/main/resources/mapper/PlanningCurveIssueMapper.xml +++ b/business-service-dao/src/main/resources/mapper/PlanningCurveIssueMapper.xml @@ -6,12 +6,29 @@ @@ -110,11 +127,12 @@ insert into planning_curve_operation_record - (user_id,user_name,operate_time,operate_content,operate_result,effective_time,status,previous_planning_curve,latest_planning_curve,station_id) - values ( - #{condition.userId},#{condition.userName},#{condition.operateTime},#{condition.operateContent},#{condition.operateResult}, - #{condition.effectiveTime},#{condition.status},#{condition.previousPlanningCurve},#{condition.latestPlanningCurve},#{condition.stationId} - ) + (user_id,user_name,operate_time,operate_content,operate_content_en,operate_result,operate_result_en,effective_time,status,previous_planning_curve,latest_planning_curve,station_id) + values ( + #{condition.userId},#{condition.userName},#{condition.operateTime},#{condition.operateContent},#{condition.operateContentEn}, + #{condition.operateResult},#{condition.operateResultEn}, + #{condition.effectiveTime},#{condition.status},#{condition.previousPlanningCurve},#{condition.latestPlanningCurve},#{condition.stationId} + ) @@ -125,8 +143,25 @@ @@ -67,22 +76,22 @@ - insert into planning_curve_template ( id,template_no,template_name, - - station_id, - - - group_id, - - income,status,p,capacity,soc_upper,soc_lower,create_time ) - values( #{temId},#{templateNo},#{templateName}, - - #{stationId}, - - - #{groupId}, - - #{income},#{status},#{temP},#{capacity},#{socUpper},#{socLower},sysdate() ) + insert into planning_curve_template ( id,template_no,template_name,template_name_en, + + station_id, + + + group_id, + + income,status,p,capacity,soc_upper,soc_lower,create_time ) + values( #{temId},#{templateNo},#{templateName},#{templateNameEn}, + + #{stationId}, + + + #{groupId}, + + #{income},#{status},#{temP},#{capacity},#{socUpper},#{socLower},sysdate() ) @@ -102,6 +111,9 @@ template_name = #{templateName}, + + template_name_en = #{templateNameEn}, + - - com.hoenergy - flowable-src - ${flowable-src.version} - system - ${project.basedir}/src/main/resources/lib/flowable-src-1.0.jar - - - com.hoenergy - common-tools - - - com.hoenergy - flowable-center-dao - - - + + + + + + + + + + + + + + + + + com.hoenergy flowable-center-dao diff --git a/flowable-center/src/main/java/com/ho/flow/controller/EventController.java b/flowable-center/src/main/java/com/ho/flow/controller/EventController.java index ab0362f..fadd636 100644 --- a/flowable-center/src/main/java/com/ho/flow/controller/EventController.java +++ b/flowable-center/src/main/java/com/ho/flow/controller/EventController.java @@ -31,6 +31,7 @@ import com.ho.flow.vo.req.event.EventWorkOrder; import com.ho.flow.vo.resp.event.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import jodd.util.StringUtil; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.Row; @@ -101,6 +102,7 @@ public class EventController { //@LogAnnotation(title = "告警管理", action = "分页查询告警信息") public DataResult> page(@RequestBody @Valid EventReqPageVO vo, HttpServletRequest request) { + vo.setLang(request.getHeader(RedisKeyConstant.User.LANG)); //如果有srcIdList ,则根据这个查询deviceType List srcIdList = vo.getSrcIdList(); @@ -224,6 +226,7 @@ public class EventController { //@LogAnnotation(title = "告警管理", action = "分页查询告警历史信息") public DataResult> hispage(@RequestBody @Valid EventReqPageVO vo, HttpServletRequest request) { + vo.setLang(request.getHeader(RedisKeyConstant.User.LANG)); DataResult> result = DataResult.success(); String token = request.getHeader(RedisKeyConstant.User.ACCESS_TOKEN); SimpleUser user = redisService.getSimpleUserByToken(token); @@ -418,6 +421,10 @@ public class EventController { request) { String token = request.getHeader(RedisKeyConstant.User.ACCESS_TOKEN); SimpleUser user = redisService.getSimpleUserByToken(token); + String lang = request.getHeader(RedisKeyConstant.User.LANG); + list.stream().forEach(s->{ + s.setLang(lang); + }); List eventRespVOList = eventService.dropDownBatchList(user, list); return DataResult.success(eventRespVOList); } @@ -517,6 +524,7 @@ public class EventController { @PostMapping("/exportEvnData") @ApiOperation(value = "导出实时告警数据") public void exportEvnData(@RequestBody @Valid EventReqPageVO vo, HttpServletRequest request, HttpServletResponse response) { + vo.setLang(request.getHeader(RedisKeyConstant.User.LANG)); //如果有srcIdList ,则根据这个查询deviceType List srcIdList = vo.getSrcIdList(); if (srcIdList != null && !srcIdList.isEmpty()) { @@ -789,4 +797,17 @@ public class EventController { return DataResult.success(result); } + + @PostMapping("updatePointNameEn") + @ApiOperation(value = "修改表中点名称英文") + @TokenIgnore + public DataResult updatePointNameEn(String tableName,String name,String nameEn) { + int count = 0; + if(StringUtil.isNotBlank(tableName) + &&StringUtil.isNotBlank(name) + &&StringUtil.isNotBlank(nameEn)){ + count = eventService.updatePointNameEn(tableName,name,nameEn); + } + return DataResult.success(count); + } } diff --git a/flowable-center/src/main/java/com/ho/flow/service/FlowOutApiService.java b/flowable-center/src/main/java/com/ho/flow/service/FlowOutApiService.java new file mode 100644 index 0000000..ce290ad --- /dev/null +++ b/flowable-center/src/main/java/com/ho/flow/service/FlowOutApiService.java @@ -0,0 +1,33 @@ +package com.ho.flow.service; + +import com.alibaba.fastjson.JSONObject; +import com.ho.common.tools.exception.DataResult; +import com.ho.flow.vo.AlarmConfig; +import com.ho.flow.vo.Event; +import com.ho.flow.vo.req.AlarmConfig.AlarmConfigQueryVo; +import com.ho.flow.vo.req.event.EventAddReq; +import com.ho.flow.vo.resp.StationStatusRespVO; +import com.ho.flow.vo.resp.event.EventTypeAndLevelsReqVO; + +import java.util.List; +import java.util.Map; + +/** + * @author kerwin flowable-src-1.0.jar原有 + */ +public interface FlowOutApiService { + + Map> matchEventRecords(EventAddReq eventAddReq, JSONObject dataSet, Map stationConfigMap, Map groupConfigMap); + + Boolean isRecoveryDevice(AlarmConfigQueryVo alarmConfigQueryVo); + + List isNormalStation(AlarmConfigQueryVo alarmConfigQueryVo); + + void polymerizationAlarm(EventAddReq eventAddReq, List groupAlarmConfigs, List stationAlarmConfigs); + + Event getNotRecovered(AlarmConfigQueryVo stationStatusReq); + + EventTypeAndLevelsReqVO getAlarmDataStatistics(AlarmConfigQueryVo stationStatusReq); + + DataResult addEvents(List list); +} diff --git a/flowable-center/src/main/java/com/ho/flow/service/impl/FlowOutApiServiceImpl.java b/flowable-center/src/main/java/com/ho/flow/service/impl/FlowOutApiServiceImpl.java new file mode 100644 index 0000000..b20a0b0 --- /dev/null +++ b/flowable-center/src/main/java/com/ho/flow/service/impl/FlowOutApiServiceImpl.java @@ -0,0 +1,711 @@ +package com.ho.flow.service.impl; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.lang.Snowflake; +import com.alibaba.fastjson.JSONObject; +import com.ho.business.entity.Station; +import com.ho.business.vo.DeviceTransfer; +import com.ho.common.tools.constant.CommonConstant; +import com.ho.common.tools.entity.UserDetailRespVO; +import com.ho.common.tools.exception.DataResult; +import com.ho.common.tools.service.RedisService; +import com.ho.flow.entity.process.MovementDTO; +import com.ho.flow.feignclient.BusinessFeignClient; +import com.ho.flow.mapper.AlarmConfigMapper; +import com.ho.flow.mapper.EventMapper; +import com.ho.flow.monitor.EventToProcessMonitor; +import com.ho.flow.service.AlarmConfigService; +import com.ho.flow.service.EventService; +import com.ho.flow.service.FlowOutApiService; +import com.ho.flow.service.SendSmsConfigService; +import com.ho.flow.vo.AlarmConfig; +import com.ho.flow.vo.Event; +import com.ho.flow.vo.req.AlarmConfig.AlarmConfigQueryVo; +import com.ho.flow.vo.req.SendSmsConfig.SendSmsConfigQueryReq; +import com.ho.flow.vo.req.event.EventAddReq; +import com.ho.flow.vo.resp.StationStatusRespVO; +import com.ho.flow.vo.resp.event.EventTypeAndLevelsReqVO; +import org.apache.commons.lang.time.DateFormatUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author kerwin 原有flowable-src-1.0.jar + */ +@Service +@ConditionalOnProperty( + name = {"switch.usedDefaultAlarmLogic"}, + havingValue = "true", + matchIfMissing = true +) +public class FlowOutApiServiceImpl implements FlowOutApiService { + private static final Logger log = LoggerFactory.getLogger(FlowOutApiServiceImpl.class); + @Autowired + Snowflake snowflake; + @Autowired + RedisService redisService; + @Autowired + EventMapper eventMapper; + @Autowired + AlarmConfigMapper alarmConfigMapper; + @Autowired + BusinessFeignClient businessFeignClient; + @Autowired + SendSmsConfigService sendSmsConfigService; + @Autowired + AlarmConfigService alarmConfigService; + @Autowired + EventService eventService; + @Value("${spring.activiti.flag}") + private Integer flag; + EventToProcessMonitor monitor = new EventToProcessMonitor(); + + public FlowOutApiServiceImpl() { + } + + public Map> matchEventRecords(EventAddReq eventAddReq, JSONObject dataSet, Map stationConfigMap, Map groupConfigMap) { + Map> resultMap = this.receiveEvent(eventAddReq, dataSet, stationConfigMap, groupConfigMap); + return resultMap; + } + + public Map> receiveEvent(EventAddReq eventAddReq, JSONObject dataSet, Map stationConfigMap, Map groupConfigMap) { + Map> resultMap = new HashMap(); + List events = new ArrayList(); + List updateEvents = new ArrayList(); + List updateEventStatus = new ArrayList(); + Date date = new Date(); + String redisKey = eventAddReq.getDeviceType() + ":" + eventAddReq.getStationId() + ":" + eventAddReq.getSrcId(); + Map hgetall = this.redisService.hgetall(redisKey); + DeviceTransfer deviceTransfer = null; + Iterator var13 = dataSet.entrySet().iterator(); + + while(true) { + while(true) { + String k; + Object v; + AlarmConfig alarmConfig; + do { + do { + if (!var13.hasNext()) { + resultMap.put("updateEvents", updateEvents); + resultMap.put("events", events); + resultMap.put("updateEventStatus", updateEventStatus); + return resultMap; + } + + Map.Entry entry = (Map.Entry)var13.next(); + k = (String)entry.getKey(); + v = entry.getValue(); + } while(v == null); + + alarmConfig = null; + if (stationConfigMap.containsKey(k)) { + alarmConfig = (AlarmConfig)stationConfigMap.get(k); + } else if (groupConfigMap.containsKey(k)) { + alarmConfig = (AlarmConfig)groupConfigMap.get(k); + } + } while(alarmConfig == null); + + Event event = new Event(); + boolean needSave = false; + event.setSensType(alarmConfig.getSensType()); + if (CommonConstant.EventSignal.SIGNAL.equals(alarmConfig.getSensType())) { + needSave = true; + Integer value = (Integer)v; + String info = null; + if (eventAddReq.getDeviceType().contains("communicationStatus")) { + if (CommonConstant.ONE.equals(value)) { + info = alarmConfig.getInfo0(); + event.setIsRecovery(CommonConstant.ONE); + event.setEventLevel(CommonConstant.EventLevel.notice); + } else { + info = alarmConfig.getInfo1(); + event.setIsRecovery(CommonConstant.ZERO); + event.setEventLevel(alarmConfig.getAlarmLevel()); + } + } else if ("communicationStatus".equals(k)) { + if (CommonConstant.ZERO.equals(value)) { + info = alarmConfig.getInfo0(); + event.setIsRecovery(CommonConstant.ZERO); + event.setEventLevel(alarmConfig.getAlarmLevel()); + } else if (CommonConstant.ONE.equals(value)) { + info = alarmConfig.getInfo1(); + event.setIsRecovery(CommonConstant.ONE); + event.setEventLevel(CommonConstant.EventLevel.notice); + } + } else if (CommonConstant.ZERO.equals(value)) { + info = alarmConfig.getInfo0(); + event.setIsRecovery(CommonConstant.ONE); + event.setEventLevel(CommonConstant.EventLevel.notice); + } else if (value > CommonConstant.ZERO) { + info = alarmConfig.getInfo1(); + event.setIsRecovery(CommonConstant.ZERO); + event.setEventLevel(alarmConfig.getAlarmLevel()); + } + + event.setDescription(info); + event.setDescriptionEn(eventService.getNameEn(event.getDescription())); + } else if (CommonConstant.EventSignal.TELEMETER.equals(alarmConfig.getSensType())) { + BigDecimal lowerLimit = alarmConfig.getLowerLimit(); + BigDecimal upperLimit = alarmConfig.getUpperLimit(); + BigDecimal value = new BigDecimal(String.valueOf(v)); + String desc = alarmConfig.getColName() + "恢复"; + if (upperLimit != null && value.compareTo(upperLimit) > 0) { + needSave = true; + desc = alarmConfig.getColName() + " 越上限"; + } + + if (lowerLimit != null && value.compareTo(lowerLimit) < 0) { + needSave = true; + desc = alarmConfig.getColName() + " 越下限"; + } + + event.setIsRecovery(CommonConstant.ONE); + event.setEventLevel(CommonConstant.EventLevel.notice); + if (needSave) { + event.setIsRecovery(CommonConstant.ZERO); + event.setEventLevel(CommonConstant.EventLevel.overLimit); + } + + event.setDescription(desc); + event.setDescriptionEn(eventService.getNameEn(event.getDescription())); + } + + Event eventLast = null; + deviceTransfer = (DeviceTransfer)hgetall.get(k); + if (null != deviceTransfer) { + Long eventId = deviceTransfer.getEventId(); + Integer isRecovery = deviceTransfer.getIsRecovery(); + if (null != isRecovery && null != eventId) { + eventLast = new Event(); + eventLast.setIsRecovery(isRecovery); + eventLast.setId(eventId); + } + } + + needSave = true; + long id; + if (CommonConstant.ONE.equals(event.getIsRecovery())) { + if (null != eventLast && !CommonConstant.ONE.equals(eventLast.getIsRecovery())) { + id = this.snowflake.nextId(); + log.info("new recovery event snowflake id: {},event_level:{},alarmStationId:{},targetDevice:{},deviceType:{},signal:{}", new Object[]{id, event.getEventLevel(), eventAddReq.getStationId(), eventAddReq.getSrcId(), eventAddReq.getDeviceType(), k}); + event.setId(id); + event.setSignal(k); + event.setBeforeEventId(eventLast.getId()); + this.generateAlarm(eventAddReq, v, event); + log.info("new recovery event update redis before:{},redisKey:{},k:{}", new Object[]{this.redisService.hget(redisKey, k), redisKey, k}); + deviceTransfer.setEventId(event.getId()); + deviceTransfer.setIsRecovery(event.getIsRecovery()); + this.redisService.hset(redisKey, k, deviceTransfer); + log.info("new recovery event update redis after:{},redisKey:{},k:{}", new Object[]{this.redisService.hget(redisKey, k), redisKey, k}); + Event conformEvent = new Event(); + conformEvent.setConfirmMan("system"); + conformEvent.setConfirmTime(date); + conformEvent.setId(eventLast.getId()); + conformEvent.setStatus(CommonConstant.ONE); + this.eventMapper.updateByPrimaryKeySelective(conformEvent); + } + } else if (CommonConstant.ZERO.equals(event.getIsRecovery())) { + if (eventLast != null && CommonConstant.ZERO.equals(eventLast.getIsRecovery())) { + eventLast.setValue(new BigDecimal(String.valueOf(v))); + eventLast.setDescription(event.getDescription()); + eventLast.setDescriptionEn(eventService.getNameEn(event.getDescription())); + this.eventMapper.updateBatchById(eventLast); + } else { + id = this.snowflake.nextId(); + log.info("new error event snowflake id: {},event_level:{},alarmStationId:{},targetDevice:{},deviceType:{},signal:{}", new Object[]{id, event.getEventLevel(), eventAddReq.getStationId(), eventAddReq.getSrcId(), eventAddReq.getDeviceType(), k}); + event.setId(id); + event.setSignal(k); + this.generateAlarm(eventAddReq, v, event); + log.info("new error event update redis before:{},redisKey:{},k:{}", new Object[]{this.redisService.hget(redisKey, k), redisKey, k}); + deviceTransfer.setEventId(event.getId()); + deviceTransfer.setIsRecovery(event.getIsRecovery()); + this.redisService.hset(redisKey, k, deviceTransfer); + log.info("new error event update redis after:{},redisKey:{},k:{}", new Object[]{this.redisService.hget(redisKey, k), redisKey, k}); + } + } + } + } + } + + private void generateAlarm(EventAddReq eventAddReq, Object v, Event event) { + event.setGroupId(eventAddReq.getGroupId()); + event.setStationId(eventAddReq.getStationId()); + event.setEventType(CommonConstant.EventType.alarm); + event.setTimeStamp(eventAddReq.getTs()); + event.setTargetDevice(eventAddReq.getSrcId()); + event.setDeviceType(eventAddReq.getDeviceType()); + event.setDeviceTypeId(eventAddReq.getDeviceTypeId()); + event.setStatus(CommonConstant.ZERO); + if (CommonConstant.EventLevel.notice.equals(event.getEventLevel()) || CommonConstant.EventLevel.statusChange.equals(event.getEventLevel()) || CommonConstant.ONE.equals(event.getIsRecovery())) { + event.setStatus(CommonConstant.ONE); + event.setConfirmTime(new Date()); + event.setConfirmMan("system"); + } + + event.setValue(new BigDecimal(String.valueOf(v))); + Date now = new Date(); + event.setCreateTime(new Date()); + event.setUpdateTime(now); + this.eventMapper.insert(event); + } + + public Boolean isRecoveryDevice(AlarmConfigQueryVo alarmConfigQueryVo) { + if (null == alarmConfigQueryVo.getStartTime() || null == alarmConfigQueryVo.getEndTime()) { + alarmConfigQueryVo.setStartTime(DateUtil.format(DateUtil.offsetDay(new Date(), -10), "yyyy-MM-dd")); + alarmConfigQueryVo.setEndTime(DateUtil.format(DateUtil.tomorrow(), "yyyy-MM-dd")); + } + + List eventsList = this.eventMapper.selectByTargetDevice(alarmConfigQueryVo); + log.info("isRecoveryDevice. eventsList.size: {} ", eventsList.size()); + Map> eventList = (Map)eventsList.stream().collect(Collectors.groupingBy(Event::getSignal)); + log.info("isRecoveryDevice. eventList.size: {} ", eventList.size()); + return this.isNormal(eventList); + } + + private boolean isNormal(Map> eventList) { + boolean flag = true; + List events = null; + int eventNum = 0; + int num = 0; + Iterator var6 = eventList.entrySet().iterator(); + + while(var6.hasNext()) { + Map.Entry> map = (Map.Entry)var6.next(); + events = (List)map.getValue(); + if (null != events && events.size() > 0) { + ++eventNum; + if (CommonConstant.ONE.equals(((Event)events.get(0)).getIsRecovery())) { + ++num; + } + } + } + + log.info("isRecoveryDevice. eventNum: {} ,num:{}", eventNum, num); + if (num < eventNum) { + flag = false; + } + + return flag; + } + + public List isNormalStation(AlarmConfigQueryVo alarmConfigQueryVo) { + List resultList = new ArrayList(); + if (null == alarmConfigQueryVo.getStartTime() || null == alarmConfigQueryVo.getEndTime()) { + alarmConfigQueryVo.setStartTime(DateUtil.format(DateUtil.offsetDay(new Date(), -10), "yyyy-MM-dd")); + alarmConfigQueryVo.setEndTime(DateUtil.format(DateUtil.tomorrow(), "yyyy-MM-dd")); + } + + List eventsList = this.eventMapper.selectByTargetDevice(alarmConfigQueryVo); + Map stationStatusMap = new HashMap(); + Map> stationEventMap = (Map)eventsList.stream().collect(Collectors.groupingBy(Event::getStationId)); + Iterator var6 = stationEventMap.entrySet().iterator(); + + List stationStatusRespVO; + while(var6.hasNext()) { + Map.Entry> map = (Map.Entry)var6.next(); + stationStatusRespVO = map.getValue(); + Map> deviceSignalEventMap = (Map)stationStatusRespVO.stream().collect(Collectors.groupingBy((s) -> { + return s.getTargetDevice() + "_" + s.getSignal(); + })); + stationStatusMap.put(map.getKey(), this.isNormal(deviceSignalEventMap)); + } + + DataResult> dataResult = this.businessFeignClient.selectByGroupId(alarmConfigQueryVo.getGroupId()); + List stationList = (List)dataResult.getData(); + stationStatusRespVO = null; + boolean stationStatus = true; + Iterator var10 = stationList.iterator(); + + while(var10.hasNext()) { + Station station = (Station)var10.next(); + StationStatusRespVO vo = new StationStatusRespVO(); + vo.setStationId(station.getId()); + stationStatus = stationStatusMap.get(station.getId()) == null || (Boolean)stationStatusMap.get(station.getId()); + vo.setStationStatus(stationStatus); + resultList.add(vo); + } + + return resultList; + } + + public void polymerizationAlarm(EventAddReq eventAddReq, List groupAlarmConfigs, List stationAlarmConfigs) { + String redisKey = eventAddReq.getDeviceType() + ":" + eventAddReq.getStationId() + ":" + eventAddReq.getSrcId(); + Map hgetall = this.redisService.hgetall(redisKey); + Map groupMapOne = groupAlarmConfigs == null ? new HashMap() : (Map)groupAlarmConfigs.stream().filter((i) -> { + return i.getAlarmLevel() != null && CommonConstant.ONE.equals(i.getAlarmLevel()); + }).collect(Collectors.toMap(AlarmConfig::getCol, (AlarmConfig) -> { + return AlarmConfig; + })); + Map stationMapOne = stationAlarmConfigs == null ? new HashMap() : (Map)stationAlarmConfigs.stream().filter((i) -> { + return i.getAlarmLevel() != null && CommonConstant.ONE.equals(i.getAlarmLevel()); + }).collect(Collectors.toMap(AlarmConfig::getCol, (AlarmConfig) -> { + return AlarmConfig; + })); + Map groupMapTwo = groupAlarmConfigs == null ? new HashMap() : (Map)groupAlarmConfigs.stream().filter((i) -> { + return i.getAlarmLevel() != null && CommonConstant.TWO.equals(i.getAlarmLevel()); + }).collect(Collectors.toMap(AlarmConfig::getCol, (AlarmConfig) -> { + return AlarmConfig; + })); + Map stationMapTwo = stationAlarmConfigs == null ? new HashMap() : (Map)stationAlarmConfigs.stream().filter((i) -> { + return i.getAlarmLevel() != null && CommonConstant.TWO.equals(i.getAlarmLevel()); + }).collect(Collectors.toMap(AlarmConfig::getCol, (AlarmConfig) -> { + return AlarmConfig; + })); + Map groupMapThree = groupAlarmConfigs == null ? new HashMap() : (Map)groupAlarmConfigs.stream().filter((i) -> { + return i.getAlarmLevel() != null && CommonConstant.THREE.equals(i.getAlarmLevel()); + }).collect(Collectors.toMap(AlarmConfig::getCol, (AlarmConfig) -> { + return AlarmConfig; + })); + Map stationMapThree = stationAlarmConfigs == null ? new HashMap() : (Map)stationAlarmConfigs.stream().filter((i) -> { + return i.getAlarmLevel() != null && CommonConstant.THREE.equals(i.getAlarmLevel()); + }).collect(Collectors.toMap(AlarmConfig::getCol, (AlarmConfig) -> { + return AlarmConfig; + })); + Event vo = new Event(); + vo.setStationId(eventAddReq.getStationId()); + vo.setTargetDevice(eventAddReq.getSrcId()); + vo.setSignal("polymerization"); + vo.setEventLevel(CommonConstant.ONE); + if (((Map)stationMapOne).size() != 0 || ((Map)groupMapOne).size() != 0) { + this.commonPolymerizationAlarm(eventAddReq, (Map)stationMapOne, (Map)groupMapOne, hgetall, vo); + } + + vo.setEventLevel(CommonConstant.TWO); + if (((Map)stationMapTwo).size() != 0 || ((Map)groupMapTwo).size() != 0) { + this.commonPolymerizationAlarm(eventAddReq, (Map)stationMapTwo, (Map)groupMapTwo, hgetall, vo); + } + + vo.setEventLevel(CommonConstant.THREE); + if (((Map)stationMapThree).size() != 0 || ((Map)groupMapThree).size() != 0) { + this.commonPolymerizationAlarm(eventAddReq, (Map)stationMapThree, (Map)groupMapThree, hgetall, vo); + } + + } + + private void commonPolymerizationAlarm(EventAddReq eventAddReq, Map stationMap, Map groupMap, Map hgetall, Event vo) { + boolean isError = false; + Event event = new Event(); + isError = this.isError(stationMap, hgetall, isError, event, eventAddReq); + if (!isError && groupMap.size() > 0) { + isError = this.isError(groupMap, hgetall, isError, event, eventAddReq); + } + + String redisKey = "polymerization:" + vo.getStationId() + ":" + vo.getTargetDevice(); + DeviceTransfer eventLast = (DeviceTransfer)this.redisService.hget(redisKey, vo.getEventLevel().toString()); + Integer level = vo.getEventLevel(); + event.setEventLevel(level); + long eventId; + if (null != eventLast) { + if (CommonConstant.ONE.equals(eventLast.getIsRecovery()) && isError) { + event.setStatus(CommonConstant.ZERO); + eventId = this.insertNewEvent(eventAddReq, CommonConstant.ZERO, event); + this.updatePolymerization(redisKey, eventLast, vo.getEventLevel(), CommonConstant.ZERO, eventId); + if (!CommonConstant.THREE.equals(level)) { + this.sendSms(eventAddReq.getStationId(), event.getDescription(), level); + this.sendWorkOrder(event); + } + } else if (CommonConstant.ZERO.equals(eventLast.getIsRecovery()) && !isError) { + List ids = new ArrayList(); + ids.add(eventLast.getEventId()); + UserDetailRespVO userDetail = new UserDetailRespVO(); + userDetail.setUsername("system"); + this.eventMapper.updateByIds(ids, userDetail); + event.setBeforeEventId(eventLast.getEventId()); + event.setConfirmMan("system"); + event.setStatus(CommonConstant.ONE); + event.setConfirmTime(new Date()); + eventId = this.insertNewEvent(eventAddReq, CommonConstant.ONE, event); + this.updatePolymerization(redisKey, eventLast, vo.getEventLevel(), CommonConstant.ONE, eventId); + } + } else if (isError) { + event.setStatus(CommonConstant.ZERO); + eventId = this.insertNewEvent(eventAddReq, CommonConstant.ZERO, event); + eventLast = new DeviceTransfer(); + this.updatePolymerization(redisKey, eventLast, vo.getEventLevel(), CommonConstant.ZERO, eventId); + if (!CommonConstant.THREE.equals(level)) { + this.sendSms(eventAddReq.getStationId(), event.getDescription(), level); + this.sendWorkOrder(event); + } + } + + } + + private void updatePolymerization(String redisKey, DeviceTransfer eventLast, Integer level, Integer recovery, long eventId) { + eventLast.setEventId(eventId); + eventLast.setIsRecovery(recovery); + eventLast.setUpdateTime(new Date()); + this.redisService.hset(redisKey, level.toString(), eventLast); + log.info("updatePolymerization redis:{},{},{}", new Object[]{redisKey, level.toString(), eventLast}); + } + + private void sendWorkOrder(Event event) { + MovementDTO movementDTO = new MovementDTO(); + List events = new ArrayList(); + events.add(event); + movementDTO.setEvents(events); + this.monitor.setEvents(movementDTO); + } + + private long insertNewEvent(EventAddReq eventAddReq, Integer recoveryStatus, Event event) { + long id = this.snowflake.nextId(); + event.setId(id); + event.setGroupId(eventAddReq.getGroupId()); + event.setStationId(eventAddReq.getStationId()); + event.setEventType(CommonConstant.EventType.alarm); + event.setTimeStamp(eventAddReq.getTs()); + event.setTargetDevice(eventAddReq.getSrcId()); + event.setDeviceType(eventAddReq.getDeviceType()); + event.setDeviceTypeId(eventAddReq.getDeviceTypeId()); + event.setSignal("polymerization"); + event.setIsRecovery(recoveryStatus); + event.setCreateTime(new Date()); + List list = new ArrayList(); + list.add(event); + this.eventMapper.insertBatch(list); + return id; + } + + private boolean isError(Map alarmMap, Map hgetall, boolean isError, Event event, EventAddReq eventAddReq) { + String deviceName = eventAddReq.getDeviceName(); + Iterator var9 = alarmMap.entrySet().iterator(); + + while(var9.hasNext()) { + Map.Entry entry = (Map.Entry)var9.next(); + String k = (String)entry.getKey(); + Object obj = hgetall.get(k); + AlarmConfig alarmConfig = (AlarmConfig)entry.getValue(); + if (obj != null) { + if (CommonConstant.EventSignal.SIGNAL.equals(alarmConfig.getSensType())) { + int value; + if (obj instanceof DeviceTransfer) { + DeviceTransfer deviceTransfer = (DeviceTransfer)obj; + value = deviceTransfer.getValue().intValue(); + } else { + value = Integer.parseInt(String.valueOf(obj)); + } + + if (eventAddReq.getDeviceType().contains("communicationStatus")) { + if (!CommonConstant.ONE.equals(value)) { + isError = true; + break; + } + } else if ("communicationStatus".equals(k)) { + if (CommonConstant.ZERO.equals(value)) { + isError = true; + break; + } + } else if (value > CommonConstant.ZERO) { + isError = true; + break; + } + } else if (CommonConstant.EventSignal.TELEMETER.equals(alarmConfig.getSensType())) { + BigDecimal lowerLimit = alarmConfig.getLowerLimit(); + BigDecimal upperLimit = alarmConfig.getUpperLimit(); + DeviceTransfer deviceTransfer = (DeviceTransfer)obj; + BigDecimal value = deviceTransfer.getValue(); + if (upperLimit != null && value.compareTo(upperLimit) > 0) { + isError = true; + break; + } + + if (lowerLimit != null && value.compareTo(lowerLimit) < 0) { + isError = true; + break; + } + } + + event.setEventLevel(alarmConfig.getAlarmLevel()); + } + } + + event.setDescription(deviceName + "设备告警恢复"); + event.setDescriptionEn(eventService.getNameEn(deviceName + "设备告警恢复")); + if (isError) { + event.setDescription(deviceName + "设备告警"); + event.setDescriptionEn(eventService.getNameEn(deviceName + "设备告警")); + } + + return isError; + } + + private void sendSms(Integer stationId, String content, Integer level) { + SendSmsConfigQueryReq vo = new SendSmsConfigQueryReq(); + vo.setStationId(stationId); + vo.setSmsType(CommonConstant.ONE); + vo.setAlarmLevel(String.valueOf(level)); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("siteName", this.getStationName(stationId)); + jsonObject.put("content", content); + vo.setParam(jsonObject); + this.sendSmsConfigService.sendSms(vo); + } + + private String getStationName(Integer stationId) { + String name = ""; + String key = "station:" + stationId; + Station station = null; + if (this.redisService.hasKey(key)) { + station = (Station)this.redisService.get(key); + } else { + DataResult result = this.businessFeignClient.selectByStationId(stationId); + station = (Station)result.getData(); + } + + if (null != station) { + name = station.getName(); + } + + return name; + } + + public Event getNotRecovered(AlarmConfigQueryVo stationStatusReq) { + AlarmConfigQueryVo alarmConfigQueryVo = new AlarmConfigQueryVo(); + alarmConfigQueryVo.setStationId(stationStatusReq.getStationId()); + Event event = this.eventMapper.selectLastTime(alarmConfigQueryVo); + return event; + } + + public EventTypeAndLevelsReqVO getAlarmDataStatistics(AlarmConfigQueryVo vo) { + String alarmNum = null; + String alarmUnresolvedNum = null; + EventTypeAndLevelsReqVO eventTypeAndLevelsReqVO = new EventTypeAndLevelsReqVO(); + if (!vo.getStationList().isEmpty() && vo.getStationId() == null) { + Iterator var5 = vo.getStationList().iterator(); + + while(var5.hasNext()) { + Station station = (Station)var5.next(); + AlarmConfigQueryVo alarmConfigQueryVo = new AlarmConfigQueryVo(); + if (null == vo.getStartTime() && null == vo.getStartTime()) { + DateTime yesterday = DateUtil.yesterday(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String begin = sdf.format(DateUtil.beginOfDay(yesterday)); + String endOfDay = sdf.format(DateUtil.endOfDay(yesterday)); + alarmConfigQueryVo.setStartTime(begin); + alarmConfigQueryVo.setEndTime(endOfDay); + } else { + alarmConfigQueryVo.setStartTime(vo.getStartTime()); + alarmConfigQueryVo.setEndTime(vo.getEndTime()); + } + + List list = new ArrayList(); + list.add(CommonConstant.EventLevel.accident); + list.add(CommonConstant.EventLevel.abnormal); + list.add(CommonConstant.EventLevel.overLimit); + alarmConfigQueryVo.setStationId(station.getId()); + alarmConfigQueryVo.setEventLevelList(list); + List events = this.eventMapper.selectByTargetDeviceAsc(alarmConfigQueryVo); + List recovered = new ArrayList(); + List notRecovered = new ArrayList(); + Integer alarmOccurrencesNumber = 0; + Integer alarmUnresolvedNumber = 0; + Iterator var14 = events.iterator(); + + Event event; + while(var14.hasNext()) { + event = (Event)var14.next(); + if (CommonConstant.ZERO.equals(event.getIsRecovery())) { + alarmOccurrencesNumber = alarmOccurrencesNumber + 1; + notRecovered.add(event); + } + + if (CommonConstant.ONE.equals(event.getIsRecovery())) { + recovered.add(event); + } + } + + var14 = notRecovered.iterator(); + + while(var14.hasNext()) { + event = (Event)var14.next(); + Event beforeEventId = this.eventMapper.selectByBeforeEventId(event.getId()); + if (null == beforeEventId) { + alarmUnresolvedNumber = alarmUnresolvedNumber + 1; + } + } + + eventTypeAndLevelsReqVO.setAlarmOccurrencesNumber(alarmOccurrencesNumber); + eventTypeAndLevelsReqVO.setAlarmUnresolvedNumber(alarmUnresolvedNumber); + alarmNum = alarmOccurrencesNumber.toString(); + alarmUnresolvedNum = alarmUnresolvedNumber.toString(); + String redisKey = "dmaintenance:" + station.getId(); + JSONObject modifyDataObject = new JSONObject(); + modifyDataObject.put("alarmNum", alarmNum); + modifyDataObject.put("alarmUnresolvedNum", alarmUnresolvedNum); + String format = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"); + modifyDataObject.put("updateTime", format); + this.redisService.hmset(redisKey, modifyDataObject); + log.info("elecMeter.insert OK"); + } + } + + return eventTypeAndLevelsReqVO; + } + + @Async("flowThreadPoolExecutor") + public DataResult addEvents(List list) { + Iterator var2 = list.iterator(); + + while(var2.hasNext()) { + EventAddReq eventAddReq = (EventAddReq)var2.next(); + List groupAlarmConfigs = this.alarmConfigService.selectListGroupCache(eventAddReq.getGroupId(), com.ho.flow.constant.FlowConstant.AlarmConfig.SCOPE_GROUP, eventAddReq.getDeviceType()); + List stationAlarmConfigs = this.alarmConfigService.selectListCompanyCache(eventAddReq.getGroupId(), eventAddReq.getStationId(), com.ho.flow.constant.FlowConstant.AlarmConfig.SCOPE_STATION, eventAddReq.getDeviceType()); + Map stationConfigMap = (Map)stationAlarmConfigs.stream().collect(Collectors.toMap(AlarmConfig::getCol, (AlarmConfig) -> { + return AlarmConfig; + })); + Map groupConfigMap = (Map)groupAlarmConfigs.stream().collect(Collectors.toMap(AlarmConfig::getCol, (AlarmConfig) -> { + return AlarmConfig; + })); + JSONObject dataSet = eventAddReq.getDataSet(); + if (dataSet == null) { + return DataResult.success(); + } + + this.polymerizationAlarm(eventAddReq, groupAlarmConfigs, stationAlarmConfigs); + Map> resultMap = this.matchEventRecords(eventAddReq, dataSet, stationConfigMap, groupConfigMap); + + try { + List events = (List)resultMap.get("events"); + if (events != null && !events.isEmpty()) { + log.info("电站id:{},设备id:{}, events. size: {} ", new Object[]{eventAddReq.getStationId(), eventAddReq.getSrcId(), events.size()}); + this.eventService.insertEventBatch(events); + MovementDTO movementDTO = new MovementDTO(); + movementDTO.setEvents(events); + if (this.flag == 1) { + this.monitor.setEvents(movementDTO); + } + } + + List updateEvents = (List)resultMap.get("updateEvents"); + if (updateEvents != null && !updateEvents.isEmpty()) { + log.info("电站id:{},设备id:{}, updateEvents. size: {} ", new Object[]{eventAddReq.getStationId(), eventAddReq.getSrcId(), updateEvents.size()}); + this.eventService.updateEventBatch(updateEvents); + } + + List updateEventStatus = (List)resultMap.get("updateEventStatus"); + if (updateEventStatus != null && !updateEventStatus.isEmpty()) { + log.info("电站id:{},设备id:{}, updateEventStatus. size: {} ", new Object[]{eventAddReq.getStationId(), eventAddReq.getSrcId(), updateEventStatus.size()}); + List ids = (List)updateEventStatus.stream().map(Event::getId).collect(Collectors.toList()); + UserDetailRespVO userDetailRespVO = new UserDetailRespVO(); + userDetailRespVO.setUsername("system"); + this.eventService.updateById(ids, userDetailRespVO); + } + } catch (Exception var15) { + log.error("新增告警入库异常,电站id:{},设备id:{},dataSet:{},异常信息:{}", new Object[]{eventAddReq.getStationId(), eventAddReq.getSrcId(), eventAddReq.getDataSet(), var15.getMessage()}); + } + } + + return DataResult.success(); + } +} diff --git a/flowable-center/src/main/resources/lib/flowable-src-1.0.jar b/flowable-center/src/main/resources/lib/flowable-src-1.0.jar deleted file mode 100644 index e120f66..0000000 Binary files a/flowable-center/src/main/resources/lib/flowable-src-1.0.jar and /dev/null differ