多语言功能修改

This commit is contained in:
2026-01-21 15:02:10 +08:00
parent 69a117105b
commit f417e661ce
6 changed files with 60 additions and 15 deletions

View File

@ -36,7 +36,7 @@ public interface StationHomeService {
* @param stationId 电站id * @param stationId 电站id
* @return * @return
*/ */
PcsStationData getPcsStationData(Integer stationId); PcsStationData getPcsStationData(Integer stationId,String lang);
/** /**
* 根据电站id查询数据总览 * 根据电站id查询数据总览

View File

@ -225,19 +225,19 @@ public class EarningsCalculateServiceImpl implements EarningsCalculateService {
billName = CommonConstant.BILL_NAME_SPA; billName = CommonConstant.BILL_NAME_SPA;
name = station.getNameSpa(); name = station.getNameSpa();
} }
if(CommonConstant.langTemp.AR_EG.equals(earningsCalculateReq.getLang())){
reportName = CommonConstant.REPORT_NAME_ARA;
billName = CommonConstant.BILL_NAME_ARA;
name = station.getNameDe();
}
if(CommonConstant.langTemp.DE_DE.equals(earningsCalculateReq.getLang())){ if(CommonConstant.langTemp.DE_DE.equals(earningsCalculateReq.getLang())){
reportName = CommonConstant.REPORT_NAME_DE; reportName = CommonConstant.REPORT_NAME_DE;
billName = CommonConstant.BILL_NAME_DE; billName = CommonConstant.BILL_NAME_DE;
name = station.getNamePl(); name = station.getNameDe();
} }
if(CommonConstant.langTemp.PL_PL.equals(earningsCalculateReq.getLang())){ if(CommonConstant.langTemp.PL_PL.equals(earningsCalculateReq.getLang())){
reportName = CommonConstant.REPORT_NAME_PL; reportName = CommonConstant.REPORT_NAME_PL;
billName = CommonConstant.BILL_NAME_PL; billName = CommonConstant.BILL_NAME_PL;
name = station.getNamePl();
}
if(CommonConstant.langTemp.AR_EG.equals(earningsCalculateReq.getLang())){
reportName = CommonConstant.REPORT_NAME_ARA;
billName = CommonConstant.BILL_NAME_ARA;
name = station.getNameAra(); name = station.getNameAra();
} }
// 电站名称(报表标题) // 电站名称(报表标题)

View File

@ -601,7 +601,7 @@ public class StationHomeServiceImpl implements StationHomeService {
* @return * @return
*/ */
@Override @Override
public PcsStationData getPcsStationData(Integer stationId) { public PcsStationData getPcsStationData(Integer stationId,String lang) {
//根据id查询电站 //根据id查询电站
Station station = stationService.selectById(stationId); Station station = stationService.selectById(stationId);
if (station == null) { if (station == null) {
@ -612,10 +612,51 @@ public class StationHomeServiceImpl implements StationHomeService {
BeanUtils.copyProperties(station, data); BeanUtils.copyProperties(station, data);
//计算运行天数 //计算运行天数
String operationDayStr = null; String operationDayStr = null;
String name = station.getName();
if (station.getStatus().equals(CommonConstant.TWO)) { if (station.getStatus().equals(CommonConstant.TWO)) {
if(CommonConstant.langTemp.EN_US.equals(lang)){
operationDayStr = DefineConstant.StationHome.BUILDING_EN;
name = station.getNameEn();
}else if(CommonConstant.langTemp.FR_FR.equals(lang)){
operationDayStr = DefineConstant.StationHome.BUILDING_FRA;
name = station.getNameFra();
}else if(CommonConstant.langTemp.ES_ES.equals(lang)){
operationDayStr = DefineConstant.StationHome.BUILDING_SPA;
name = station.getNameSpa();
}else if(CommonConstant.langTemp.AR_EG.equals(lang)){
operationDayStr = DefineConstant.StationHome.BUILDING_ARA;
name = station.getNameAra();
}else if(CommonConstant.langTemp.DE_DE.equals(lang)){
operationDayStr = DefineConstant.StationHome.BUILDING_DE;
name = station.getNameDe();
}else if(CommonConstant.langTemp.PL_PL.equals(lang)){
operationDayStr = DefineConstant.StationHome.BUILDING_PL;
name = station.getNamePl();
}else{
operationDayStr = DefineConstant.StationHome.BUILDING; operationDayStr = DefineConstant.StationHome.BUILDING;
}
} else if (station.getStatus().equals(CommonConstant.THREE)) { } else if (station.getStatus().equals(CommonConstant.THREE)) {
if(CommonConstant.langTemp.EN_US.equals(lang)){
operationDayStr = DefineConstant.StationHome.PROPOSED_EN;
name = station.getNameEn();
}else if(CommonConstant.langTemp.FR_FR.equals(lang)){
operationDayStr = DefineConstant.StationHome.PROPOSED_FRA;
name = station.getNameFra();
}else if(CommonConstant.langTemp.ES_ES.equals(lang)){
operationDayStr = DefineConstant.StationHome.PROPOSED_SPA;
name = station.getNameSpa();
}else if(CommonConstant.langTemp.AR_EG.equals(lang)){
operationDayStr = DefineConstant.StationHome.PROPOSED_ARA;
name = station.getNameAra();
}else if(CommonConstant.langTemp.DE_DE.equals(lang)){
operationDayStr = DefineConstant.StationHome.PROPOSED_DE;
name = station.getNameDe();
}else if(CommonConstant.langTemp.PL_PL.equals(lang)){
operationDayStr = DefineConstant.StationHome.PROPOSED_PL;
name = station.getNamePl();
}else{
operationDayStr = DefineConstant.StationHome.PROPOSED; operationDayStr = DefineConstant.StationHome.PROPOSED;
}
} else { } else {
long operationDays = DateUtil.between(station.getGridTime(), new Date(), DateUnit.DAY); long operationDays = DateUtil.between(station.getGridTime(), new Date(), DateUnit.DAY);
operationDayStr = Long.toString(operationDays); operationDayStr = Long.toString(operationDays);
@ -626,6 +667,7 @@ public class StationHomeServiceImpl implements StationHomeService {
// long operationDays = DateUtil.between(station.getGridTime(), new Date(), DateUnit.DAY); // long operationDays = DateUtil.between(station.getGridTime(), new Date(), DateUnit.DAY);
data.setOperationDays(operationDayStr); data.setOperationDays(operationDayStr);
data.setName(name);
return data; return data;
} }
@ -1579,7 +1621,7 @@ public class StationHomeServiceImpl implements StationHomeService {
@Override @Override
public OutStationData getStationData(StationReq req) { public OutStationData getStationData(StationReq req) {
OutStationData outStationData = new OutStationData(); OutStationData outStationData = new OutStationData();
PcsStationData pcsStationData = getPcsStationData(req.getStationId()); PcsStationData pcsStationData = getPcsStationData(req.getStationId(),req.getLang());
BeanUtils.copyProperties(pcsStationData, outStationData); BeanUtils.copyProperties(pcsStationData, outStationData);
if (req.getDeviceType() == null) { if (req.getDeviceType() == null) {
String deviceType = colCountService.getDeviceType(req.getStationId()); String deviceType = colCountService.getDeviceType(req.getStationId());

View File

@ -179,8 +179,9 @@ public class OpenStationController {
@PostMapping("/pcsStationData") @PostMapping("/pcsStationData")
@ApiOperation(value = "电站信息") @ApiOperation(value = "电站信息")
public DataResult<PcsStationData> getPcsStationData(@RequestBody StationReq req) { public DataResult<PcsStationData> getPcsStationData(@RequestBody StationReq req,HttpServletRequest request) {
PcsStationData data = stationHomeService.getPcsStationData(req.getStationId()); String lang = request.getHeader(CommonConstant.LANG);
PcsStationData data = stationHomeService.getPcsStationData(req.getStationId(),lang);
return DataResult.success(data); return DataResult.success(data);
} }

View File

@ -892,8 +892,9 @@ public class OuterApiController {
@PostMapping("/pcsStationData") @PostMapping("/pcsStationData")
@ApiOperation(value = "电站信息") @ApiOperation(value = "电站信息")
@TokenIgnore @TokenIgnore
public DataResult<PcsStationData> getPcsStationData(@RequestBody StationReq req) { public DataResult<PcsStationData> getPcsStationData(@RequestBody StationReq req,HttpServletRequest request) {
PcsStationData data = stationHomeService.getPcsStationData(req.getStationId()); String lang = request.getHeader(CommonConstant.LANG);
PcsStationData data = stationHomeService.getPcsStationData(req.getStationId(),lang);
return DataResult.success(data); return DataResult.success(data);
} }

View File

@ -198,6 +198,7 @@ public class EventServiceImpl implements EventService {
List<Long> eventIds = new ArrayList<>(); List<Long> eventIds = new ArrayList<>();
StationPageReqVO spv = new StationPageReqVO(); StationPageReqVO spv = new StationPageReqVO();
spv.setIds(stationIdList); spv.setIds(stationIdList);
spv.setLang(vo.getLang());
DataResult<List<Station>> listDataResult = businessFeignClient.selectStationByCondition(spv); DataResult<List<Station>> listDataResult = businessFeignClient.selectStationByCondition(spv);
List<Station> stationList = listDataResult.getData(); List<Station> stationList = listDataResult.getData();
Map<Integer, String> stationIdNameMap = stationList.stream().collect(Collectors.toMap(Station::getId, Station::getName)); Map<Integer, String> stationIdNameMap = stationList.stream().collect(Collectors.toMap(Station::getId, Station::getName));