海外平台-数据全英文化

This commit is contained in:
2025-09-18 14:05:01 +08:00
parent e6b6ccd804
commit 83eff7d1ee
112 changed files with 2151 additions and 344 deletions

View File

@ -55,6 +55,12 @@ public class Device implements Serializable {
@ApiModelProperty(value = "设备名字")
private String deviceName;
/**
* 设备名字-英文
*/
@ApiModelProperty(value = "设备名字-英文")
private String deviceNameEn;
@ApiModelProperty(value = "设备类型")
private String deviceType;

View File

@ -55,6 +55,12 @@ public class DeviceCall implements Serializable {
@ApiModelProperty(value = "设备名字")
private String deviceName;
/**
* 设备名字-英文
*/
@ApiModelProperty(value = "设备名字-英文")
private String deviceNameEn;
@ApiModelProperty(value = "设备类型")
private String deviceType;

View File

@ -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<HisCurveRelate> list;
@ApiModelProperty(value = "中英切换-查询字段")
private String lang;
}

View File

@ -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;

View File

@ -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<PlanningCurve> planningCurves;
@ApiModelProperty(value = "中英切换-查询字段")
private String lang;
}

View File

@ -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;
}

View File

@ -25,6 +25,9 @@ public class PointConfig implements Serializable {
@ApiModelProperty(value = "默认值")
private String defaultValue;
@ApiModelProperty(value = "默认值-英文")
private String defaultValueEn;
@ApiModelProperty(value = "配置点类型")
private Integer pointType;

View File

@ -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;

View File

@ -41,5 +41,8 @@ public class VirtualDeviceCol implements Serializable {
private String name;
//查询条件,非数据库中列
List<String> typeList;;
List<String> typeList;
@ApiModelProperty(value = "中英切换-查询字段")
private String lang;
}

View File

@ -77,4 +77,7 @@ public class DeviceReqVO {
@ApiModelProperty(hidden = true,value = "获取设备类型不为空的第一个设备")
private Integer needDeviceTypeNotNull;
@ApiModelProperty(value = "中英切换-查询字段")
private String lang;
}

View File

@ -32,4 +32,7 @@ public class DeviceTypeColReqVO {
* 遥信遥测 1遥信 2遥测 3遥控 默认送2
*/
Integer sensType;
@ApiModelProperty(value = "中英切换-查询字段")
private String lang;
}

View File

@ -29,4 +29,8 @@ public class StationReq implements Serializable {
@ApiModelProperty(value = "设备类型",hidden = true)
String deviceType;
@ApiModelProperty(value = "中英切换-查询字段")
String lang;
}

View File

@ -34,6 +34,7 @@ public class EarningsCalculateReq {
@ApiModelProperty(value = "结束时间",hidden = true)
String endTime;
@ApiModelProperty(value = "中英切换-查询字段")
private String lang;
}

View File

@ -17,4 +17,7 @@ public class DeviceTreeReq {
@ApiModelProperty(value = "src_id")
Integer srcId;
@ApiModelProperty(value = "中英切换-查询字段")
private String lang;
}

View File

@ -35,4 +35,7 @@ public class DynamicConfigQuery {
@ApiModelProperty(value = "是否隐藏0否1是默认0",hidden = true)
private Integer isHide;
@ApiModelProperty(value = "中英切换-查询字段")
private String lang;
}

View File

@ -21,6 +21,9 @@ public class PointConfigAdd {
@ApiModelProperty(value = "默认值")
private String defaultValue;
@ApiModelProperty(value = "默认值-英文")
private String defaultValueEn;
@ApiModelProperty(value = "配置点类型")
private Integer pointType;

View File

@ -20,4 +20,7 @@ public class PointConfigQuery {
@ApiModelProperty(value = "设备id(用以区分属于哪个设备页)")
private Integer deviceId;
@ApiModelProperty(value = "中英切换-查询字段")
private String lang;
}

View File

@ -28,4 +28,7 @@ public class ModelTypeQueryReq {
@ApiModelProperty(value = "用户id",hidden = true)
private String userId;
@ApiModelProperty(value = "中英切换-查询字段")
private String lang;
}

View File

@ -49,4 +49,7 @@ public class PointCurveReq {
@ApiModelProperty(value = "是否为策略总览页面(1:是;0:否)")
Integer isStrategy;
@ApiModelProperty(value = "中英切换-查询字段")
private String lang;
}

View File

@ -42,5 +42,8 @@ public class PointReq {
@ApiModelProperty(value = "值2的定义 大于1 小于2 等于3 大于等于4 小于等于5")
private BigDecimal Value2;
@ApiModelProperty(value = "中英切换-查询字段")
private String lang;
}

View File

@ -24,6 +24,9 @@ public class PointVo {
@ApiModelProperty(value = "遥信遥测 1遥信 2遥测 默认送2")
private Integer sensType;
@ApiModelProperty(value = "中英切换-查询字段")
private String lang;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -54,7 +54,7 @@ public interface DeviceMapper {
* @param needAccessPoint 是否需要接入点,不为空表示需要
* @return
*/
List<DeviceRespVO> selectByIdAndSrcIdNotZero(Integer stationId,Integer needHide,Integer needAccessPoint);
List<DeviceRespVO> selectByIdAndSrcIdNotZero(Integer stationId,Integer needHide,Integer needAccessPoint,String lang);
int insertBatch(@Param("list")List<Device> deviceList);

View File

@ -32,7 +32,7 @@ public interface DeviceTypeColMapper {
int updateList(@Param("deviceTypeColList")List<DeviceTypeCol> deviceTypeColList);
//deviceType查询
List<DeviceTypeCol> selectByDeviceType(String deviceType);
List<DeviceTypeCol> selectByDeviceType(@Param("deviceType")String deviceType,@Param("lang") String lang);
List<DeviceTypeCol> selectByParam(@Param("deviceTypeCol") DeviceTypeCol deviceTypeCol);
@ -53,7 +53,7 @@ public interface DeviceTypeColMapper {
List<ModelDeviceColComp> getCompListByType(@Param("type") String type, @Param("typeName") String typeName, @Param("modelCol") String modelCol);
List<DeviceTypeCol> selectSameCol(@Param("deviceType") String deviceType, @Param("list") List<String> collect);
List<DeviceTypeCol> selectSameCol(@Param("deviceType") String deviceType, @Param("list") List<String> collect,@Param("lang") String lang);
//批量新增设备表字段
void addBatchDevice(@Param("list") List<DeviceTypeCol> deviceTypeColList);
@ -65,7 +65,7 @@ public interface DeviceTypeColMapper {
void deleteBatchModel(List<Integer> ids);
DeviceTypeCol selectTypeAndCol(String col, String deviceType);
DeviceTypeCol selectTypeAndCol(String col, String deviceType,String lang);
Integer selectCountByDeviceType(@Param("deviceTypeCol")DeviceTypeCol deviceTypeCol);

View File

@ -33,7 +33,7 @@ public interface PlanningCurveIssueMapper {
void addPlanningCurveHistory(@Param("condition") List<PlanningCurveHistory> PlanningCurveHistory);
List<PlanCurveOperationRecordReq> getPlanCurveOperationList(@Param("stationId") String stationId);
List<PlanCurveOperationRecordReq> getPlanCurveOperationList(@Param("stationId") String stationId,@Param("lang") String lang);
List<PlanningCurveHistory> getPlanningCurveHistory(@Param("planningCurveId") String planningCurveId);

View File

@ -63,4 +63,13 @@ public interface PointConfigMapper {
*/
int updateList(List<PointConfig> list);
/**
* 查询所有name_en 为空的数据
* @return
*/
List<PointConfigResp> 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);
}

View File

@ -38,7 +38,7 @@ public interface PointPolysemyConfigMapper {
* @param ids
* @return
*/
List<PointPolysemyConfig> selectByPointIds(@Param("ids") List<Integer> ids);
List<PointPolysemyConfig> selectByPointIds(@Param("ids") List<Integer> ids,@Param("lang") String lang);
/**
* 根据id删除配置信息

View File

@ -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<TranslateName> getDictNation();
TranslateName selectNameEN(@Param("name")String name);
int insert(@Param("vo")TranslateName vo);
int updateNameEnById(@Param("id") Integer id, @Param("nameEn") String nameEn);
}

View File

@ -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<TranslateNation> getDictNation();
}

View File

@ -89,11 +89,14 @@ public interface DeviceService {
//根据电站id和srcId查询
Device selectByStationIdAndSrcId(Integer stationId, Integer srcId);
Device selectByStationIdAndSrcIdAndLng(Integer stationId, Integer srcId,String lang);
List<DeviceRespVO> selectByGroup(Integer groupId);
List<String> selectDistinctDeviceTypeByStationId(Integer stationId);
List<DeviceRespVO> getDeviceByStationId(Integer stationId);
List<DeviceRespVO> getDeviceByStationId(Integer stationId,String lang);
List<DeviceRespVO> getDeviceByStationIds(List<Integer> stationIds);
@ -138,7 +141,7 @@ public interface DeviceService {
* @param stationId
* @return
*/
List<DeviceRespVO> selectByIdAndSrcIdNotZero(Integer stationId);
List<DeviceRespVO> selectByIdAndSrcIdNotZero(Integer stationId,String lang);
/**
* 查询设备需要设备接入点
@ -146,7 +149,7 @@ public interface DeviceService {
* @param stationId
* @return
*/
List<DeviceRespVO> selectDeviceByStationId(Integer stationId);
List<DeviceRespVO> selectDeviceByStationId(Integer stationId,String lang);
/**
* 查询所有设备,不包含接入点
@ -154,7 +157,7 @@ public interface DeviceService {
* @param stationId
* @return
*/
List<DeviceRespVO> selectAllDeviceAndSrcIdNotZero(Integer stationId);
List<DeviceRespVO> selectAllDeviceAndSrcIdNotZero(Integer stationId,String lang);
/**
* 获取单个设备电压电流正太分布数据

View File

@ -19,14 +19,14 @@ public interface DeviceTypeColService {
int insertList(List<DeviceTypeColImportVO> list,Integer GroupId);
List<DeviceTypeCol> selectByDeviceType(String deviceType);
List<DeviceTypeCol> selectByDeviceType(String deviceType,String lang);
DeviceTypeCol selectById(Integer id);
DeviceTypeCol selectTypeAndCol(String col, String deviceType);
DeviceTypeCol selectTypeAndCol(String col, String deviceType,String lang);
List<DeviceTypeCol> selectDeviceTypeColList(String deviceType,List<String> collect);
List<DeviceTypeCol> selectDeviceTypeColList(String deviceType,List<String> collect,String lang);
Integer selectCountByDeviceType(DeviceTypeCol deviceTypeCol);

View File

@ -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);
}

View File

@ -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);
/**
* 查询日冻结数据

View File

@ -28,7 +28,7 @@ public interface PlanningCurveIssueService {
public void planCurveOperationRecord(PlanCurveOperationRecordReq planCurveOperationRecordReq);
List<PlanCurveOperationRecordReq> getPlanCurveOperationList(String stationId);
List<PlanCurveOperationRecordReq> getPlanCurveOperationList(String stationId,String lang);
Map<String,Object> getPlanningCurveHistory(List<String> planningCurveIds);
}

View File

@ -89,7 +89,7 @@ public class DeviceModelServiceImpl implements DeviceModelService {
List<String> addCollect = addColList.stream().map(DeviceCol::getCol)
.collect(Collectors.toList());
if (!addCollect.isEmpty()) {
List<DeviceTypeCol> deviceTypeCols = deviceTypeColMapper.selectSameCol(vo.getDeviceType(), addCollect);
List<DeviceTypeCol> 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);
}

View File

@ -106,6 +106,10 @@ public class DeviceServiceImpl implements DeviceService {
@Autowired
Snowflake snowflake;
@Autowired
DynamicConfigService dynamicConfigService;
@Override
public PageResult<DeviceRespVO> 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<DeviceRespVO> deviceRespVOList = getList(deviceReqVO);
if(deviceRespVOList!=null && !deviceRespVOList.isEmpty()){
device = deviceRespVOList.get(0);
}
return device;
}
@Override
public List<DeviceRespVO> selectByGroup(Integer groupId) {
Device device = new Device();
@ -532,9 +552,10 @@ public class DeviceServiceImpl implements DeviceService {
}
@Override
public List<DeviceRespVO> getDeviceByStationId(Integer stationId) {
public List<DeviceRespVO> getDeviceByStationId(Integer stationId,String lang) {
DeviceReqVO reqVO = new DeviceReqVO();
reqVO.setStationId(stationId);
reqVO.setLang(lang);
List<DeviceRespVO> deviceRespVOS = deviceMapper.selectByCondition(reqVO);
deviceRespVOS = getDeviceRespVOS(deviceRespVOS);
return deviceRespVOS;
@ -814,26 +835,26 @@ public class DeviceServiceImpl implements DeviceService {
}
@Override
public List<DeviceRespVO> selectByIdAndSrcIdNotZero(Integer stationId) {
List<DeviceRespVO> list = deviceMapper.selectByIdAndSrcIdNotZero(stationId, null, null);
public List<DeviceRespVO> selectByIdAndSrcIdNotZero(Integer stationId,String lang) {
List<DeviceRespVO> list = deviceMapper.selectByIdAndSrcIdNotZero(stationId, null, null,lang);
return list;
}
@Override
public List<DeviceRespVO> selectDeviceByStationId(Integer stationId) {
List<DeviceRespVO> list = deviceMapper.selectByIdAndSrcIdNotZero(stationId, null, CommonConstant.ONE);
public List<DeviceRespVO> selectDeviceByStationId(Integer stationId,String lang) {
List<DeviceRespVO> list = deviceMapper.selectByIdAndSrcIdNotZero(stationId, null, CommonConstant.ONE,lang);
return list;
}
@Override
public List<DeviceRespVO> selectAllDeviceAndSrcIdNotZero(Integer stationId) {
List<DeviceRespVO> list = deviceMapper.selectByIdAndSrcIdNotZero(stationId, CommonConstant.ONE, null);
public List<DeviceRespVO> selectAllDeviceAndSrcIdNotZero(Integer stationId,String lang) {
List<DeviceRespVO> list = deviceMapper.selectByIdAndSrcIdNotZero(stationId, CommonConstant.ONE, null,lang);
return list;
}
@Override
public TemperatureVoltageResp getTemperatureVoltageData(DeviceTreeReq vo) {
List<DeviceRespVO> deviceRespVOS = selectByIdAndSrcIdNotZero(vo.getStationId());
List<DeviceRespVO> deviceRespVOS = selectByIdAndSrcIdNotZero(vo.getStationId(),vo.getLang());
List<DevicePointResp> treeDevices = new ArrayList<>();
if (!deviceRespVOS.isEmpty()) {
treeDevices = deviceTypeConfigService.getTreeDevices(deviceRespVOS, vo.getSrcId());
@ -1118,7 +1139,7 @@ public class DeviceServiceImpl implements DeviceService {
List<DeviceRespVO> deviceRespVOS = deviceMapper.selectByCondition(deviceReqVO);
List<Integer> srcIdList = deviceRespVOS.stream().map(s -> s.getSrcId()).collect(Collectors.toList());
//查询对应的设备
List<DeviceRespVO> deviceStation = selectByIdAndSrcIdNotZero(vo.getStationId());
List<DeviceRespVO> deviceStation = selectByIdAndSrcIdNotZero(vo.getStationId(),vo.getLang());
List<DevicePointResp> treeDevices = new ArrayList<>();
if (!deviceRespVOS.isEmpty()) {
for (Integer srcId : srcIdList) {
@ -1140,7 +1161,7 @@ public class DeviceServiceImpl implements DeviceService {
List<DeviceRespVO> deviceRespVOS = deviceMapper.selectByCondition(deviceReqVO);
List<Integer> srcIdList = deviceRespVOS.stream().map(s -> s.getSrcId()).collect(Collectors.toList());
//查询对应的设备
List<DeviceRespVO> deviceStation = selectByIdAndSrcIdNotZero(vo.getStationId());
List<DeviceRespVO> deviceStation = selectByIdAndSrcIdNotZero(vo.getStationId(),vo.getLang());
List<DevicePointResp> treeDevices = new ArrayList<>();
if (!deviceRespVOS.isEmpty()) {
for (Integer srcId : srcIdList) {

View File

@ -50,7 +50,7 @@ public class DeviceTypeColServiceImpl implements DeviceTypeColService {
DeviceTypeCol deviceTypeCol = null;
for (Map.Entry<String, List<DeviceTypeColImportVO>> src : mapList.entrySet()) {
//已经存在的
List<DeviceTypeCol> isSaveList = deviceTypeColMapper.selectByDeviceType(src.getKey());
List<DeviceTypeCol> isSaveList = deviceTypeColMapper.selectByDeviceType(src.getKey(),null);
Map<String, DeviceTypeCol> isSaveMap = isSaveList.stream().collect(Collectors.toMap(k -> k.getDeviceType() + "_" + k.getCol(), DeviceTypeCol -> DeviceTypeCol));
Map<Integer, List<DeviceTypeCol>> addMap = new HashMap<>();
@ -118,8 +118,8 @@ public class DeviceTypeColServiceImpl implements DeviceTypeColService {
}
@Override
public List<DeviceTypeCol> selectByDeviceType(String deviceType) {
List<DeviceTypeCol> deviceTypeColList = deviceTypeColMapper.selectByDeviceType(deviceType);
public List<DeviceTypeCol> selectByDeviceType(String deviceType,String lang) {
List<DeviceTypeCol> 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<DeviceTypeCol> selectDeviceTypeColList(String deviceType, List<String> collect) {
List<DeviceTypeCol> deviceTypeCols = deviceTypeColMapper.selectSameCol(deviceType, collect);
public List<DeviceTypeCol> selectDeviceTypeColList(String deviceType, List<String> collect,String lang) {
List<DeviceTypeCol> deviceTypeCols = deviceTypeColMapper.selectSameCol(deviceType, collect,lang);
return deviceTypeCols;
}

View File

@ -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<DynamicConfig> list) {
List<DynamicConfig> insertList = list.stream().filter(i -> i.getId() == null).collect(Collectors.toList());
@ -153,6 +159,8 @@ public class DynamicConfigServiceImpl implements DynamicConfigService {
List<CurveConfig> 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<DynamicConfig> 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<DynamicConfig> 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<Integer> polysemyList = pointConfigResultList.stream().filter(i -> CommonConstant.TWO.equals(i.getPointType()) || CommonConstant.ELEVEN.equals(i.getPointType())).map(PointConfigResultResp::getId).distinct().collect(Collectors.toList());
Map<Integer, List<PointPolysemyConfig>> vMap = new HashMap<>();
if(!polysemyList.isEmpty()){
List<PointPolysemyConfig> list = polysemyMapper.selectByPointIds(polysemyList);
List<PointPolysemyConfig> list = polysemyMapper.selectByPointIds(polysemyList,vo.getLang());
vMap = list.stream().collect(Collectors.groupingBy(PointPolysemyConfig::getPointId));
}
//拆电芯
@ -445,14 +462,14 @@ public class DynamicConfigServiceImpl implements DynamicConfigService {
List<Integer> polysemyList = pointConfigResultList.stream().filter(i -> CommonConstant.TWO.equals(i.getPointType())).map(PointConfigResultResp::getId).distinct().collect(Collectors.toList());
Map<String, String> vMap = new HashMap<>();
if(!polysemyList.isEmpty()){
List<PointPolysemyConfig> list = polysemyMapper.selectByPointIds(polysemyList);
List<PointPolysemyConfig> 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<Integer> rangePolysemyList = pointConfigResultList.stream().filter(i -> CommonConstant.ELEVEN.equals(i.getPointType())).map(PointConfigResultResp::getId).distinct().collect(Collectors.toList());
Map<Integer, List<PointPolysemyConfig>> rMap = new HashMap<>();
if(!rangePolysemyList.isEmpty()){
List<PointPolysemyConfig> list = polysemyMapper.selectByPointIds(rangePolysemyList);
List<PointPolysemyConfig> 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<PointConfigResp> 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<PointConfigResultResp> pointList, List<PointConfigAdd> pointAddList,Integer deviceId,Map<Integer, SyncDynamicDeviceMapping> map) {
PointConfigAdd configAdd = null;
for (PointConfigResultResp p: pointList) {

View File

@ -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);
//充电收益

View File

@ -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<HisCurveRelate> 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<HisCurveRelate> hisCurveRelateList = hisCurveRelateMapper.selectAll(queryVo);
Map<String, List<HisCurveRelate>> chargeMap = hisCurveRelateList.stream().collect(Collectors.groupingBy(HisCurveRelate::getModelId));
List<HisCurveRelate> resultList = new ArrayList<>();

View File

@ -967,48 +967,15 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
}
private List<ProvinceStation> getProvince(List<Station> stations) {
//地址选取前三个字
// Map<String, List<Station>> provincesMap = stations.stream().sorted(Comparator.comparing(Station::getName)).collect(Collectors.groupingBy(s -> {
// return s.getAddress().substring(0, 3);
// }));
// //创建返回值集合
// List<ProvinceStation> 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<TranslateProvince> dictProvince = translateProvinceMapper.getDictProvince();
Map<String, String> provinceMap = dictProvince.stream().collect(Collectors.toMap(s -> s.getName(), s -> s.getNameEn(), (k1, k2) -> k1));
Map<String, List<Station>> provincesMap = stations.stream().filter(s->s.getProvince()!=null).collect(Collectors.groupingBy(Station::getProvince));
List<ProvinceStation> provinceList = new ArrayList<>();
provincesMap.forEach((k, v) -> {
Map<String, List<Station>> natioMap = stations.stream().filter(s->s.getProvince()!=null).collect(Collectors.groupingBy(Station::getNation));
List<ProvinceStation> 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<Station> list = getCountStations(stationIds);
List<Subdata> regionList = new ArrayList<>();
Map<String, List<Station>> provinceMap = list.stream().filter(i -> i.getProvince() != null).collect(Collectors.groupingBy(Station::getProvince));
if (provinceMap.size() > CommonConstant.ONE) {
regionList = getListSubdata(provinceMap);
Map<String, List<Station>> nationMap = list.stream().filter(i -> i.getProvince() != null).collect(Collectors.groupingBy(Station::getNation));
if (nationMap.size() > CommonConstant.ONE) {
regionList = getListSubdata(nationMap);
} else {
Map<String, List<Station>> cityMap = list.stream().filter(i -> i.getCity() != null).collect(Collectors.groupingBy(Station::getCity));
if (cityMap.size() > CommonConstant.ONE) {
regionList = getListSubdata(cityMap);
Map<String, List<Station>> provinceMap = list.stream().filter(i -> i.getCity() != null).collect(Collectors.groupingBy(Station::getProvince));
if (provinceMap.size() > CommonConstant.ONE) {
regionList = getListSubdata(provinceMap);
} else {
Map<String, List<Station>> districtMap = list.stream().filter(i -> i.getDistrict() != null).collect(Collectors.groupingBy(Station::getDistrict));
regionList = getListSubdata(districtMap);
Map<String, List<Station>> cityMap = list.stream().filter(i -> i.getDistrict() != null).collect(Collectors.groupingBy(Station::getCity));
regionList = getListSubdata(cityMap);
}
}
return regionList;

View File

@ -1081,7 +1081,7 @@ public class InverterServiceImpl implements InverterService {
//查询设备映射字段
List<ModelDeviceColComp> colMappingList = modelDeviceService.getCompListByType(CommonConstant.ModelDeviceType.DEVICE, device.getDeviceType(), null);
//查询没有映射字段
List<DeviceTypeCol> deviceTypeCols = deviceTypeColMapper.selectByDeviceType(device.getDeviceType());
List<DeviceTypeCol> deviceTypeCols = deviceTypeColMapper.selectByDeviceType(device.getDeviceType(),null);
//拼接缓存key
String inverterRedisKey = device.getDeviceType() + ":" + vo.getStationId() + ":" + vo.getSrcId();
//先判断缓存中是否存在

View File

@ -104,7 +104,7 @@ public class ModelDeviceServiceImpl implements ModelDeviceService {
if(redisService.hasKey(key)){
deviceTypeCols =(List<DeviceTypeCol>) redisService.get(key);
}else{
deviceTypeCols = deviceTypeColMapper.selectByDeviceType(deviceType);
deviceTypeCols = deviceTypeColMapper.selectByDeviceType(deviceType,null);
redisService.set(key,deviceTypeCols);
redisService.expire(key,1, TimeUnit.HOURS);
}

View File

@ -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<Integer> stationIds = req.getStationIds();
List<Station> 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<EarningsCalculateData> 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<Map<String, Object>> sheetsList, String name, List<PcsElecData> dataList) {
private void setSheetElecData(List<Map<String, Object>> sheetsList, String name, List<PcsElecData> 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<PcsElecDataEn> 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<Map<String, Object>> sheetsList, String name, List<EarningsCalculateData> dataList) {
private void setSheetEarningsData(List<Map<String, Object>> sheetsList, String name, List<EarningsCalculateData> 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<EarningsCalculateDataEn> 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);
}
}

View File

@ -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<Map<String, Object>> getIssueDevices(PlanningIssueDevice issueDevice) {
return issueMapper.getIssueDevices(issueDevice);
@ -358,21 +363,27 @@ public class PlanningCurveIssueServiceImpl implements PlanningCurveIssueService
planCurveOperationRecordReq.setLatestPlanningCurve(lastestOperateId);
//获取电站的上一次计划曲线模板id
String previousOperateId = null;
List<PlanCurveOperationRecordReq> result = issueMapper.getPlanCurveOperationList(String.valueOf(planCurveOperationRecordReq.getStationId()));
List<PlanCurveOperationRecordReq> 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<PlanCurveOperationRecordReq> getPlanCurveOperationList(String stationId) {
List<PlanCurveOperationRecordReq> result = issueMapper.getPlanCurveOperationList(stationId);
public List<PlanCurveOperationRecordReq> getPlanCurveOperationList(String stationId,String lang) {
List<PlanCurveOperationRecordReq> result = issueMapper.getPlanCurveOperationList(stationId,lang);
return result;
}

View File

@ -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<Map<String, Object>> 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<String, Object> check = this.checkData(template, templateId);
if (null != check) {

View File

@ -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<PointRespVO> 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<DeviceTypeCol> deviceTypeCols = modelDeviceService.selectByDeviceTypeList(deviceTypeColReqVO);
Map<String, String> 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<VirtualDeviceColResp> 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<String, BigDecimal> colMaxMap = new HashMap<>();
Map<String, BigDecimal> 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<DeviceTypeCol> deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols());
List<DeviceTypeCol> deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols(),pointCurveReq.getLang());
Map<String, String> nameMap = deviceTypeCols.stream().collect(Collectors.toMap(s -> s.getDeviceType() + "_" + s.getCol(), DeviceTypeCol::getColName));
Map<String, BigDecimal> maxMap = deviceTypeCols.stream().collect(Collectors.toMap(s -> s.getDeviceType() + "_" + s.getCol(), DeviceTypeCol::getMaxValue));
Map<String, BigDecimal> minMap = deviceTypeCols.stream().collect(Collectors.toMap(s -> s.getDeviceType() + "_" + s.getCol(), DeviceTypeCol::getMinValue));;
@ -814,12 +820,12 @@ public class PointDemoServiceImpl implements PointDemoService {
Map<String, BigDecimal> 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<DeviceTypeCol> deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols());
List<DeviceTypeCol> deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols(),pointCurveReq.getLang());
Map<String, String> nameMap = deviceTypeCols.stream().collect(Collectors.toMap(s -> s.getDeviceType() + "_" + s.getCol(), DeviceTypeCol::getColName));
Map<String, BigDecimal> maxMap = deviceTypeCols.stream().collect(Collectors.toMap(s -> s.getDeviceType() + "_" + s.getCol(), DeviceTypeCol::getMaxValue));
Map<String, BigDecimal> 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<String> yxCols = new ArrayList<>();
List<String> 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<String> 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<String, String> 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<DeviceTypeCol> deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols());
List<DeviceTypeCol> deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols(),pointCurveReq.getLang());
Map<String, String> 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<String, String> 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<DeviceTypeCol> deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols());
List<DeviceTypeCol> deviceTypeCols = deviceTypeColService.selectDeviceTypeColList(pointCurveSrcCol.getDeviceType(), pointCurveSrcCol.getCols(),pointCurveReq.getLang());
Map<String, String> nameMap = deviceTypeCols.stream().collect(Collectors.toMap(s -> s.getDeviceType() + "_" + s.getCol(), DeviceTypeCol::getColName));
colNameMap.putAll(nameMap);
}

View File

@ -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);

View File

@ -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;

View File

@ -119,7 +119,7 @@ public class VirtualDeviceColServiceImpl implements VirtualDeviceColService {
}
virtualDeviceColList = new ArrayList<>();
String deviceType = deviceValue.getDeviceType().replace(UNDERLINE + vo.getModelStationId(), UNDERLINE + vo.getStationId());
List<DeviceTypeCol> deviceTypeCols = deviceTypeColService.selectByDeviceType(deviceType);
List<DeviceTypeCol> deviceTypeCols = deviceTypeColService.selectByDeviceType(deviceType,null);
Map<String, List<DeviceTypeCol>> modelMap = deviceTypeCols.stream().collect(Collectors.groupingBy(DeviceTypeCol::getCol));
//根据col进行数据对比更换device_col_id
for (VirtualDeviceColResp virtualDeviceColResp : virtualDeviceColRespList) {

View File

@ -35,9 +35,14 @@
<select id="selectByParam" resultType="com.ho.business.vo.resp.dynamicConfig.CurveConfigResp">
SELECT
c.id,
c.curve_name,
c.curve_name as curve_name_zh,
c.curve_name_en,
<choose>
<when test="lang != null and lang=='en_US' ">
c.curve_name_en curveName,
</when>
<otherwise>
c.curve_name,
</otherwise>
</choose>
c.curve_type,
c.auxiliary_value,
c.station_id,

View File

@ -26,6 +26,12 @@
producer,serial_no,status,device_json,`virtual`,from_id,hide,flow_direction,producer_type,unit_type
</sql>
<sql id="Base_Column_List1">
id,group_id,dept_id,src_id,pid,category,
station_id,device_name_en deviceName,device_type,
producer,serial_no,status,device_json,`virtual`,from_id,hide,flow_direction,producer_type,unit_type
</sql>
<select id="selectByInfo" resultType="com.ho.business.vo.resp.DeviceRespVO">
select
<include refid="Base_Column_List"/>
@ -81,7 +87,14 @@
<select id="selectByCondition" resultType="com.ho.business.vo.resp.DeviceRespVO">
select
<include refid="Base_Column_List"/>
<choose>
<when test="lang != null and lang=='en_US' ">
<include refid="Base_Column_List1"/>
</when>
<otherwise>
<include refid="Base_Column_List"/>
</otherwise>
</choose>
from device
<where>
<if test="stationId != null">
@ -259,7 +272,14 @@
</select>
<select id="selectByIdAndSrcIdNotZero" resultType="com.ho.business.vo.resp.DeviceRespVO">
SELECT
<include refid="Base_Column_List"/>
<choose>
<when test="lang != null and lang=='en_US' ">
<include refid="Base_Column_List1"/>
</when>
<otherwise>
<include refid="Base_Column_List"/>
</otherwise>
</choose>
FROM `device`
<where>
<if test="needHide == null">
@ -334,6 +354,7 @@
<if test="category != null">category,</if>
<if test="stationId != null">station_id,</if>
<if test="deviceName != null">device_name,</if>
<if test="deviceNameEn != null">device_name_en,</if>
<if test="deviceType != null">device_type,</if>
<if test="producer != null">producer,</if>
<if test="serialNo != null">serial_no,</if>
@ -351,6 +372,7 @@
<if test="category != null">#{category,jdbcType=INTEGER},</if>
<if test="stationId != null">#{stationId,jdbcType=INTEGER},</if>
<if test="deviceName != null">#{deviceName,jdbcType=VARCHAR},</if>
<if test="deviceNameEn != null">#{deviceNameEn,jdbcType=VARCHAR},</if>
<if test="deviceType != null">#{deviceType,jdbcType=VARCHAR},</if>
<if test="producer != null">#{producer,jdbcType=VARCHAR},</if>
<if test="serialNo != null">#{serialNo,jdbcType=VARCHAR},</if>
@ -366,13 +388,13 @@
<insert id="insertBatch">
INSERT INTO device
(group_id,dept_id,src_id,pid,category,
station_id,device_name,device_type,
station_id,device_name,device_name_en,device_type,
serial_no,status,`virtual`,from_id,create_time)
VALUES
<foreach item="item" collection="list" index="index" separator=",">
(
#{item.groupId},#{item.deptId},#{item.srcId},#{item.pid}
,#{item.category} ,#{item.stationId},#{item.deviceName},#{item.deviceType}
,#{item.category} ,#{item.stationId},#{item.deviceName},#{item.deviceNameEn},#{item.deviceType}
,#{item.serialNo},#{item.status},#{item.virtual},#{item.fromId},#{item.createTime}
)
</foreach>

View File

@ -31,6 +31,14 @@
data_type,filter_type
</sql>
<sql id="Base_Column_List1">
id
,device_type_id,device_type,
device_type_name,col,col_en colName,col_en,sens_type,is_show,is_save,
max_value,min_value,specified_value,offset_value,factor,unit,
data_type,filter_type
</sql>
<sql id="Base_List">
id
,device_type_id,device_type,
@ -73,7 +81,14 @@
<select id="selectByDeviceType" resultType="com.ho.business.entity.DeviceTypeCol">
select
<include refid="Base_Column_List"/>
<choose>
<when test="lang != null and lang=='en_US' ">
<include refid="Base_Column_List1"/>
</when>
<otherwise>
<include refid="Base_Column_List"/>
</otherwise>
</choose>
from device_type_col
<where>
<if test="deviceType != null">
@ -103,7 +118,14 @@
<select id="selectByDeviceTypeList" resultType="com.ho.business.entity.DeviceTypeCol">
select
<include refid="Base_Column_List"/>
<choose>
<when test="deviceTypeColReqVO.lang != null and deviceTypeColReqVO.lang=='en_US' ">
<include refid="Base_Column_List1"/>
</when>
<otherwise>
<include refid="Base_Column_List"/>
</otherwise>
</choose>
from device_type_col
<where>
<if test="deviceTypeColReqVO.deviceTypeList != null and deviceTypeColReqVO.deviceTypeList.size !=0">
@ -116,7 +138,7 @@
and is_save = #{deviceTypeColReqVO.isSave}
</if>
<if test="deviceTypeColReqVO.name != null">
and (col_name LIKE concat('%',#{deviceTypeColReqVO.name},'%') or col LIKE
and (col_name LIKE concat('%',#{deviceTypeColReqVO.name},'%') or col_en LIKE concat('%',#{deviceTypeColReqVO.name},'%') or col LIKE
concat('%',#{deviceTypeColReqVO.name},'%'))
</if>
<if test="deviceTypeColReqVO.sensType != null">
@ -181,7 +203,14 @@
<select id="selectSameCol" resultType="com.ho.business.entity.DeviceTypeCol">
select
<include refid="Base_Column_List"/>
<choose>
<when test="lang != null and lang=='en_US' ">
<include refid="Base_Column_List1"/>
</when>
<otherwise>
<include refid="Base_Column_List"/>
</otherwise>
</choose>
from device_type_col
<where>
<if test="deviceType != null">
@ -197,7 +226,14 @@
</select>
<select id="selectTypeAndCol" resultType="com.ho.business.entity.DeviceTypeCol">
select
<include refid="Base_Column_List"/>
<choose>
<when test="lang != null and lang=='en_US' ">
<include refid="Base_Column_List1"/>
</when>
<otherwise>
<include refid="Base_Column_List"/>
</otherwise>
</choose>
from device_type_col
<where>
<if test="deviceType != null">

View File

@ -22,18 +22,25 @@
col_name
</sql>
<sql id="Base_Column_List1">
id
,user_id,model_id,
model_name_en model_name,src_id,col,station_id,device_type,
col_name_en col_name
</sql>
<insert id="insertBatch">
INSERT INTO his_curve_relate
(user_id,model_id,
model_name,src_id,col,station_id,device_type,
col_name)
model_name,model_name_en,src_id,col,station_id,device_type,
col_name,col_name_en)
VALUES
<foreach item="item" collection="list" index="index" separator=",">
(
#{item.userId},#{item.modelId},#{item.modelName},#{item.srcId}
#{item.userId},#{item.modelId},#{item.modelName},#{item.modelNameEn},#{item.srcId}
,#{item.col} ,#{item.stationId},#{item.deviceType}
,#{item.colName}
,#{item.colName},#{item.colName}
)
</foreach>
@ -41,7 +48,14 @@
<select id="selectAll" resultType="com.ho.business.entity.HisCurveRelate">
select
<include refid="Base_Column_List"/>
<choose>
<when test="hisCurveRelate.lang != null and hisCurveRelate.lang=='en_US' ">
<include refid="Base_Column_List1"/>
</when>
<otherwise>
<include refid="Base_Column_List"/>
</otherwise>
</choose>
from his_curve_relate
<where>
<if test="hisCurveRelate.stationId!=null">

View File

@ -6,12 +6,29 @@
<select id="getIssueDevices" resultType="HashMap">
select
src_id as value, device_name as label
src_id as value,
<choose>
<when test="lang != null and lang=='en_US' ">
device_name_en as label
</when>
<otherwise>
device_name as label
</otherwise>
</choose>
from device where (device_type like 'agc%' or device_type like 'planCurve%' ) and station_id = #{stationId}
</select>
<select id="getTemplate" resultType="HashMap">
select id as value,template_name as label from planning_curve_template
select id as value,
<choose>
<when test="lang != null and lang=='en_US' ">
template_name_en as label
</when>
<otherwise>
template_name as label
</otherwise>
</choose>
from planning_curve_template
where ( station_id = #{stationId} or station_id is null ) and status = 1
</select>
@ -110,11 +127,12 @@
<insert id="planCurveOperationRecord" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.ho.business.vo.resp.planningCurve.PlanningIssueVo">
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}
)
</insert>
<insert id="addPlanningCurveHistory" parameterType="com.ho.business.entity.PlanningCurveHistory">
@ -125,8 +143,25 @@
</insert>
<select id="getPlanCurveOperationList" resultType="com.ho.business.entity.PlanCurveOperationRecordReq">
select user_id,user_name,operate_time,operate_content,operate_result,effective_time,status,previous_planning_curve,latest_planning_curve,station_id from
planning_curve_operation_record where station_id = #{stationId} order by operate_time desc
select user_id,user_name,operate_time,
<choose>
<when test="lang != null and lang=='en_US' ">
operate_content_en operate_content,
</when>
<otherwise>
operate_content,
</otherwise>
</choose>
<choose>
<when test="lang != null and lang=='en_US' ">
operate_result_en operate_result,
</when>
<otherwise>
operate_result,
</otherwise>
</choose>
effective_time,status,previous_planning_curve,latest_planning_curve,station_id from
planning_curve_operation_record where station_id = #{stationId} order by operate_time desc
</select>
<select id="getPlanningCurveHistory" resultType="com.ho.business.entity.PlanningCurveHistory">

View File

@ -35,14 +35,23 @@
tem.elec_template_id elec_template_id, tem.status status, date_format(tem.update_time,'%Y-%m-%d %H:%i:%s') update_time, tem.p tem_p, tem.capacity, tem.soc_upper,
tem.soc_lower, cur.id id, cur.start_time start_time, cur.end_time end_time, cur.p p, cur.q q, cur.soc soc,cur.planning_template_id
from (
select id,template_no,template_name,elec_template_id,station_id,group_id,income,status,p,capacity,soc_upper,soc_lower,create_time,update_time
select id,template_no,
<choose>
<when test="lang != null and lang=='en_US' ">
template_name_en template_name,
</when>
<otherwise>
template_name,
</otherwise>
</choose>
elec_template_id,station_id,group_id,income,status,p,capacity,soc_upper,soc_lower,create_time,update_time
from planning_curve_template
<where>
<if test="temId != null and temId != ''">
id = #{temId}
</if>
<if test="templateName != null and templateName != ''">
and template_name like concat('%',#{templateName},'%')
and (template_name like concat('%',#{templateName},'%') or template_name_en like concat('%',#{templateName},'%'))
</if>
<if test="status != null">
and status = #{status}
@ -57,7 +66,7 @@
<if test="pageNum != null and pageSize != null" >
limit ${pageNum},${pageSize}
</if>
)tem left join planning_curve cur on cur.planning_template_id = tem.id
)tem left join planning_curve cur on cur.planning_template_id = tem.id
order by tem.create_time,tem.update_time desc, cur.start_time
</select>
@ -67,22 +76,22 @@
<!-- 新增模板 -->
<insert id="addPlanningCurveTemplate" parameterType="com.ho.business.entity.PlanningCurveTemplate">
insert into planning_curve_template ( id,template_no,template_name,<!-- elec_template_id, -->
<if test="stationId != null and stationId != ''">
station_id,
</if>
<if test="groupId != null and groupId != ''">
group_id,
</if>
income,status,p,capacity,soc_upper,soc_lower,create_time )
values( #{temId},#{templateNo},#{templateName},<!-- #{elecTemplateId}, -->
<if test="stationId != null and stationId != ''">
#{stationId},
</if>
<if test="groupId != null and groupId != ''">
#{groupId},
</if>
#{income},#{status},#{temP},#{capacity},#{socUpper},#{socLower},sysdate() )
insert into planning_curve_template ( id,template_no,template_name,template_name_en,<!-- elec_template_id, -->
<if test="stationId != null and stationId != ''">
station_id,
</if>
<if test="groupId != null and groupId != ''">
group_id,
</if>
income,status,p,capacity,soc_upper,soc_lower,create_time )
values( #{temId},#{templateNo},#{templateName},#{templateNameEn},<!-- #{elecTemplateId}, -->
<if test="stationId != null and stationId != ''">
#{stationId},
</if>
<if test="groupId != null and groupId != ''">
#{groupId},
</if>
#{income},#{status},#{temP},#{capacity},#{socUpper},#{socLower},sysdate() )
</insert>
<!-- 新增曲线 -->
@ -102,6 +111,9 @@
<if test="templateName != null and templateName != ''">
template_name = #{templateName},
</if>
<if test="templateNameEn != null and templateNameEn != ''">
template_name_en = #{templateNameEn},
</if>
<!--
<if test="elecTemplateId != null and elecTemplateId != ''">
elec_template_id = #{elecTemplateId},
@ -170,7 +182,16 @@
tem.elec_template_id elec_template_id, tem.status status, tem.update_time update_time, tem.p tem_p, tem.capacity, tem.soc_upper,
tem.soc_lower, cur.id id, cur.start_time start_time, cur.end_time end_time, ifnull(cur.p,0) p, ifnull(cur.q,0) q, cur.soc soc,cur.planning_template_id
from (
select id,template_no,template_name,elec_template_id,station_id,group_id,income,status,p,capacity,soc_upper,soc_lower,create_time,update_time
select id,template_no,
<choose>
<when test="lang != null and lang=='en_US' ">
template_name_en template_name,
</when>
<otherwise>
template_name,
</otherwise>
</choose>
elec_template_id,station_id,group_id,income,status,p,capacity,soc_upper,soc_lower,create_time,update_time
from planning_curve_template
<where>
<if test="temId != null and temId != ''">
@ -189,7 +210,7 @@
and group_id = #{groupId} or group_id is null
</if>
</where>
) tem left join planning_curve cur on cur.planning_template_id = tem.id
) tem left join planning_curve cur on cur.planning_template_id = tem.id
order by tem.create_time,tem.update_time desc, cur.start_time
</select>

View File

@ -27,11 +27,11 @@
</resultMap>
<insert id="insertList" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
insert into point_config (name,name_en,default_value,point_type,station_id,permission_id,page_location,div_location,sort,device_id,offset_value,factor)
insert into point_config (name,name_en,default_value,default_value_en,point_type,station_id,permission_id,page_location,div_location,sort,device_id,offset_value,factor)
values
<foreach item="item" collection="list" index="index" separator=",">
(
#{item.name},#{item.nameEn},#{item.defaultValue},#{item.pointType},
#{item.name},#{item.nameEn},#{item.defaultValue},#{item.defaultValueEn},#{item.pointType},
#{item.stationId},#{item.permissionId},#{item.pageLocation},#{item.divLocation},#{item.sort},#{item.deviceId},#{item.offsetValue},#{item.factor}
)
</foreach>
@ -53,6 +53,14 @@
</set>
where id = #{id}
</update>
<update id="updateNameEnById">
update ${tableName} set ${nameEn}=#{translateName} where id = #{id}
</update>
<select id="selectTableList" resultType="com.ho.business.vo.resp.dynamicConfig.PointConfigResp">
select
id,${name} name
from ${tableName} where (${nameEn} is null or ${nameEn}='') and ${name} is not null
</select>
<select id="selectByParam" resultType="com.ho.business.vo.resp.dynamicConfig.PointConfigResp">
SELECT
@ -90,10 +98,18 @@
<select id="selectByParamNew" resultMap="baseMap">
SELECT
p.id,
p.name,
p.name as name_zh,
p.name_en,
p.default_value,
<choose>
<when test="lang != null and lang=='en_US' ">
p.name_en name,
d.col_name_en col_name,
p.default_value_en default_value,
</when>
<otherwise>
p.name,
d.col_name,
p.default_value,
</otherwise>
</choose>
p.point_type,
p.station_id,
p.permission_id,
@ -106,9 +122,6 @@
d.src_id,
d.device_type,
d.col,
d.col_name,
d.col_name as col_name_zh,
d.col_name_en,
d.sens_type
FROM
point_config p
@ -138,10 +151,10 @@
</delete>
<insert id="updateList" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
insert into point_config (id,name,name_en,default_value,point_type,station_id,permission_id,page_location,div_location,sort,device_id,offset_value,factor)
insert into point_config (id,name,name_en,default_value,default_value_en,point_type,station_id,permission_id,page_location,div_location,sort,device_id,offset_value,factor)
values
<foreach item="item" collection="list" index="index" separator=",">
(#{item.id},#{item.name},#{item.nameEn},#{item.defaultValue},#{item.pointType},
(#{item.id},#{item.name},#{item.nameEn},#{item.defaultValue},#{item.defaultValueEn},#{item.pointType},
#{item.stationId},#{item.permissionId},#{item.pageLocation},#{item.divLocation},#{item.sort},#{item.deviceId},#{item.offsetValue},#{item.factor}
)
</foreach>

View File

@ -8,6 +8,10 @@
id,point_id,value,name,name as name_zh,name_en,symbol
</sql>
<sql id="Base_Column_List1">
id,point_id,value,name_en name,name as name_zh,name_en,symbol
</sql>
<insert id="insertList" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
insert into point_polysemy_config (point_id,value,name,name_en,symbol)
values
@ -35,7 +39,15 @@
</update>
<select id="selectByPointIds" resultType="com.ho.business.entity.PointPolysemyConfig">
select <include refid="Base_Column_List"/>
select
<choose>
<when test="lang != null and lang=='en_US' ">
<include refid="Base_Column_List1"/>
</when>
<otherwise>
<include refid="Base_Column_List"/>
</otherwise>
</choose>
from point_polysemy_config
<where>
<if test="ids != null and ids.size() != 0">

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ho.business.mapper.TranslateNameMapper">
<sql id="Base_Column_List">
id,`name`,name_en
</sql>
<select id="getDictNation" resultType="com.ho.business.entity.TranslateName">
select <include refid="Base_Column_List"/> from translate_name
</select>
<select id="selectNameEN" resultType="com.ho.business.entity.TranslateName">
select <include refid="Base_Column_List"/> from translate_name where name = #{name} limit 1
</select>
<update id="updateNameEnById">
update translate_name set name_en=#{nameEn} where id = #{id}
</update>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.ho.business.entity.TranslateName"
useGeneratedKeys="true">
insert into translate_name
( id, name, name_en)
values ( #{vo.id,jdbcType=INTEGER}, #{vo.name,jdbcType=VARCHAR}, #{vo.nameEn,jdbcType=VARCHAR})
</insert>
</mapper>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ho.business.mapper.TranslateNationMapper">
<sql id="Base_Column_List">
id,`name`,name_en
</sql>
<select id="getDictNation" resultType="com.ho.business.entity.TranslateNation">
select <include refid="Base_Column_List"/> from translate_nation
</select>
</mapper>

View File

@ -12,7 +12,16 @@
<select id="selectVirtualDeviceCol" resultType="com.ho.business.vo.resp.VirtualDeviceColResp">
select
<include refid="Base_Column_List"/>,factor,offset_value
FROM (select a.*,b.factor,b.offset_value from virtual_device_col a left join device_type_col b on
FROM (select a.id,a.station_id,a.src_id,a.device_col_id,a.col,
<choose>
<when test="lang != null and lang=='en_US' ">
b.col_en col_name,
</when>
<otherwise>
a.col_name,
</otherwise>
</choose>
a.type,b.factor,b.offset_value from virtual_device_col a left join device_type_col b on
a.device_col_id = b.id ) col
<where>
<if test="id != null">

View File

@ -122,7 +122,8 @@ public class BizMergeStrategy extends AbstractMergeStrategy {
}
}
if (excel != null) {
if (ElecPriceTemplateExcel.getDiscount().equals(excel.getDiscount())){ // 名字相同则合并第一列
if (ElecPriceTemplateExcel.getDiscount()!=null &&
ElecPriceTemplateExcel.getDiscount().equals(excel.getDiscount())){ // 名字相同则合并第一列
if (ElecPriceTemplateExcel.getTemplateName().equals(excel.getTemplateName())) {
//如果没有标题,只有表头的话,这里为 BizMergeStrategy.fillStrategyMap(strategyMap, "1", i);
BizMergeStrategy.fillStrategyMap(strategyMap, "8", i );

View File

@ -0,0 +1,49 @@
package com.ho.business.config;
import com.ho.common.tools.annotation.NotSportEnOperation;
import com.ho.common.tools.constant.RedisKeyConstant;
import com.ho.common.tools.exception.BaseResponseCode;
import com.ho.common.tools.exception.BusinessException;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
/**
* @author kerwin
*/
@Aspect
@Component
@Slf4j
public class NotSportEnOperationAspect {
@Pointcut("execution(* com.ho.*.controller.*.*(..))")
public void pointCut() {
}
@Around("pointCut()")
public Object around(ProceedingJoinPoint point) throws Throwable {
ServletRequestAttributes servletAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = servletAttributes.getRequest();
MethodSignature signature = (MethodSignature) point.getSignature();
Method method = signature.getMethod();
NotSportEnOperation notSportEnOperation = method.getAnnotation(NotSportEnOperation.class);
if (null != notSportEnOperation) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
if(RedisKeyConstant.User.EN_US.equals(lang)){
throw new BusinessException(BaseResponseCode.EN_US_NOT_SUPPORT_OPERATION);
}
}
//执行方法
Object result = point.proceed();
//方法执行结果
return result;
}
}

View File

@ -241,7 +241,7 @@ public class AutoDeviceCurveController {
return null;
}
//查点定义
DeviceTypeCol deviceTypeCol = deviceTypeColService.selectTypeAndCol(vo.getCol1(), vo.getDeviceType());
DeviceTypeCol deviceTypeCol = deviceTypeColService.selectTypeAndCol(vo.getCol1(), vo.getDeviceType(),null);
pointCurveHomeResp.setDeviceName(deviceTypeConfig.getName());
if(deviceTypeCol!=null){
pointCurveHomeResp.setCol(vo.getCol1());
@ -298,7 +298,7 @@ public class AutoDeviceCurveController {
BigDecimal oneValue = autoDeviceCurveService.getOneValue(vos_1);
//查点对应的点表信息
//因为配置的点是不带站结尾,所以需要拼接 deviceType
DeviceTypeCol deviceTypeCol = deviceTypeColService.selectTypeAndCol(col1, deviceType);
DeviceTypeCol deviceTypeCol = deviceTypeColService.selectTypeAndCol(col1, deviceType,null);
SingleValueColVo singleValueColVo = new SingleValueColVo();
if(deviceTypeCol!=null){
BeanUtil.copyProperties(deviceTypeCol,singleValueColVo);

View File

@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.ArrayList;
@ -161,7 +162,8 @@ public class CabinController {
@ApiOperation(value = "温度电压正太分布")
@PostMapping("temperatureVoltageData")
public DataResult<TemperatureVoltageResp> temperatureVoltageData(@RequestBody DeviceTreeReq vo) {
public DataResult<TemperatureVoltageResp> temperatureVoltageData(@RequestBody DeviceTreeReq vo, HttpServletRequest request) {
vo.setLang(request.getHeader(RedisKeyConstant.User.LANG));
TemperatureVoltageResp temperatureVoltageData = deviceService.getTemperatureVoltageData(vo);
return DataResult.success(temperatureVoltageData);
}

View File

@ -187,8 +187,9 @@ public class DeviceController {
@GetMapping("{stationId}")
@ApiOperation(value = "查询电站下的设备列表")
public DataResult<List<DeviceRespVO>> getDeviceByStationId(@PathVariable @Valid Integer stationId) {
List<DeviceRespVO> deviceList = deviceService.getDeviceByStationId(stationId);
public DataResult<List<DeviceRespVO>> getDeviceByStationId(@PathVariable @Valid Integer stationId,HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
List<DeviceRespVO> deviceList = deviceService.getDeviceByStationId(stationId,lang);
return DataResult.success(deviceList);
}
@ -283,9 +284,10 @@ public class DeviceController {
@ApiOperation(value = "树状结构设备(设备带接入点,告警页面专用)")
@PostMapping("treeDevices")
public DataResult<List<DevicePointResp>> treeDevices(@RequestBody DeviceStationReqVo deviceTypeReq) {
List<DeviceRespVO> deviceList = deviceService.selectAllDeviceAndSrcIdNotZero(deviceTypeReq.getStationId());
List<DeviceRespVO> deviceRespVOS = deviceService.selectDeviceByStationId(deviceTypeReq.getStationId());
public DataResult<List<DevicePointResp>> treeDevices(@RequestBody DeviceStationReqVo deviceTypeReq,HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
List<DeviceRespVO> deviceList = deviceService.selectAllDeviceAndSrcIdNotZero(deviceTypeReq.getStationId(),lang);
List<DeviceRespVO> deviceRespVOS = deviceService.selectDeviceByStationId(deviceTypeReq.getStationId(),lang);
Map<Integer, List<DeviceRespVO>> dataMap = deviceRespVOS.stream().collect(Collectors.groupingBy(DeviceRespVO::getId));
for (DeviceRespVO deviceRespVO : deviceList) {
if (!dataMap.containsKey(deviceRespVO.getId())) {
@ -301,8 +303,9 @@ public class DeviceController {
@ApiOperation(value = "树状结构设备(储能总览,设备列表页面专用)")
@PostMapping("homePageTreeDevices")
public DataResult<List<DevicePointResp>> homePageTreeDevices(@RequestBody DeviceTreeReq vo) {
List<DeviceRespVO> deviceRespVOS = deviceService.selectByIdAndSrcIdNotZero(vo.getStationId());
public DataResult<List<DevicePointResp>> homePageTreeDevices(@RequestBody DeviceTreeReq vo,HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
List<DeviceRespVO> deviceRespVOS = deviceService.selectByIdAndSrcIdNotZero(vo.getStationId(),lang);
List<DevicePointResp> treeDevices = new ArrayList<>();
if (!deviceRespVOS.isEmpty()) {
treeDevices = deviceTypeConfigService.getTreeDevices(deviceRespVOS, vo.getSrcId());
@ -312,16 +315,18 @@ public class DeviceController {
@ApiOperation(value = "平铺过滤隐藏的真实设备(储能总览设备列表页面APP专用)")
@PostMapping("appHomePageDevices")
public DataResult<List<DeviceRespVO>> appHomePageDevices(@RequestBody DeviceTreeReq vo) {
List<DeviceRespVO> deviceRespVOS = deviceService.selectByIdAndSrcIdNotZero(vo.getStationId());
public DataResult<List<DeviceRespVO>> appHomePageDevices(@RequestBody DeviceTreeReq vo,HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
List<DeviceRespVO> deviceRespVOS = deviceService.selectByIdAndSrcIdNotZero(vo.getStationId(),lang);
deviceRespVOS = deviceRespVOS.stream().filter(i -> i.getCategory() > CommonConstant.TWO).collect(Collectors.toList());
return DataResult.success(deviceRespVOS);
}
@ApiOperation(value = "根据条件生成树状结构设备")
@PostMapping("treeVirtualDevices")
public DataResult<List<DevicePointResp>> treeVirtualDevices(@RequestBody DeviceTreeReq vo) {
List<DeviceRespVO> deviceRespVOS = deviceService.selectAllDeviceAndSrcIdNotZero(vo.getStationId());
public DataResult<List<DevicePointResp>> treeVirtualDevices(@RequestBody DeviceTreeReq vo,HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
List<DeviceRespVO> deviceRespVOS = deviceService.selectAllDeviceAndSrcIdNotZero(vo.getStationId(),lang);
List<DevicePointResp> treeDevices = new ArrayList<>();
if (null != deviceRespVOS && !deviceRespVOS.isEmpty()) {
List<DeviceRespVO> deviceGroupRespVOS = deviceService.selectGroup(deviceRespVOS);
@ -335,8 +340,9 @@ public class DeviceController {
@ApiOperation(value = "根据条件生成树状结构设备(真实设备)")
@TokenIgnore
@PostMapping("treeTrueDevices")
public DataResult<List<DevicePointResp>> treeTrueDevices(@RequestBody DeviceTreeReq vo) {
List<DeviceRespVO> deviceRespVOS = deviceService.selectAllDeviceAndSrcIdNotZero(vo.getStationId());
public DataResult<List<DevicePointResp>> treeTrueDevices(@RequestBody DeviceTreeReq vo,HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
List<DeviceRespVO> deviceRespVOS = deviceService.selectAllDeviceAndSrcIdNotZero(vo.getStationId(),lang);
deviceRespVOS = deviceRespVOS.stream().filter(i -> CommonConstant.ZERO.equals(i.getVirtual())).collect(Collectors.toList());
List<DeviceRespVO> deviceGroupRespVOS = deviceService.selectGroup(deviceRespVOS);
List<DevicePointResp> treeDevices = new ArrayList<>();

View File

@ -139,7 +139,7 @@ public class DeviceTypeColController {
@ApiOperation(value = "导出点表数据")
@LogAnnotation(title = "点表数据操作", action = "导出电表数据")
public void exportExcel(@RequestBody DeviceTypeColRespVO deviceTypeColRespVO, HttpServletResponse response) {
List<DeviceTypeCol> deviceList = deviceTypeColService.selectByDeviceType(deviceTypeColRespVO.getDeviceType());
List<DeviceTypeCol> deviceList = deviceTypeColService.selectByDeviceType(deviceTypeColRespVO.getDeviceType(),null);
String fileName = "点表";
String sheetName = "点表数据";
try {

View File

@ -9,20 +9,25 @@ import com.ho.business.vo.resp.dynamicConfig.CurveConfigQueryResp;
import com.ho.business.vo.resp.dynamicConfig.PointConfigDataResp;
import com.ho.business.vo.resp.dynamicConfig.PointConfigResultResp;
import com.ho.common.tools.annotation.HzPermission;
import com.ho.common.tools.annotation.NotSportEnOperation;
import com.ho.common.tools.annotation.TokenIgnore;
import com.ho.common.tools.constant.CommonConstant;
import com.ho.common.tools.constant.ContextConstant;
import com.ho.common.tools.constant.PermissionConstant;
import com.ho.common.tools.constant.RedisKeyConstant;
import com.ho.common.tools.exception.BaseResponseCode;
import com.ho.common.tools.exception.BusinessException;
import com.ho.common.tools.exception.DataResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jodd.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.stream.Collectors;
@ -37,6 +42,7 @@ public class DynamicConfigController {
@PostMapping("addCurveList")
@ApiOperation(value = "批量增加曲线配置信息")
@HzPermission(PermissionConstant.CURVE_BATCH_CONFIGURATION)
@NotSportEnOperation()
public DataResult addCurve(@RequestBody List<CurveConfigAdd> vo) {
if (vo.isEmpty()) {
throw new BusinessException(BaseResponseCode.NON_DATA);
@ -58,7 +64,8 @@ public class DynamicConfigController {
@PostMapping("queryCurveConfig")
@ApiOperation(value = "查询曲线配置信息")
public DataResult<List<CurveConfigQueryResp>> queryCurveConfig(@RequestBody DynamicConfigQuery vo) {
public DataResult<List<CurveConfigQueryResp>> queryCurveConfig(@RequestBody DynamicConfigQuery vo, HttpServletRequest request) {
vo.setLang(request.getHeader(RedisKeyConstant.User.LANG));
List<CurveConfigQueryResp> result = dynamicConfigService.queryCurveConfig(vo);
return DataResult.success(result);
}
@ -66,6 +73,7 @@ public class DynamicConfigController {
@PostMapping("addPointList")
@ApiOperation(value = "增加点配置信息")
@HzPermission(PermissionConstant.ADDPOINTLIST)
@NotSportEnOperation()
public DataResult addPointList(@RequestBody List<PointConfigAdd> list) {
if (list.isEmpty()) {
throw new BusinessException(BaseResponseCode.NON_DATA);
@ -115,14 +123,16 @@ public class DynamicConfigController {
@PostMapping("pointList")
@ApiOperation(value = "查询配置信息")
public DataResult<List<PointConfigResultResp>> pointList(@RequestBody PointConfigQuery vo) {
public DataResult<List<PointConfigResultResp>> pointList(@RequestBody PointConfigQuery vo, HttpServletRequest request) {
vo.setLang(request.getHeader(RedisKeyConstant.User.LANG));
List<PointConfigResultResp> resultRespList = dynamicConfigService.pointList(vo);
return DataResult.success(resultRespList);
}
@PostMapping("pointListData")
@ApiOperation(value = "配置点数据集合")
public DataResult<List<PointConfigDataResp>> pointListData(@RequestBody PointConfigQuery vo) {
public DataResult<List<PointConfigDataResp>> pointListData(@RequestBody PointConfigQuery vo, HttpServletRequest request) {
vo.setLang(request.getHeader(RedisKeyConstant.User.LANG));
List<PointConfigDataResp> pointConfigData = dynamicConfigService.getPointConfigData(vo);
return DataResult.success(pointConfigData);
}
@ -167,4 +177,17 @@ public class DynamicConfigController {
int count = dynamicConfigService.delDynamicConfigTitle(vo);
return DataResult.success(count);
}
@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 = dynamicConfigService.updatePointNameEn(tableName,name,nameEn);
}
return DataResult.success(count);
}
}

View File

@ -19,6 +19,7 @@ import com.ho.common.tools.annotation.TokenIgnore;
import com.ho.common.tools.constant.CommonConstant;
import com.ho.common.tools.constant.ContextConstant;
import com.ho.common.tools.constant.PermissionConstant;
import com.ho.common.tools.constant.RedisKeyConstant;
import com.ho.common.tools.exception.BaseResponseCode;
import com.ho.common.tools.exception.BusinessException;
import com.ho.common.tools.exception.DataResult;
@ -65,7 +66,8 @@ public class EarningsCalculateController {
@PostMapping("/getTotal")
@ApiOperation(value = "获取月发电量报表")
@TokenIgnore
public DataResult<EarningsCalculateResp> getTotal(@RequestBody EarningsCalculateReq earningsCalculateReq){
public DataResult<EarningsCalculateResp> getTotal(@RequestBody EarningsCalculateReq earningsCalculateReq,HttpServletRequest request){
earningsCalculateReq.setLang(request.getHeader(RedisKeyConstant.User.LANG));
EarningsCalculateResp total = earningsCalculateService.getTotal(earningsCalculateReq,PAGE_LIST_TYPE);
if( earningsCalculateReq != null && earningsCalculateReq.getStationId() != null ){
Integer stationId = earningsCalculateReq.getStationId();
@ -139,6 +141,8 @@ public class EarningsCalculateController {
@PostMapping("/export")
@ApiOperation(value = "导出")
public void export(HttpServletRequest req, HttpServletResponse response, @RequestBody EarningsCalculateReq earningsCalculateReq) {
String lang = req.getHeader(RedisKeyConstant.User.LANG);
earningsCalculateReq.setLang(lang);
EarningsCalculateResp total = earningsCalculateService.getTotal(earningsCalculateReq,PAGE_LIST_TYPE);
ServletOutputStream out = null;
@ -149,9 +153,12 @@ public class EarningsCalculateController {
//文件名字
String fileName = "demo.xlsx";
response.setHeader("Content-disposition", "attachment;filename=" +fileName);
String path="template/earningsTemplate.xlsx";
if(RedisKeyConstant.User.EN_US.equals(lang)){
path="template/earningsTemplateen_US.xlsx";
}
//文件模板输入流
InputStream inputStream = new ClassPathResource("template/earningsTemplate.xlsx").getInputStream();
InputStream inputStream = new ClassPathResource(path).getInputStream();
// 添加合并单元格地址
//List<CellRangeAddress> list = new ArrayList<>();
@ -243,6 +250,8 @@ public class EarningsCalculateController {
@PostMapping("/exportReport")
@ApiOperation(value = "导出")
public void exportReport(HttpServletRequest req, HttpServletResponse response, @RequestBody EarningsCalculateReq earningsCalculateReq) {
String lang = req.getHeader(RedisKeyConstant.User.LANG);
earningsCalculateReq.setLang(lang);
EarningsCalculateResp total = earningsCalculateService.getTotal(earningsCalculateReq,REPORT_LIST_TYPE);
ServletOutputStream out = null;
@ -253,8 +262,12 @@ public class EarningsCalculateController {
//文件名字
String fileName = "demo.xlsx";
response.setHeader("Content-disposition", "attachment;filename=" +fileName);
String path="template/earningsUserTemplate.xlsx";
if(RedisKeyConstant.User.EN_US.equals(lang)){
path="template/earningsUserTemplateen_US.xlsx";
}
//文件模板输入流
InputStream inputStream = new ClassPathResource("template/earningsUserTemplate.xlsx").getInputStream();
InputStream inputStream = new ClassPathResource(path).getInputStream();
// 添加合并单元格地址
//List<CellRangeAddress> list = new ArrayList<>();

View File

@ -9,6 +9,7 @@ import com.ho.business.config.BizMergeStrategy;
import com.ho.business.entity.*;
import com.ho.business.feignclient.FileCenterFeignClient;
import com.ho.business.feignclient.UserFeignClient;
import com.ho.business.service.DynamicConfigService;
import com.ho.business.service.EarningsCalculateService;
import com.ho.business.service.ElecPriceCurveService;
import com.ho.business.service.StationSnService;
@ -22,6 +23,7 @@ import com.ho.business.vo.resp.elecPriceCurve.ElecPriceTemplateExcel;
import com.ho.business.vo.resp.elecPriceCurve.RowRangeDto;
import com.ho.common.tools.annotation.HzPermission;
import com.ho.common.tools.annotation.LogAnnotation;
import com.ho.common.tools.annotation.NotSportEnOperation;
import com.ho.common.tools.annotation.TokenIgnore;
import com.ho.common.tools.constant.CommonConstant;
import com.ho.common.tools.constant.ContextConstant;
@ -35,6 +37,7 @@ import com.ho.common.tools.service.RedisService;
import com.ho.user.api.vo.req.SysSubDictVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jodd.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.BeanUtils;
@ -79,6 +82,9 @@ public class ElecPriceCurveController {
@Autowired
UserFeignClient userFeignClient;
@Autowired
DynamicConfigService dynamicConfigService;
public static final String DICT_TYPE = "electrovalence_type";
private static Map<String, String> staticMap = new HashMap<>(0);
@ -115,6 +121,7 @@ public class ElecPriceCurveController {
@ApiOperation(value = "新增电价曲线模板")
@LogAnnotation(title = "电价曲线模板设置", action = "新增电价曲线模板")
@TokenIgnore
@NotSportEnOperation
public DataResult add(@RequestBody @Valid ElecPriceTemplate elecPriceTemplate, HttpServletRequest request) {
String token = request.getHeader(RedisKeyConstant.User.ACCESS_TOKEN);
SimpleUser user = redisService.getSimpleUserByToken(token);
@ -165,7 +172,8 @@ public class ElecPriceCurveController {
@PostMapping("all")
@ApiOperation(value = "查询所有电价曲线模板")
//@TokenIgnore
public DataResult<List<ElecPriceData>> getAll(@RequestBody @Valid ElecPriceTemplateReqVO vo) {
public DataResult<List<ElecPriceData>> getAll(@RequestBody @Valid ElecPriceTemplateReqVO vo,HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
List<ElecPriceTemplate> list = elecPriceCurveService.getAll(vo);
List<ElecPriceData> resultList = new ArrayList<>();
for (ElecPriceTemplate elecTemplate : list) {
@ -181,6 +189,14 @@ public class ElecPriceCurveController {
data.setBeginTime(elecTemplateSub.getBeginTime());
data.setEndTime(elecTemplateSub.getEndTime());
data.setType(elecTemplateSub.getType());
if(RedisKeyConstant.User.EN_US.equals(lang)){
if(StringUtil.isNotBlank(data.getTemplateName())){
data.setTemplateName(dynamicConfigService.getNameEn(data.getTemplateName()));
}
if(StringUtil.isNotBlank(data.getType())){
data.setType(dynamicConfigService.getNameEn(data.getType()));
}
}
resultList.add(data);
}
}
@ -294,7 +310,8 @@ public class ElecPriceCurveController {
@ApiOperation(value = "导出电价曲线数据")
@LogAnnotation(title = "电价曲线模板设置", action = "导出电价曲线数据")
@HzPermission(PermissionConstant.STRATEGY_ELECURVE_EXPORT)
public void exportExcel(@RequestBody BatchDeleteReq batchDeleteReq ,HttpServletResponse response){
public void exportExcel(@RequestBody BatchDeleteReq batchDeleteReq ,HttpServletResponse response,HttpServletRequest request){
String lang = request.getHeader(RedisKeyConstant.User.LANG);
List<Integer> ids = batchDeleteReq.getIds();
if (ids == null || ids.isEmpty()){
throw new BusinessException(BaseResponseCode.PLEASE_SELECT_ELECTRICITY_PRICE_TEMPLATE_DATA);
@ -321,6 +338,11 @@ public class ElecPriceCurveController {
}else {
excel.setIsEnable(CommonConstant.NOT_IS_ENABlE);
}
if(RedisKeyConstant.User.EN_US.equals(lang)){
excel.setTemplateName(dynamicConfigService.getNameEn(excel.getTemplateName()));
excel.setType(dynamicConfigService.getNameEn(excel.getType()));
excel.setIsEnable(dynamicConfigService.getNameEn(excel.getIsEnable()));
}
excelList.add(excel);
}
}

View File

@ -56,6 +56,7 @@ public class HisCurveRelateController {
String token = request.getHeader(RedisKeyConstant.User.ACCESS_TOKEN);
SimpleUser user = redisService.getSimpleUserByToken(token);
vo.setUserId(user.getUserId());
vo.setLang(request.getHeader(RedisKeyConstant.User.LANG));
PageResult<HisCurveRelate> list = hisCurveRelateService.pageSelectAll(vo);
return DataResult.success(list);
}

View File

@ -319,7 +319,7 @@ public class IargeScreenShowController {
public DataResult<Station> getByStationId(@RequestBody CockpitReqVO vo) {
Station station = new Station();
if (null == vo.getStationId()) {
station.setDeptId(296);
station.setDeptId(155);
} else {
station = stationService.selectById(vo.getStationId());
}

View File

@ -25,6 +25,7 @@ import com.ho.business.vo.resp.station.NewRealTimeCurveVo;
import com.ho.common.tools.annotation.TokenIgnore;
import com.ho.common.tools.constant.CommonConstant;
import com.ho.common.tools.constant.ContextConstant;
import com.ho.common.tools.constant.RedisKeyConstant;
import com.ho.common.tools.exception.DataResult;
import com.ho.common.tools.service.RedisService;
import com.ho.common.tools.util.BigDecimalUtil;
@ -40,6 +41,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.math.BigDecimal;
@ -153,9 +155,10 @@ public class OpenStationController {
@PostMapping("/dynamicRealtimeCurve")
@ApiOperation(value = "动态配置-实时曲线")
@TokenIgnore
public DataResult<List<NewRealTimeCurveVo>> dynamicRealtimeCurve(@RequestBody DynamicConfigQuery vo) {
public DataResult<List<NewRealTimeCurveVo>> dynamicRealtimeCurve(@RequestBody DynamicConfigQuery vo, HttpServletRequest request) {
//默认隐藏曲线不显示
vo.setIsHide(CommonConstant.ZERO);
vo.setLang(request.getHeader(RedisKeyConstant.User.LANG));
List<NewRealTimeCurveVo> resList = stationHomeService.getDynamicRealtimeCurve(vo);
//返回值的BigDecimal类型保留两位小数
for (NewRealTimeCurveVo newRealTimeCurveVo : resList) {
@ -212,7 +215,8 @@ public class OpenStationController {
@PostMapping("/getPcsTotalData")
@ApiOperation(value = "数据总览取PCS计算")
@TokenIgnore
public DataResult<PcsTotalData> getPcsTotalData(@RequestBody StationReq req) {
public DataResult<PcsTotalData> getPcsTotalData(@RequestBody StationReq req,HttpServletRequest request) {
req.setLang(request.getHeader(RedisKeyConstant.User.LANG));
if (req.getDeviceType() == null) {
String deviceType = colCountService.getDeviceType(req.getStationId());
if (null == deviceType) {
@ -298,9 +302,11 @@ public class OpenStationController {
@ApiOperation(value = "多电站导出累计充放电量数据")
//@LogAnnotation(title = "累计充放电量", action = "导出累计充放电量数据")
//@HzPermission(value = {PermissionConstant.REMOTECONTROL_COMMAND_EXPORT,PermissionConstant.DATA_SHOW_EXPORT,PermissionConstant.REMOTECONTROL_COMMAND_EXPORT})
public void exportExcel(@RequestBody @Valid PcsStationReq req, HttpServletResponse response) {
public void exportExcel(@RequestBody @Valid PcsStationReq req, HttpServletResponse response,HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
//功能描述把同一个表格多个sheet测试结果重新输出
openStationService.exportEleData(req, response);
openStationService.exportEleData(req, response,lang);
}

View File

@ -66,7 +66,8 @@ public class PlanningCurveController {
@PostMapping("getPlanningCurveTemplates")
@ApiOperation(value = "模板列表查询")
@TokenIgnore
public DataResult getPlanningCurveTemplates(@RequestBody PlanningCurveTemplate template) {
public DataResult getPlanningCurveTemplates(@RequestBody PlanningCurveTemplate template,HttpServletRequest request) {
template.setLang(request.getHeader(RedisKeyConstant.User.LANG));
List<Map<String, Object>> planningCurveTemplates = planningService.getPlanningCurveTemplates(template);
return DataResult.success(planningCurveTemplates);
}
@ -101,7 +102,8 @@ public class PlanningCurveController {
@PostMapping("planningCurveTemplateDetail")
@ApiOperation(value = "查看详情")
@TokenIgnore
public DataResult planningCurveTemplateDetail(@RequestBody PlanningCurveTemplate template) {
public DataResult planningCurveTemplateDetail(@RequestBody PlanningCurveTemplate template,HttpServletRequest request) {
template.setLang(request.getHeader(RedisKeyConstant.User.LANG));
if( template == null || template.getTemId() == null ){
return DataResult.success();
}

View File

@ -11,6 +11,7 @@ import com.ho.common.tools.annotation.LogAnnotation;
import com.ho.common.tools.annotation.TokenIgnore;
import com.ho.common.tools.constant.ContextConstant;
import com.ho.common.tools.constant.PermissionConstant;
import com.ho.common.tools.constant.RedisKeyConstant;
import com.ho.common.tools.exception.BaseResponseCode;
import com.ho.common.tools.exception.BusinessException;
import com.ho.common.tools.exception.DataResult;
@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@ -38,14 +40,16 @@ public class PlanningCurveIssueController {
@PostMapping("getIssueDevices")
@ApiOperation(value = "查询下发设备接口")
@TokenIgnore
public DataResult getIssueDevices(@RequestBody PlanningIssueDevice issueDevice) {
public DataResult getIssueDevices(@RequestBody PlanningIssueDevice issueDevice, HttpServletRequest request) {
issueDevice.setLang(request.getHeader(RedisKeyConstant.User.LANG));
return DataResult.success(issueService.getIssueDevices(issueDevice));
}
@PostMapping("getTemplate")
@ApiOperation(value = "查询计划曲线模板接口")
@TokenIgnore
public DataResult getTemplate(@RequestBody PlanningIssueDevice issueDevice) {
public DataResult getTemplate(@RequestBody PlanningIssueDevice issueDevice,HttpServletRequest request) {
issueDevice.setLang(request.getHeader(RedisKeyConstant.User.LANG));
return DataResult.success(issueService.getTemplate(issueDevice));
}
@ -104,8 +108,9 @@ public class PlanningCurveIssueController {
@PostMapping("getPlanCurveOperationList")
@ApiOperation(value = "查询计划曲线下发操作记录")
@TokenIgnore
public DataResult<List<PlanCurveOperationRecordReq>> getPlanCurveOperationList(@RequestBody String stationId){
List<PlanCurveOperationRecordReq> result = issueService.getPlanCurveOperationList(stationId);
public DataResult<List<PlanCurveOperationRecordReq>> getPlanCurveOperationList(@RequestBody String stationId,HttpServletRequest request){
String lang = request.getHeader(RedisKeyConstant.User.LANG);
List<PlanCurveOperationRecordReq> result = issueService.getPlanCurveOperationList(stationId,lang);
return DataResult.success(result);
}

View File

@ -127,7 +127,8 @@ public class PointDemoController {
@PostMapping("page")
@ApiOperation(value = "点表列表,分页")
public DataResult<PageResult<PointRespVO>> page(@RequestBody @Valid PointReq pointReq) {
public DataResult<PageResult<PointRespVO>> page(@RequestBody @Valid PointReq pointReq,HttpServletRequest request) {
pointReq.setLang(request.getHeader(RedisKeyConstant.User.LANG));
String name = pointReq.getName();
if (name != null) {
name = name.trim();
@ -162,7 +163,8 @@ public class PointDemoController {
@PostMapping("pointList")
@ApiOperation(value = "点表列表,不分页")
public DataResult<List<PointListRespVo>> pointList(@RequestBody @Valid PointReq pointReq) {
public DataResult<List<PointListRespVo>> pointList(@RequestBody @Valid PointReq pointReq,HttpServletRequest request) {
pointReq.setLang(request.getHeader(RedisKeyConstant.User.LANG));
String name = pointReq.getName();
if (name != null) {
name = name.trim();
@ -174,14 +176,16 @@ public class PointDemoController {
@PostMapping("queryPoint")
@ApiOperation(value = "根据设备查询点表")
public DataResult<List<QueryPointRespVo>> queryPoint(@RequestBody @Valid PointVo vo) {
public DataResult<List<QueryPointRespVo>> queryPoint(@RequestBody @Valid PointVo vo,HttpServletRequest request) {
vo.setLang(request.getHeader(RedisKeyConstant.User.LANG));
List<QueryPointRespVo> pointList = pointDemoService.queryPoint(vo);
return DataResult.success(pointList);
}
@PostMapping("queryVirtualPoint")
@ApiOperation(value = "根据设备查询虚拟点表")
public DataResult<List<QueryPointRespVo>> queryVirtualPoint(@RequestBody @Valid PointVo vo) {
public DataResult<List<QueryPointRespVo>> queryVirtualPoint(@RequestBody @Valid PointVo vo,HttpServletRequest request) {
vo.setLang(request.getHeader(RedisKeyConstant.User.LANG));
List<QueryPointRespVo> pointList = pointDemoService.queryVirtualPoint(vo);
return DataResult.success(pointList);
}
@ -238,13 +242,19 @@ public class PointDemoController {
@PostMapping("/exportExcel")
@LogAnnotation(title = "一体柜点表模块", action = "导出点表数据")
//@HzPermission(value = {PermissionConstant.REMOTECONTROL_COMMAND_EXPORT,PermissionConstant.DATA_SHOW_EXPORT,PermissionConstant.REMOTECONTROL_COMMAND_EXPORT})
public void exportExcel(@RequestBody @Valid PointReq pointReq, HttpServletResponse response) {
public void exportExcel(@RequestBody @Valid PointReq pointReq, HttpServletResponse response,HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
pointReq.setLang(lang);
List<PointRespVO> pointList = pointDemoService.getPointList(pointReq);
String fileName = "点表";
String sheetName = "data";
try {
EasyExcelUtil.writeExcel(response, pointList, fileName, sheetName, PointRespVO.class);
if(RedisKeyConstant.User.EN_US.equals(lang)){
EasyExcelUtil.writeExcel(response, pointList, fileName, sheetName, PointRespEnVO.class);
}else{
EasyExcelUtil.writeExcel(response, pointList, fileName, sheetName, PointRespVO.class);
}
} catch (Exception e) {
e.printStackTrace();
}
@ -259,13 +269,15 @@ public class PointDemoController {
@PostMapping("/hisExportExcel")
@LogAnnotation(title = "一体柜点表模块", action = "导出历史数据")
@HzPermission(PermissionConstant.DATA_HISCURVE_EXPORT)
public void hisExportExcel(@RequestBody @Valid PointCurveReq pointCurveReq, HttpServletResponse response) {
public void hisExportExcel(@RequestBody @Valid PointCurveReq pointCurveReq, HttpServletResponse response, HttpServletRequest request) {
pointCurveReq.setLang(request.getHeader(RedisKeyConstant.User.LANG));
pointDemoService.getHisExportExcel(pointCurveReq, response);
}
@PostMapping("pointCurve")
@ApiOperation(value = "点表曲线")
public DataResult<List<PointCurveResp>> pointCurve(@RequestBody @Valid PointCurveReq pointCurveReq) {
public DataResult<List<PointCurveResp>> pointCurve(@RequestBody @Valid PointCurveReq pointCurveReq, HttpServletRequest request) {
pointCurveReq.setLang(request.getHeader(RedisKeyConstant.User.LANG));
List<PointCurveResp> pointCurveRespList = new ArrayList<>();
//对开始结束时间进行处理 对bug129
if (pointCurveReq.getBeginTime() != null) {
@ -331,7 +343,8 @@ public class PointDemoController {
@PostMapping("pointDataShowList")
@ApiOperation(value = "点表真实数据展示(每个点位分开)")
public DataResult<List<PageResult>> pointDataShowList(@RequestBody @Valid PointCurveReq pointCurveReq) {
public DataResult<List<PageResult>> pointDataShowList(@RequestBody @Valid PointCurveReq pointCurveReq, HttpServletRequest request) {
pointCurveReq.setLang(request.getHeader(RedisKeyConstant.User.LANG));
List<PageResult> pointCurveRespList = new ArrayList<>();
//对传输过来的col集合进行判断是否大于10个
if (pointCurveReq.getDeviceIdList().size() < 50) {
@ -428,9 +441,9 @@ public class PointDemoController {
@PostMapping("getPointCurve")
@ApiOperation(value = "首页根据映射值获取曲线(app界面使用)")
public DataResult<List<PointCurveResp>> getPointCurve(@RequestBody HomePageReqVo vo) {
public DataResult<List<PointCurveResp>> getPointCurve(@RequestBody HomePageReqVo vo, HttpServletRequest request) {
PointCurveReq pointCurveReq = pointDemoService.getPointCurveReq(vo);
List<PointCurveResp> pointCurveRespList = pointCurve(pointCurveReq).getData();
List<PointCurveResp> pointCurveRespList = pointCurve(pointCurveReq,request).getData();
List<PointCurveSrcCol> deviceIdList = pointCurveReq.getDeviceIdList();
if (!deviceIdList.isEmpty()) {
Map<String, BigDecimal> map = deviceIdList.get(0).getMap();

View File

@ -11,6 +11,7 @@ import com.ho.business.vo.req.report.ReportReqVO;
import com.ho.business.vo.resp.income.RevenueOverview;
import com.ho.business.vo.resp.income.RevenueOverviewData;
import com.ho.common.tools.constant.ContextConstant;
import com.ho.common.tools.constant.RedisKeyConstant;
import com.ho.common.tools.exception.DataResult;
import com.ho.common.tools.util.PageResult;
import com.ho.common.tools.util.PageUtils;
@ -22,6 +23,7 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.InputStream;
@ -90,7 +92,8 @@ public class RevenueOverviewController {
@PostMapping("export")
@ApiOperation(value = "导出")
public void export(@RequestBody @Valid ReportReqVO vo, HttpServletResponse response) {
public void export(@RequestBody @Valid ReportReqVO vo, HttpServletResponse response, HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
List<RevenueOverviewData> revenueOverviewData = earningsCalculateService.getRevenueOverviewData(vo);
RevenueOverview investment = earningsCalculateService.getInvestment(vo);
//在内存操作,写到浏览器
@ -102,7 +105,11 @@ public class RevenueOverviewController {
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + new String(fileName.getBytes("UTF-8")));
//文件模板输入流
InputStream inputStream = new ClassPathResource("template/RevenueOverview.xlsx").getInputStream();
String path="template/RevenueOverview.xlsx";
if(RedisKeyConstant.User.EN_US.equals(lang)){
path="template/RevenueOverviewen_US.xlsx";
}
InputStream inputStream = new ClassPathResource(path).getInputStream();
ExcelWriter writer = EasyExcel.write(out).withTemplate(inputStream).build();
WriteSheet sheet = EasyExcel.writerSheet().build();

View File

@ -2,6 +2,7 @@ package com.ho.business.controller;
import com.ho.business.entity.StrategyOverviewUserSet;
import com.ho.business.service.DeviceService;
import com.ho.business.service.DynamicConfigService;
import com.ho.business.service.StationHomeService;
import com.ho.business.service.StrategyOverviewUserSetService;
import com.ho.business.vo.req.OperatingStatistic;
@ -51,16 +52,21 @@ public class StrategyOverviewController {
@Autowired
RedisService redisService;
@Autowired
DynamicConfigService dynamicConfigService;
@PostMapping("cellVoltageAndTemperature")
@ApiOperation("电芯电压/温度分布")
public DataResult<TemperatureVoltageResp> getCellVoltageAndTemperature(@RequestBody @Valid DeviceTreeReq vo) {
public DataResult<TemperatureVoltageResp> getCellVoltageAndTemperature(@RequestBody @Valid DeviceTreeReq vo,HttpServletRequest request) {
vo.setLang(request.getHeader(RedisKeyConstant.User.LANG));
TemperatureVoltageResp temperatureVoltageResp = deviceService.getCellVoltageAndTemperature(vo);
return DataResult.success(temperatureVoltageResp);
}
@PostMapping("cellVoltageAndTemperatureNum")
@ApiOperation("电芯电压/温度分布按序号")
public DataResult<TemperatureVoltageResp> getCellVoltageAndTemperatureNum(@RequestBody @Valid DeviceTreeReq vo) {
public DataResult<TemperatureVoltageResp> getCellVoltageAndTemperatureNum(@RequestBody @Valid DeviceTreeReq vo,HttpServletRequest request) {
vo.setLang(request.getHeader(RedisKeyConstant.User.LANG));
TemperatureVoltageResp temperatureVoltageResp = deviceService.getCellVoltageAndTemperatureNum(vo);
return DataResult.success(temperatureVoltageResp);
}
@ -83,8 +89,15 @@ public class StrategyOverviewController {
@PostMapping("operatingStatistic2")
@ApiOperation("运行统计(soc,soh)")
public DataResult<List<OperatingStatistic>> getOperatingStatistic2(@RequestBody @Valid DeviceTreeReq vo) {
public DataResult<List<OperatingStatistic>> getOperatingStatistic2(@RequestBody @Valid DeviceTreeReq vo,HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
List<OperatingStatistic> list = deviceService.getOperatingStatistic2(vo.getStationId());
//中英切换处理
list.stream().forEach(s->{
if(RedisKeyConstant.User.EN_US.equals(lang)){
s.setName(dynamicConfigService.getNameEn(s.getName()));
}
});
return DataResult.success(list);
}

View File

@ -97,7 +97,7 @@ public class TestReport {
@Test
public void setVirtualDevice(){
List<DeviceTypeCol> list = deviceTypeColService.selectByDeviceType("emu_349");
List<DeviceTypeCol> list = deviceTypeColService.selectByDeviceType("emu_349",null);
list = list.stream().filter(s->{
return CommonConstant.TWO.equals(s.getSensType());
}).collect(Collectors.toList());

View File

@ -0,0 +1,15 @@
package com.ho.common.tools.annotation;
import java.lang.annotation.*;
/**
*
* 切换为英文环境后,不支持配置操作
* @author kerwin
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface NotSportEnOperation {
}

View File

@ -733,10 +733,16 @@ public interface CommonConstant {
String MSG = "设备接入通道";
String MSG_EN = "Equipment access channel ";
String SUCCESS = "恢复";
String SUCCESS_EN = "recover";
String FAIL = "断开";
String FAIL_EN = "disconnect";
String SN_FAIL = "设备接入点离线";
String STATION_FAIL = "离线";
@ -761,6 +767,7 @@ public interface CommonConstant {
String CHECK_MODIFY_VALUE = "命令下发修改值不在范围内";
String DEVICE_NO_SN = "设备没有配置SN";
String DEVICE_NO_SN_EN = "The device is not configured with SN";
String NOT_SN = "没有配置站内接入点";
String INTERVAL = "间隔";
String STATION = "电站";
@ -994,4 +1001,10 @@ public interface CommonConstant {
String CF_FROZEN = "cfFrozen";
//将数据库统配符合“_”变成普通字符
String JOIN_STATION_ID = "\\_";
String REPORT_NAME="月度报表";
String REPORT_NAME_EN="monthly report";
String BILL_NAME="月度账单";
String BILL_NAME_EN="monthly bill";
}

View File

@ -26,9 +26,12 @@ public interface DefineConstant {
String SHARP = "";
String SUMMARY = "汇总";
String SUMMARY_EN = "summary";
String SUMMARY_DATA_STATION = "电站汇总数据";
String SUMMARY_DATA_STATION_EN = "Summary data of power station";
interface PeakShaving {
String ADD_TEMPLATE_SUCCESS = "新增计划曲线模板成功";
String TEMPLATE_CHECK_SIZE = "至少有一个时段和一个计划用电,请确认后重试!";
@ -79,7 +82,11 @@ public interface DefineConstant {
String ANTI_BACKFLOW_METER = "防逆流表";
String TOTAL_ACTIVE_POWER = "总有功功率";
String BUILDING = "(在建)";
String BUILDING_EN = "(under construction)";
String PROPOSED = "(拟建)";
String PROPOSED_EN = "(proposed)";
}
interface PlanningPolicy{
@ -100,6 +107,8 @@ public interface DefineConstant {
interface PointDemo{
String TIME = "时间";
String TIME_EN = "time";
}
interface DeviceTypeCol{

View File

@ -223,6 +223,8 @@ public interface RedisKeyConstant {
String LOGIN_TYPE_PHONE = "phone";
// 语言切换
String LANG="lang";
String EN_US="en_US";
}
//设备相关

View File

@ -468,6 +468,7 @@ public enum BaseResponseCode implements ResponseCodeInterface {
/************************抽取新的********************************/
EXCEL_DATA_NOT_EXIST(500, "不存在昨日负荷数据"),
EXISTS_DUPLICATE_ALARM(500,"该作用范围内的字段已经配置过,重复字符为:"),
EN_US_NOT_SUPPORT_OPERATION(500,"请切换为中文,再操作配置!"),
;
/**

View File

@ -21,23 +21,30 @@ public class TranslateUtils {
// 静态翻译方法:输入待翻译文本,返回目标语言文本
public static String translate(String text) throws IOException {
public static String translate(String text) {
MediaType mediaType = MediaType.parse("application/json");
// 动态构建请求体(支持任意文本)
String jsonBody = String.format("{\"from\":\"zh\",\"to\":\"en\",\"q\":\"%s\"}", text);
RequestBody body = RequestBody.create(mediaType, jsonBody);
Request request = new Request.Builder()
.url("https://aip.baidubce.com/rpc/2.0/mt/texttrans/v1?access_token=" + getAccessToken())
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
Request request = null;
try {
request = new Request.Builder()
.url("https://aip.baidubce.com/rpc/2.0/mt/texttrans/v1?access_token=" + getAccessToken())
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
} catch (IOException e) {
throw new RuntimeException(e);
}
try (Response response = HTTP_CLIENT.newCall(request).execute()) {
String responseBody = response.body().string();
// 解析JSON获取dst值
return parseDstFromResponse(responseBody);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@ -47,7 +54,11 @@ public class TranslateUtils {
JSONObject result = root.getJSONObject("result");
JSONArray transResult = result.getJSONArray("trans_result");
// 获取第一条翻译结果的dst字段
return transResult.getJSONObject(0).getString("dst");
String disStr = transResult.getJSONObject(0).getString("dst");
if(disStr.contains("Zhongzi Technology")){
disStr = disStr.replace("Zhongzi Technology","Sinotech");
}
return disStr;
}
// 示例调用

View File

@ -6,6 +6,7 @@ import com.ho.business.entity.DeviceCall;
import com.ho.business.entity.Topology;
import com.ho.business.service.DeviceCallService;
import com.ho.business.service.DeviceService;
import com.ho.business.service.DynamicConfigService;
import com.ho.common.tools.constant.CommonConstant;
import com.ho.common.tools.constant.RedisKeyConstant;
import com.ho.datacollect.api.constant.DataCollectConstant;
@ -39,6 +40,9 @@ public class DeviceDataCollectServiceImpl implements DataCollectService {
@Autowired
RedissonClient redissonClient;
@Autowired
DynamicConfigService dynamicConfigService;
@Override
public void doService(DataSetParam dataSetParam) {
log.info("DeviceDataCollectServiceImpl===============:{}", dataSetParam);
@ -92,6 +96,7 @@ public class DeviceDataCollectServiceImpl implements DataCollectService {
deviceCall.setStationId(stationId);
deviceCall.setSrcId(topology.getId());
deviceCall.setDeviceName(topology.getName());
deviceCall.setDeviceNameEn(dynamicConfigService.getNameEn(topology.getName()));
deviceCall.setPid(topology.getPid());
deviceCall.setCategory(topology.getCategory());
deviceCall.setCreateTime(new Date());
@ -111,6 +116,7 @@ public class DeviceDataCollectServiceImpl implements DataCollectService {
deviceCall.setStationId(stationId);
deviceCall.setSrcId(CommonConstant.ZERO);
deviceCall.setDeviceName(CommonConstant.ACCESSPOINT);
deviceCall.setDeviceNameEn(dynamicConfigService.getNameEn(CommonConstant.ACCESSPOINT));
deviceCall.setDeviceType(DeviceTypeConstant.ACCESSPOINT);
deviceCall.setPid(pid);
deviceCall.setCreateTime(new Date());

View File

@ -15,6 +15,7 @@ import com.ho.common.tools.service.RedisService;
import com.ho.common.tools.util.CommonBytesUtil;
import com.ho.common.tools.util.MqttUtil;
import com.ho.common.tools.util.PageResult;
import com.ho.common.tools.util.TranslateUtils;
import com.ho.filecenter.entity.MediaFile;
import com.ho.filecenter.service.AnotherFileService;
import com.ho.filecenter.service.FileService;
@ -147,6 +148,7 @@ public class FileController {
@PostMapping("readFileAttribute")
@ApiOperation(value = "读取文件属性")
public DataResult<FileAttributeResp> readFileAttribute(@RequestBody FileAttributeReqVO vo, HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
FileAttributeResp fileAttributeResp = null;
String msg = CommonConstant.Heartbeat.MSG + vo.getSerialNo();
if (fileService.checkHeartbeat(vo.getSerialNo())) {
@ -164,13 +166,17 @@ public class FileController {
// }else{
// fileAttributeResp = anotherFileService.getFileAttribute(vo);
// }
if(RedisKeyConstant.User.EN_US.equals(lang)){
fileAttributeResp.setMsg(TranslateUtils.translate(fileAttributeResp.getMsg()));
}
return DataResult.success(fileAttributeResp);
}
@PostMapping("deleteDeviceFiles")
@ApiOperation(value = "删除文件(删除边端文件)")
@LogAnnotation(title = "文件服务", action = "删除文件(删除边端文件)")
public DataResult<FileDeleteResp> deleteDeviceFiles(@RequestBody FileForDeviceReqVO fileDeleteReqVO) {
public DataResult<FileDeleteResp> deleteDeviceFiles(@RequestBody FileForDeviceReqVO fileDeleteReqVO, HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
FileDeleteResp fileDeleteResp = null;
String msg = CommonConstant.Heartbeat.MSG + fileDeleteReqVO.getSerialNo();
if (fileService.checkHeartbeat(fileDeleteReqVO.getSerialNo())) {
@ -179,13 +185,12 @@ public class FileController {
fileDeleteResp.setMsg(msg + CommonConstant.Heartbeat.FAIL);
return DataResult.success(fileDeleteResp);
}
// String serialNo = fileDeleteReqVO.getSerialNo();
// List<String> snList = MqttConfigUtil.getSnList();
// if(snList.stream().anyMatch(s -> s.contains(serialNo))){
fileDeleteResp = fileService.deleteDeviceFiles(fileDeleteReqVO);
// }else{
// fileDeleteResp = anotherFileService.deleteDeviceFiles(fileDeleteReqVO);
// }
fileDeleteResp = fileService.deleteDeviceFiles(fileDeleteReqVO);
if(RedisKeyConstant.User.EN_US.equals(lang)){
fileDeleteResp.setMsg(TranslateUtils.translate(fileDeleteResp.getMsg()));
}
return DataResult.success(fileDeleteResp);
}
@ -193,7 +198,8 @@ public class FileController {
@ApiOperation(value = "文件上传(向边端上传)")
//@HzPermission(value = PermissionConstant.REMOTECONTROL_FILE_UPLOAD)
@LogAnnotation(title = "文件服务", action = "文件上传(向边端上传)")
public DataResult<HeartbeatResp> fileUploadForDevice(@RequestPart("file") MultipartFile file, @RequestParam("stationId") Integer stationId, @RequestParam("serialNo") String serialNo, @RequestParam("filePath") String filePath) {
public DataResult<HeartbeatResp> fileUploadForDevice(HttpServletRequest request,@RequestPart("file") MultipartFile file, @RequestParam("stationId") Integer stationId, @RequestParam("serialNo") String serialNo, @RequestParam("filePath") String filePath) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
HeartbeatResp resp = fileService.checkHeartAndFileUsing(stationId, serialNo);
if (null == resp) {
resp = new HeartbeatResp();
@ -217,6 +223,9 @@ public class FileController {
// anotherFileService.fileUploadForDevice(file, stationId, serialNo, filePath);
// }
}
if(RedisKeyConstant.User.EN_US.equals(lang)){
resp.setMsg(TranslateUtils.translate(resp.getMsg()));
}
return DataResult.success(resp);
}
@ -224,7 +233,7 @@ public class FileController {
@PostMapping("downloadFromDevice")
@ApiOperation(value = "文件下载(从边端下载到浏览器)")
@LogAnnotation(title = "文件服务", action = "文件下载")
public DataResult<HeartbeatResp> downloadFromDevice(@RequestBody FileForDeviceReqVO fileForDeviceReqVO) {
public DataResult<HeartbeatResp> downloadFromDevice(@RequestBody FileForDeviceReqVO fileForDeviceReqVO,HttpServletRequest request) {
//todo 测试模拟返回成功
/*if(true){
HeartbeatResp heart = new HeartbeatResp();
@ -232,6 +241,7 @@ public class FileController {
return DataResult.success(heart);
}*/
String lang = request.getHeader(RedisKeyConstant.User.LANG);
HeartbeatResp resp = fileService.checkHeartAndFileUsing(fileForDeviceReqVO.getStationId(), fileForDeviceReqVO.getSerialNo());
if (null == resp) {
resp = new HeartbeatResp();
@ -247,12 +257,15 @@ public class FileController {
// anotherFileService.downloadFromDevice(fileForDeviceReqVO);
// }
}
if(RedisKeyConstant.User.EN_US.equals(lang)){
resp.setMsg(TranslateUtils.translate(resp.getMsg()));
}
return DataResult.success(resp);
}
@PostMapping("downloadProgressBar")
@ApiOperation(value = "文件下载进度(从边端下载到浏览器)")
public DataResult<FileProcessRespVO> downloadProgressBar(@RequestBody FileProcessReqVO vo, HttpServletResponse response) {
public DataResult<FileProcessRespVO> downloadProgressBar(@RequestBody FileProcessReqVO vo, HttpServletResponse response,HttpServletRequest request) {
//todo 测试模拟返回成功
/*if(true){
FileProcessRespVO file =new FileProcessRespVO();
@ -260,7 +273,11 @@ public class FileController {
file.setFileStatus(1);
return DataResult.success(file);
}*/
String lang = request.getHeader(RedisKeyConstant.User.LANG);
FileProcessRespVO fileProcessRespVO = fileService.getDownloadProgress(vo);
if(RedisKeyConstant.User.EN_US.equals(lang)){
fileProcessRespVO.setMsg(TranslateUtils.translate(fileProcessRespVO.getMsg()));
}
return DataResult.success(fileProcessRespVO);
}

View File

@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -46,7 +47,8 @@ public class HeartbeatCheckController {
@PostMapping("getHeartbeat")
@ApiOperation(value = "心跳检测")
public DataResult<HeartbeatResp> getHeartbeat(@RequestBody HeartbeatReq vo) {
public DataResult<HeartbeatResp> getHeartbeat(@RequestBody HeartbeatReq vo, HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
HeartbeatResp heartbeatResp = new HeartbeatResp();
//检测心跳
DeviceReqVO deviceReqVO = new DeviceReqVO();
@ -57,11 +59,18 @@ public class HeartbeatCheckController {
log.info("getHeartbeat 当前设备没有配置SN");
heartbeatResp.setHeartbeatStatus(CommonConstant.ZERO);
heartbeatResp.setMsg(CommonConstant.DEVICE_NO_SN);
if(RedisKeyConstant.User.EN_US.equals(lang)){
heartbeatResp.setMsg(CommonConstant.DEVICE_NO_SN_EN);
}
return DataResult.success(heartbeatResp);
}
String sn = deviceList.get(0).getSerialNo();
String heartbeatKey = RedisKeyConstant.HEARTBEAT + sn;
String msg = CommonConstant.Heartbeat.MSG + sn;
if(RedisKeyConstant.User.EN_US.equals(lang)){
msg = CommonConstant.Heartbeat.MSG_EN + sn;
}
if (redisService.hasKey(heartbeatKey)) {
Map<Object, Object> hgetall = redisService.hgetall(heartbeatKey);
Date updateTime = (Date) hgetall.get(CommonConstant.UPDATE_TIME);
@ -70,16 +79,25 @@ public class HeartbeatCheckController {
if (between >= 5) {
heartbeatResp.setHeartbeatStatus(CommonConstant.ZERO);
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL);
if(RedisKeyConstant.User.EN_US.equals(lang)){
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL_EN);
}
log.info("getHeartbeat 超过5分钟没有检测到心跳{}", between);
return DataResult.success(heartbeatResp);
}
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.SUCCESS);
if(RedisKeyConstant.User.EN_US.equals(lang)){
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.SUCCESS_EN);
}
heartbeatResp.setHeartbeatStatus(CommonConstant.ONE);
return DataResult.success(heartbeatResp);
} else {
log.info("getHeartbeat 没有检测到心跳{}", heartbeatKey);
heartbeatResp.setHeartbeatStatus(CommonConstant.ZERO);
heartbeatResp.setMsg(msg + sn + CommonConstant.Heartbeat.FAIL);
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL);
if(RedisKeyConstant.User.EN_US.equals(lang)){
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL_EN);
}
return DataResult.success(heartbeatResp);
}
}

View File

@ -16,6 +16,7 @@ import com.ho.common.tools.exception.BusinessException;
import com.ho.common.tools.exception.DataResult;
import com.ho.common.tools.service.RedisService;
import com.ho.common.tools.util.PageResult;
import com.ho.common.tools.util.TranslateUtils;
import com.ho.filecenter.feignclient.BusinessFeignClient;
import com.ho.filecenter.feignclient.UserFeignClient;
import com.ho.filecenter.service.AnotherOrderSendService;
@ -36,6 +37,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -71,13 +73,19 @@ public class OrderSendController {
@ApiOperation(value = "指令下发")
//@HzPermission(value = {PermissionConstant.REMOTECONTROL_COMMAND_BATCHDISTRIBUTION,PermissionConstant.STRATEGY_PLANCURVEDIS_COMMANDISSUANCE,PermissionConstant.REMOTECONTROL_COMMAND_SINGLEREFRESH})
// @LogAnnotation(title = "命令下发", action = "指令下发")
public DataResult<HeartbeatResp> orderIssued(@RequestBody OrderIssuedReqVO vo) {
public DataResult<HeartbeatResp> orderIssued(@RequestBody OrderIssuedReqVO vo, HttpServletRequest request) {
// String token = request.getHeader(RedisKeyConstant.User.ACCESS_TOKEN);
// UserDetailRespVO userDetailRespVO = redisService.getUserDetailByToken(token);
// String userName = userDetailRespVO.getUsername();
// String userNameKey = redisService.getUserNameKey(userDetailRespVO, userName);
// SimpleUser user = (SimpleUser) redisService.get(userNameKey);
return getDataResult(vo);
String lang = request.getHeader(RedisKeyConstant.User.LANG);
DataResult result = getDataResult(vo);
if(RedisKeyConstant.User.EN_US.equals(lang)){
HeartbeatResp heartbeatResp= (HeartbeatResp)result.getData();
heartbeatResp.setMsg(TranslateUtils.translate(heartbeatResp.getMsg()));
}
return result;
}
@NotNull
@ -227,7 +235,8 @@ public class OrderSendController {
@PostMapping("progressBar")
@ApiOperation(value = "指令下发进度")
@TokenIgnore
public DataResult<OrderProcessResp> progressBar(@RequestBody OrderProgressReqVO vo) {
public DataResult<OrderProcessResp> progressBar(@RequestBody OrderProgressReqVO vo, HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
String key = vo.getStationId() + ":" + vo.getSrcId();
log.info("指令下发进度 key:{}", key);
OrderProcessResp orderProcessResp = new OrderProcessResp();
@ -280,13 +289,16 @@ public class OrderSendController {
}
}
orderProcessResp.setProcessList(processDetailRespList);
if(RedisKeyConstant.User.EN_US.equals(lang)){
orderProcessResp.setMsg(TranslateUtils.translate(orderProcessResp.getMsg()));
}
return DataResult.success(orderProcessResp);
}
@PostMapping("apiOrderIssued")
@ApiOperation(value = "指令下发(对外提供)")
@TokenIgnore
public DataResult<HeartbeatResp> apiOrderIssued(@RequestBody ApiOrderIssuedReqVO vo) {
public DataResult<HeartbeatResp> apiOrderIssued(@RequestBody ApiOrderIssuedReqVO vo, HttpServletRequest request) {
SysSubDictVO sysSubDictVO = new SysSubDictVO();
sysSubDictVO.setType(CommonConstant.PUSH_DATA);
Map<String, String> sysSubDict = userFeignClient.getSysSubDict(sysSubDictVO);
@ -297,7 +309,7 @@ public class OrderSendController {
for (OrderIssuedVO orderIssuedVO : list) {
orderIssuedVO.setStationId(Integer.valueOf(stationId));
}
DataResult<HeartbeatResp> heartbeatRespDataResult = orderIssued(vo);
DataResult<HeartbeatResp> heartbeatRespDataResult = orderIssued(vo,request);
heartbeatResp = heartbeatRespDataResult.getData();
}
return DataResult.success(heartbeatResp);
@ -306,7 +318,7 @@ public class OrderSendController {
@PostMapping("apiProgressBar")
@ApiOperation(value = "指令下发进度(对外提供)")
@TokenIgnore
public DataResult<OrderProcessResp> apiProgressBar(@RequestBody ApiOrderProgressReqVO apiVo) {
public DataResult<OrderProcessResp> apiProgressBar(@RequestBody ApiOrderProgressReqVO apiVo, HttpServletRequest request) {
SysSubDictVO sysSubDictVO = new SysSubDictVO();
sysSubDictVO.setType(CommonConstant.PUSH_DATA);
Map<String, String> sysSubDict = userFeignClient.getSysSubDict(sysSubDictVO);
@ -316,7 +328,7 @@ public class OrderSendController {
OrderProgressReqVO vo = new OrderProgressReqVO();
vo.setStationId(Integer.valueOf(stationId));
vo.setSrcId(apiVo.getSrcId());
DataResult<OrderProcessResp> orderProcessRespDataResult = progressBar(vo);
DataResult<OrderProcessResp> orderProcessRespDataResult = progressBar(vo,request);
orderProcessResp = orderProcessRespDataResult.getData();
}
return DataResult.success(orderProcessResp);
@ -326,16 +338,24 @@ public class OrderSendController {
@ApiOperation(value = "命令下发曲线")
// @LogAnnotation(title = "命令下发曲线", action = "命令下发曲线")
@TokenIgnore
public DataResult<HeartbeatResp> sendPlanPowerOrder(@RequestBody OrderPlanPowerReq vo) {
public DataResult<HeartbeatResp> sendPlanPowerOrder(@RequestBody OrderPlanPowerReq vo, HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
HeartbeatResp heartbeatResp = orderSendService.sendPlanPowerOrder(vo);
if(RedisKeyConstant.User.EN_US.equals(lang)){
heartbeatResp.setMsg(TranslateUtils.translate(heartbeatResp.getMsg()));
}
return DataResult.success(heartbeatResp);
}
@PostMapping("planPowerProgressBar")
@ApiOperation(value = "指令下发进度")
@TokenIgnore
public DataResult<OrderProcessResp> planPowerProgressBar(@RequestBody OrderPlanPowerReq vo) {
public DataResult<OrderProcessResp> planPowerProgressBar(@RequestBody OrderPlanPowerReq vo, HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
OrderProcessResp orderProcessResp = orderSendService.planPowerProgressBar(vo);
if(RedisKeyConstant.User.EN_US.equals(lang)){
orderProcessResp.setMsg(TranslateUtils.translate(orderProcessResp.getMsg()));
}
return DataResult.success(orderProcessResp);
}
@ -343,7 +363,13 @@ public class OrderSendController {
@PostMapping("orderIssued4plan")
@ApiOperation(value = "指令下发")
@TokenIgnore
public DataResult<HeartbeatResp> orderIssued4plan(@RequestBody OrderIssuedReqVO vo) {
return this.getDataResult(vo);
public DataResult<HeartbeatResp> orderIssued4plan(@RequestBody OrderIssuedReqVO vo, HttpServletRequest request) {
String lang = request.getHeader(RedisKeyConstant.User.LANG);
DataResult result = getDataResult(vo);
if(RedisKeyConstant.User.EN_US.equals(lang)){
HeartbeatResp heartbeatResp= (HeartbeatResp)result.getData();
heartbeatResp.setMsg(TranslateUtils.translate(heartbeatResp.getMsg()));
}
return result;
}
}

View File

@ -64,6 +64,9 @@ public class Event implements Serializable {
@ApiModelProperty(value = "事件描述")
private String description;
@ApiModelProperty(value = "事件描述-英文")
private String descriptionEn;
@ApiModelProperty(value = "1 已确认 0 未确认")
private Integer confirmStatus;

View File

@ -0,0 +1,18 @@
package com.ho.flow.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author kerwin
*/
@Data
public class EventVo {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "名称")
private String name;
}

View File

@ -18,4 +18,8 @@ public class DropDownReq {
@ApiModelProperty(value = "当前节点名")
String currentStep;
@ApiModelProperty(value = "中英切换-查询字段")
private String lang;
}

Some files were not shown because too many files have changed in this diff Show More