多语言(英语、法语、西班牙语、德语、波兰语、阿拉伯语)处理

This commit is contained in:
2026-01-15 16:22:43 +08:00
parent 41f0b72253
commit c626e3256f
17 changed files with 109 additions and 61 deletions

View File

@ -5,6 +5,7 @@ import com.ho.business.service.HisCurveRelateService;
import com.ho.business.vo.req.modelType.ModelTypeQueryReq;
import com.ho.business.vo.req.point.HisPointReqVo;
import com.ho.common.tools.annotation.LogAnnotation;
import com.ho.common.tools.annotation.NotSportEnOperation;
import com.ho.common.tools.constant.CommonConstant;
import com.ho.common.tools.constant.ContextConstant;
import com.ho.common.tools.constant.RedisKeyConstant;
@ -43,6 +44,7 @@ public class HisCurveRelateController {
@ApiOperation(value = "新增历史曲线字典模板")
@LogAnnotation(title = "业务模块-曲线相关衍生功能", action = "新增")
//@TokenIgnore
@NotSportEnOperation
public DataResult add(@RequestBody @Valid HisPointReqVo hisPointReqVo, HttpServletRequest request) {
String token = request.getHeader(RedisKeyConstant.User.ACCESS_TOKEN);
SimpleUser user = redisService.getSimpleUserByToken(token);

View File

@ -9,6 +9,7 @@ import com.ho.business.vo.req.cockpit.CockpitReqVO;
import com.ho.business.vo.resp.iargeScreen.*;
import com.ho.common.tools.annotation.CommonLargeScreenToken;
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.entity.SimpleUser;
@ -239,7 +240,8 @@ public class IargeScreenShowController {
@TokenIgnore
@CommonLargeScreenToken
public DataResult<List<Subdata>> getCommonIncomeList(HttpServletRequest request) {
List<Subdata> regionList = iargeScreenShowService.getCommonProfit(null, null, getSimpleUser(request));
String lang = request.getHeader(CommonConstant.LANG);
List<Subdata> regionList = iargeScreenShowService.getCommonProfit(null, null, getSimpleUser(request),lang);
if (regionList.size() > maxSize) {
regionList = regionList.subList(0, maxSize);
}
@ -255,7 +257,8 @@ public class IargeScreenShowController {
@TokenIgnore
@CommonLargeScreenToken
public DataResult<List<Subdata>> getCommonEfficiencyDate(HttpServletRequest request) {
List<Subdata> efficiencyList = iargeScreenShowService.getCommonEfficiencyDate(getSimpleUser(request));
String lang = request.getHeader(CommonConstant.LANG);
List<Subdata> efficiencyList = iargeScreenShowService.getCommonEfficiencyDate(getSimpleUser(request),lang);
return DataResult.success(efficiencyList);
}
@ -264,10 +267,11 @@ public class IargeScreenShowController {
@TokenIgnore
@CommonLargeScreenToken
public DataResult<List<Station>> getCommonStationInfo(HttpServletRequest request) {
String lang = request.getHeader(CommonConstant.LANG);
List<Integer> ids = getSimpleUser(request);
List<Station> stations = new ArrayList<>();
if (ids != null) {
stations = iargeScreenShowService.getCountStations(ids);
stations = iargeScreenShowService.getCountStations(ids,lang);
}
return DataResult.success(stations);
}
@ -277,7 +281,8 @@ public class IargeScreenShowController {
@TokenIgnore
@CommonLargeScreenToken
public DataResult<List<Subdata>> getCommonCapacity(HttpServletRequest request) {
List<Subdata> regionList = iargeScreenShowService.getCommonCapacity(getSimpleUser(request));
String lang = request.getHeader(CommonConstant.LANG);
List<Subdata> regionList = iargeScreenShowService.getCommonCapacity(getSimpleUser(request),lang);
return DataResult.success(regionList);
}
@ -375,8 +380,9 @@ public class IargeScreenShowController {
@PostMapping("getZhongZiIncomeList")
@ApiOperation(value = "中自电站收益排名")
@TokenIgnore
public DataResult<List<Subdata>> getZhongZiIncomeList(@RequestBody CockpitReqVO vo) {
List<Subdata> regionList = iargeScreenShowService.getCommonProfit(null, null, getByDeptId(vo.getDeptId()));
public DataResult<List<Subdata>> getZhongZiIncomeList(@RequestBody CockpitReqVO vo,HttpServletRequest request) {
String lang = request.getHeader(CommonConstant.LANG);
List<Subdata> regionList = iargeScreenShowService.getCommonProfit(null, null, getByDeptId(vo.getDeptId()),lang);
if (regionList.size() > maxSize) {
regionList = regionList.subList(0, maxSize);
}
@ -390,19 +396,21 @@ public class IargeScreenShowController {
@PostMapping("getZhongZiEfficiencyDate")
@ApiOperation(value = "中自系统转换率")
@TokenIgnore
public DataResult<List<Subdata>> getZhongZiEfficiencyDate(@RequestBody CockpitReqVO vo) {
List<Subdata> efficiencyList = iargeScreenShowService.getCommonEfficiencyDate(getByDeptId(vo.getDeptId()));
public DataResult<List<Subdata>> getZhongZiEfficiencyDate(@RequestBody CockpitReqVO vo,HttpServletRequest request) {
String lang = request.getHeader(CommonConstant.LANG);
List<Subdata> efficiencyList = iargeScreenShowService.getCommonEfficiencyDate(getByDeptId(vo.getDeptId()),lang);
return DataResult.success(efficiencyList);
}
@PostMapping("getZhongZiStationInfo")
@ApiOperation(value = "获取中自电站信息")
@TokenIgnore
public DataResult<List<Station>> getZhongZiStationInfo(@RequestBody CockpitReqVO vo) {
public DataResult<List<Station>> getZhongZiStationInfo(@RequestBody CockpitReqVO vo,HttpServletRequest request) {
String lang = request.getHeader(CommonConstant.LANG);
List<Integer> ids = getByDeptId(vo.getDeptId());
List<Station> stations = new ArrayList<>();
if (ids != null) {
stations = iargeScreenShowService.getCountStations(ids);
stations = iargeScreenShowService.getCountStations(ids,lang);
}
return DataResult.success(stations);
}
@ -410,8 +418,9 @@ public class IargeScreenShowController {
@PostMapping("getZhongZiCapacity")
@ApiOperation(value = "中自装机容量倒排")
@TokenIgnore
public DataResult<List<Subdata>> getZhongZiCapacity(@RequestBody CockpitReqVO vo) {
List<Subdata> regionList = iargeScreenShowService.getCommonCapacity(getByDeptId(vo.getDeptId()));
public DataResult<List<Subdata>> getZhongZiCapacity(@RequestBody CockpitReqVO vo,HttpServletRequest request) {
String lang = request.getHeader(CommonConstant.LANG);
List<Subdata> regionList = iargeScreenShowService.getCommonCapacity(getByDeptId(vo.getDeptId()),lang);
return DataResult.success(regionList);
}

View File

@ -65,6 +65,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.io.File;
import java.text.ParseException;
@ -218,8 +219,9 @@ public class OuterApiController {
//根据电站id查电站
@PostMapping("selectByStationIds")
@TokenIgnore
public DataResult<List<Station>> selectByStationIds(@RequestBody List<Integer> ids) {
List<Station> stations = stationService.selectStationsByIds(ids);
public DataResult<List<Station>> selectByStationIds(@RequestBody List<Integer> ids, HttpServletRequest request) {
String lang = request.getHeader(CommonConstant.LANG);
List<Station> stations = stationService.selectStationsByIds(ids,lang);
return DataResult.success(stations);
}

View File

@ -259,15 +259,15 @@ public class PointDemoController {
}else if(CommonConstant.langTemp.ES_ES.equals(lang)){
fileName = "Tabla de puntos";sheetName = "datos";
EasyExcelUtil.writeExcel(response, pointList, fileName, sheetName, PointRespSpaVO.class);
}else if(CommonConstant.langTemp.AR_EG.equals(lang)){
fileName = "نقطة الجدول";sheetName = "داتا";
EasyExcelUtil.writeExcel(response, pointList, fileName, sheetName, PointRespAraVO.class);
}else if(CommonConstant.langTemp.DE_DE.equals(lang)){
fileName = "Punkttabellen";sheetName = "Daten";
EasyExcelUtil.writeExcel(response, pointList, fileName, sheetName, PointRespDeVO.class);
}else if(CommonConstant.langTemp.PL_PL.equals(lang)){
fileName = "Tabela punktowa";sheetName = "Dane";
EasyExcelUtil.writeExcel(response, pointList, fileName, sheetName, PointRespPlVO.class);
}else if(CommonConstant.langTemp.AR_EG.equals(lang)){
fileName = "نقطة الجدول";sheetName = "داتا";
EasyExcelUtil.writeExcel(response, pointList, fileName, sheetName, PointRespAraVO.class);
}else{
EasyExcelUtil.writeExcel(response, pointList, fileName, sheetName, PointRespVO.class);
}

View File

@ -177,7 +177,7 @@ public class StationController {
DataResult<StationRespVO> result = DataResult.success();
List<Integer> ids = new ArrayList<>();
ids.add(id);
List<StationRespVO> stations = stationService.selectByIds(ids);
List<StationRespVO> stations = stationService.selectByIds(ids,null);
StationRespVO stationRespVO = new StationRespVO();
if (!stations.isEmpty()) {
stationRespVO = stations.get(0);
@ -256,6 +256,7 @@ public class StationController {
List<Station> stationsList = new ArrayList<>();
//根据所属集团查询电站
String token = request.getHeader(RedisKeyConstant.User.ACCESS_TOKEN);
String lang = request.getHeader(CommonConstant.LANG);
SimpleUser user = redisService.getSimpleUserByToken(token);
if (user.getPlatSuper()) {
return DataResult.success(stationsList);
@ -265,7 +266,7 @@ public class StationController {
//OPEN环境需要只显示人员所属电站
// if (EnvConstant.DEV.equals(env) || EnvConstant.OPEN.equals(env)) {
if (stationIds != null && !stationIds.isEmpty()) {
List<StationRespVO> stationRespVOS = stationService.selectByIds(stationIds);
List<StationRespVO> stationRespVOS = stationService.selectByIds(stationIds,lang);
for (StationRespVO stationRespVO : stationRespVOS) {
Station station = new Station();
BeanUtil.copyProperties(stationRespVO, station);