diff --git a/business-service-dao/src/main/java/com/ho/business/mapper/StationMapper.java b/business-service-dao/src/main/java/com/ho/business/mapper/StationMapper.java index 599d6f3..b2368f8 100644 --- a/business-service-dao/src/main/java/com/ho/business/mapper/StationMapper.java +++ b/business-service-dao/src/main/java/com/ho/business/mapper/StationMapper.java @@ -36,7 +36,7 @@ public interface StationMapper { List selectByDimName(String name,Integer groupId); - List selectByIds(List ids); + List selectByIds(@Param("ids") List ids,@Param("lang") String lang); Station selectByNameAndId(@Param("name") String name, @Param("id") Integer id, @Param("deptId") Integer deptId); diff --git a/business-service-dao/src/main/java/com/ho/business/service/IargeScreenShowService.java b/business-service-dao/src/main/java/com/ho/business/service/IargeScreenShowService.java index 1d0bc6e..a654a46 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/IargeScreenShowService.java +++ b/business-service-dao/src/main/java/com/ho/business/service/IargeScreenShowService.java @@ -62,7 +62,7 @@ public interface IargeScreenShowService { * @param stationIds * @return */ - List getCommonRegionList(List stationIds); + List getCommonRegionList(List stationIds,String lang); /** * 获取节能减排数据 @@ -90,27 +90,27 @@ public interface IargeScreenShowService { * 查询收益按电站分组 * @return */ - List getCommonProfit(String beginString, String endString,List stationIds); + List getCommonProfit(String beginString, String endString,List stationIds,String lang); /** * 通用系统转换率 * @param stationIds * @return */ - List getCommonEfficiencyDate(List stationIds); + List getCommonEfficiencyDate(List stationIds,String lang); /** * 获取统计电站信息 * @param stationIds * @return */ - List getCountStations(List stationIds); + List getCountStations(List stationIds,String lang); /** * 通用装机容量倒排 * @return */ - List getCommonCapacity(List stationIds); + List getCommonCapacity(List stationIds,String lang); /** * 通用根据天获取告警数目曲线 diff --git a/business-service-dao/src/main/java/com/ho/business/service/StationService.java b/business-service-dao/src/main/java/com/ho/business/service/StationService.java index 6eadf9f..10e56a2 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/StationService.java +++ b/business-service-dao/src/main/java/com/ho/business/service/StationService.java @@ -27,7 +27,7 @@ public interface StationService { List selectByIds(List ids); - List selectStationsByIds(List ids); + List selectStationsByIds(List ids,String lang); Station insertStation(StationReqVO vo); diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceServiceImpl.java index 505f5fa..6da107d 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/DeviceServiceImpl.java @@ -1623,7 +1623,7 @@ public class DeviceServiceImpl implements DeviceService { } }else if(CommonConstant.THREE.equals(vo.getType())){ //导出电站数据 - List list = stationService.selectStationsByIds(vo.getStationIds()); + List list = stationService.selectStationsByIds(vo.getStationIds(),null); String fileName = "station"; String sheetName = "data"; try { diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/IargeScreenShowServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/IargeScreenShowServiceImpl.java index 64fcd54..409d3cc 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/IargeScreenShowServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/IargeScreenShowServiceImpl.java @@ -1295,17 +1295,17 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService { if (stationIds == null) { return new AnnualOverviewResp(); } - List list = stationService.selectStationsByIds(stationIds); + List list = stationService.selectStationsByIds(stationIds,null); AnnualOverviewResp annualOverviewResp = getOverviewDatas(list); return annualOverviewResp; } @Override - public List getCommonRegionList(List stationIds) { + public List getCommonRegionList(List stationIds,String lang) { if (stationIds == null) { return new ArrayList<>(); } - List list = getCountStations(stationIds); + List list = getCountStations(stationIds,lang); List regionList = new ArrayList<>(); Map> provinceMap = list.stream().filter(i -> i.getProvince() != null).collect(Collectors.groupingBy(Station::getProvince)); if (provinceMap.size() > CommonConstant.ONE) { @@ -1356,7 +1356,7 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService { if (stationIds == null) { return new EnergySavingRespVo(); } - List list = getCountStations(stationIds); + List list = getCountStations(stationIds,null); return getEnergySavingRespVo(list); } @@ -1365,7 +1365,7 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService { if (stationIds == null) { return new ArrayList<>(); } - List list = getCountStations(stationIds); + List list = getCountStations(stationIds,null); return getProfitCurve(vo, list); } @@ -1374,16 +1374,16 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService { if (stationIds == null) { return new ArrayList<>(); } - return getAnnualChartValues(getCountStations(stationIds)); + return getAnnualChartValues(getCountStations(stationIds,null)); } @Override - public List getCommonProfit(String beginString, String endString, List stationIds) { + public List getCommonProfit(String beginString, String endString, List stationIds,String lang) { List subdata = new ArrayList<>(); if (stationIds == null) { return subdata; } - List countStations = getCountStations(stationIds); + List countStations = getCountStations(stationIds,lang); if (countStations != null && !countStations.isEmpty()) { if (countStations.size() >= CommonConstant.FIVE) { subdata = getSubdata(beginString, endString, countStations); @@ -1401,12 +1401,12 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService { } @Override - public List getCommonEfficiencyDate(List stationIds) { + public List getCommonEfficiencyDate(List stationIds,String lang) { List subdata = new ArrayList<>(); if (stationIds == null) { return subdata; } - List countStations = getCountStations(stationIds); + List countStations = getCountStations(stationIds,lang); if (countStations != null && !countStations.isEmpty()) { subdata = getEfficiencyDate(countStations); // if (countStations.size() >= CommonConstant.FIVE) { @@ -1718,17 +1718,17 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService { * @return */ @Override - public List getCountStations(List stationIds) { - List list = stationService.selectStationsByIds(stationIds); + public List getCountStations(List stationIds,String lang) { + List list = stationService.selectStationsByIds(stationIds,lang); List oneList = list.stream().filter(i -> CommonConstant.ONE.equals(i.getStatus())).collect(Collectors.toList()); return oneList; } @Override - public List getCommonCapacity(List stationIds) { + public List getCommonCapacity(List stationIds,String lang) { List subDataList = new ArrayList<>(); if (stationIds != null) { - List stations = getCountStations(stationIds); + List stations = getCountStations(stationIds,lang); subDataList = getSubdataList(stations); } return subDataList; diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/OpenStationServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/OpenStationServiceImpl.java index b41d1d7..4c23c51 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/OpenStationServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/OpenStationServiceImpl.java @@ -557,7 +557,7 @@ public class OpenStationServiceImpl implements OpenStationService { public void exportEleData(PcsStationReq req, HttpServletResponse response) { try { List stationIds = req.getStationIds(); - List stations = stationService.selectStationsByIds(stationIds); + List stations = stationService.selectStationsByIds(stationIds,null); Map idNameMap = getStationMap(stations); List> sheetsList = new ArrayList<>(); //汇总 @@ -685,7 +685,7 @@ public class OpenStationServiceImpl implements OpenStationService { PageResult pageResult = new PageResult<>(); try { List stationIds = req.getStationIds(); - List stations = stationService.selectStationsByIds(stationIds); + List stations = stationService.selectStationsByIds(stationIds,null); Map idNameMap = stations.stream().collect(Collectors.toMap(Station::getId, Station::getName)); List result = new ArrayList<>(); String name = null; @@ -720,7 +720,7 @@ public class OpenStationServiceImpl implements OpenStationService { Object obj = new Object(); try { List stationIds = req.getStationIds(); - List stations = stationService.selectStationsByIds(stationIds); + List stations = stationService.selectStationsByIds(stationIds,null); Map idNameMap = getStationMap(stations); //汇总 BigDecimal charge = BigDecimal.ZERO; @@ -857,7 +857,7 @@ public class OpenStationServiceImpl implements OpenStationService { Object obj = new Object(); try { List stationIds = req.getStationIds(); - List stations = stationService.selectStationsByIds(stationIds); + List stations = stationService.selectStationsByIds(stationIds,null); Map idNameMap = getStationMap(stations); //汇总 String segmentType = req.getSegmentType(); diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/OutApiServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/OutApiServiceImpl.java index 844a36e..37270f9 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/OutApiServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/OutApiServiceImpl.java @@ -464,7 +464,7 @@ public class OutApiServiceImpl implements OutApiService { ids.add(418);//新凤鸣电站 ids.add(551);//江苏暨阳电力科技发展有限公司(1号柜) ids.add(564);//江苏暨阳电力科技发展有限公司(2号柜) - List stations = stationService.selectStationsByIds(ids); + List stations = stationService.selectStationsByIds(ids,null); String deviceType = DeviceTypeConstant.PCS; for (Station station : stations) { //先删除站的当日数据 diff --git a/business-service-dao/src/main/java/com/ho/business/service/impl/StationServiceImpl.java b/business-service-dao/src/main/java/com/ho/business/service/impl/StationServiceImpl.java index 52663fe..b44438d 100644 --- a/business-service-dao/src/main/java/com/ho/business/service/impl/StationServiceImpl.java +++ b/business-service-dao/src/main/java/com/ho/business/service/impl/StationServiceImpl.java @@ -213,7 +213,7 @@ public class StationServiceImpl implements StationService { @Override public List selectByIds(List ids) { - List stations = stationMapper.selectByIds(ids); + List stations = stationMapper.selectByIds(ids,null); List stationRespVOS = getStationRespVOS(stations); if (stationRespVOS != null) { for (StationRespVO stationRespVO : stationRespVOS) { @@ -235,8 +235,8 @@ public class StationServiceImpl implements StationService { } @Override - public List selectStationsByIds(List ids) { - List stations = stationMapper.selectByIds(ids); + public List selectStationsByIds(List ids,String lang) { + List stations = stationMapper.selectByIds(ids,lang); return stations; } diff --git a/business-service-dao/src/main/resources/mapper/StationMapper.xml b/business-service-dao/src/main/resources/mapper/StationMapper.xml index bf89dff..49aa1ad 100644 --- a/business-service-dao/src/main/resources/mapper/StationMapper.xml +++ b/business-service-dao/src/main/resources/mapper/StationMapper.xml @@ -16,6 +16,18 @@ electricity_type,customer_type,voltage_level,batch_number,nation + + id + ,pid,group_id,dept_id, + name_en `name`,name_en,address,address_en,longitude, + latitude,capacity,rate_power, + status,type,create_time, + contact,contact_details,grid_time, + update_time,deleted,is_enable,cabin_num,district,ad_code,is_daily_count, + topology_type,cupboard_type,plan_version,inverter_flag,icc_id,province_en province,city, + electricity_type,customer_type,voltage_level,batch_number,nation + + select - + + + + + + + + from station diff --git a/business-service/src/main/java/com/ho/business/controller/IargeScreenShowController.java b/business-service/src/main/java/com/ho/business/controller/IargeScreenShowController.java index 54f127d..a052e70 100644 --- a/business-service/src/main/java/com/ho/business/controller/IargeScreenShowController.java +++ b/business-service/src/main/java/com/ho/business/controller/IargeScreenShowController.java @@ -13,6 +13,7 @@ import com.ho.business.vo.resp.iargeScreen.EnergySavingRespVo; import com.ho.business.vo.resp.iargeScreen.Subdata; 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; @@ -20,6 +21,7 @@ import com.ho.common.tools.entity.WeatherRespVo; import com.ho.common.tools.exception.DataResult; import com.ho.common.tools.service.RedisService; import com.ho.common.tools.util.BigDecimalUtil; +import com.ho.common.tools.util.TranslateUtils; import com.ho.flow.vo.resp.event.EventDayNum; import com.ho.user.api.entity.SysDept; import com.ho.user.api.vo.req.QueryDeptReqVO; @@ -33,6 +35,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; +import java.io.IOException; import java.util.ArrayList; import java.util.Comparator; import java.util.List; @@ -174,9 +177,17 @@ public class IargeScreenShowController { @PostMapping("/newWeather") @ApiOperation(value = "新大屏天气接口") @TokenIgnore - public DataResult newWeather() { + public DataResult newWeather(HttpServletRequest request) { + String lang =request.getHeader(RedisKeyConstant.User.LANG); String key = RedisKeyConstant.WEATHER_PROVINCE_CITY + adCode; WeatherRespVo info = (WeatherRespVo) redisService.get(key); + if(CommonConstant.EN_US.equals(lang)){ + try { + info.setSkyCon(TranslateUtils.translate(info.getSkyCon())); + } catch (IOException e) { + throw new RuntimeException(e); + } + } return DataResult.success(info); } @@ -199,7 +210,8 @@ public class IargeScreenShowController { @TokenIgnore @CommonLargeScreenToken public DataResult> getCommonRegionalDistribution(HttpServletRequest request) { - List regionList = iargeScreenShowService.getCommonRegionList(getSimpleUser(request)); + String lang =request.getHeader(RedisKeyConstant.User.LANG); + List regionList = iargeScreenShowService.getCommonRegionList(getSimpleUser(request),lang); regionList.sort(Comparator.comparing((Subdata::getRegionValue)).reversed()); return DataResult.success(regionList); } @@ -243,7 +255,8 @@ public class IargeScreenShowController { @TokenIgnore @CommonLargeScreenToken public DataResult> getCommonIncomeList(HttpServletRequest request) { - List regionList = iargeScreenShowService.getCommonProfit(null, null, getSimpleUser(request)); + String lang =request.getHeader(RedisKeyConstant.User.LANG); + List regionList = iargeScreenShowService.getCommonProfit(null, null, getSimpleUser(request),lang); if (regionList.size() > maxSize) { regionList = regionList.subList(0, maxSize); } @@ -259,7 +272,8 @@ public class IargeScreenShowController { @TokenIgnore @CommonLargeScreenToken public DataResult> getCommonEfficiencyDate(HttpServletRequest request) { - List efficiencyList = iargeScreenShowService.getCommonEfficiencyDate(getSimpleUser(request)); + String lang =request.getHeader(RedisKeyConstant.User.LANG); + List efficiencyList = iargeScreenShowService.getCommonEfficiencyDate(getSimpleUser(request),lang); return DataResult.success(efficiencyList); } @@ -271,7 +285,7 @@ public class IargeScreenShowController { List ids = getSimpleUser(request); List stations = new ArrayList<>(); if (ids != null) { - stations = iargeScreenShowService.getCountStations(ids); + stations = iargeScreenShowService.getCountStations(ids,null); } return DataResult.success(stations); } @@ -281,7 +295,8 @@ public class IargeScreenShowController { @TokenIgnore @CommonLargeScreenToken public DataResult> getCommonCapacity(HttpServletRequest request) { - List regionList = iargeScreenShowService.getCommonCapacity(getSimpleUser(request)); + String lang =request.getHeader(RedisKeyConstant.User.LANG); + List regionList = iargeScreenShowService.getCommonCapacity(getSimpleUser(request),lang); return DataResult.success(regionList); } @@ -339,8 +354,9 @@ public class IargeScreenShowController { @PostMapping("getZhongZiDistribution") @ApiOperation(value = "中自电站区域分布") @TokenIgnore - public DataResult> getZhongZiDistribution(@RequestBody CockpitReqVO vo) { - List regionList = iargeScreenShowService.getCommonRegionList((getByDeptId(vo.getDeptId()))); + public DataResult> getZhongZiDistribution(@RequestBody CockpitReqVO vo,HttpServletRequest request) { + String lang =request.getHeader(RedisKeyConstant.User.LANG); + List regionList = iargeScreenShowService.getCommonRegionList((getByDeptId(vo.getDeptId())),lang); regionList.sort(Comparator.comparing((Subdata::getRegionValue)).reversed()); return DataResult.success(regionList); } @@ -379,8 +395,9 @@ public class IargeScreenShowController { @PostMapping("getZhongZiIncomeList") @ApiOperation(value = "中自电站收益排名") @TokenIgnore - public DataResult> getZhongZiIncomeList(@RequestBody CockpitReqVO vo) { - List regionList = iargeScreenShowService.getCommonProfit(null, null, getByDeptId(vo.getDeptId())); + public DataResult> getZhongZiIncomeList(@RequestBody CockpitReqVO vo,HttpServletRequest request) { + String lang =request.getHeader(RedisKeyConstant.User.LANG); + List regionList = iargeScreenShowService.getCommonProfit(null, null, getByDeptId(vo.getDeptId()),lang); if (regionList.size() > maxSize) { regionList = regionList.subList(0, maxSize); } @@ -394,8 +411,9 @@ public class IargeScreenShowController { @PostMapping("getZhongZiEfficiencyDate") @ApiOperation(value = "中自系统转换率") @TokenIgnore - public DataResult> getZhongZiEfficiencyDate(@RequestBody CockpitReqVO vo) { - List efficiencyList = iargeScreenShowService.getCommonEfficiencyDate(getByDeptId(vo.getDeptId())); + public DataResult> getZhongZiEfficiencyDate(@RequestBody CockpitReqVO vo,HttpServletRequest request) { + String lang =request.getHeader(RedisKeyConstant.User.LANG); + List efficiencyList = iargeScreenShowService.getCommonEfficiencyDate(getByDeptId(vo.getDeptId()),lang); return DataResult.success(efficiencyList); } @@ -406,7 +424,7 @@ public class IargeScreenShowController { List ids = getByDeptId(vo.getDeptId()); List stations = new ArrayList<>(); if (ids != null) { - stations = iargeScreenShowService.getCountStations(ids); + stations = iargeScreenShowService.getCountStations(ids,null); } return DataResult.success(stations); } @@ -414,8 +432,9 @@ public class IargeScreenShowController { @PostMapping("getZhongZiCapacity") @ApiOperation(value = "中自装机容量倒排") @TokenIgnore - public DataResult> getZhongZiCapacity(@RequestBody CockpitReqVO vo) { - List regionList = iargeScreenShowService.getCommonCapacity(getByDeptId(vo.getDeptId())); + public DataResult> getZhongZiCapacity(@RequestBody CockpitReqVO vo,HttpServletRequest request) { + String lang =request.getHeader(RedisKeyConstant.User.LANG); + List regionList = iargeScreenShowService.getCommonCapacity(getByDeptId(vo.getDeptId()),lang); return DataResult.success(regionList); } diff --git a/business-service/src/main/java/com/ho/business/controller/OuterApiController.java b/business-service/src/main/java/com/ho/business/controller/OuterApiController.java index a29bfc8..cd26a51 100644 --- a/business-service/src/main/java/com/ho/business/controller/OuterApiController.java +++ b/business-service/src/main/java/com/ho/business/controller/OuterApiController.java @@ -219,7 +219,7 @@ public class OuterApiController { @PostMapping("selectByStationIds") @TokenIgnore public DataResult> selectByStationIds(@RequestBody List ids) { - List stations = stationService.selectStationsByIds(ids); + List stations = stationService.selectStationsByIds(ids,null); return DataResult.success(stations); } diff --git a/common-tools/src/main/java/com/ho/common/tools/constant/CommonConstant.java b/common-tools/src/main/java/com/ho/common/tools/constant/CommonConstant.java index 60ce218..eeb8fed 100644 --- a/common-tools/src/main/java/com/ho/common/tools/constant/CommonConstant.java +++ b/common-tools/src/main/java/com/ho/common/tools/constant/CommonConstant.java @@ -994,4 +994,6 @@ public interface CommonConstant { String CF_FROZEN = "cfFrozen"; //将数据库统配符合“_”变成普通字符 String JOIN_STATION_ID = "\\_"; + + String EN_US="en_US"; }