海外平台-数据全英文化

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

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