多语言(英语、法语、西班牙语、德语、波兰语、阿拉伯语)处理
This commit is contained in:
@ -59,6 +59,7 @@ public class FileController {
|
||||
|
||||
@Autowired
|
||||
AnotherFileService anotherFileService;
|
||||
|
||||
@PostMapping("filePage")
|
||||
@ApiOperation(value = "分页查询文件")
|
||||
public DataResult<PageResult<MediaFile>> filePage(@RequestBody FilePageVO vo, HttpServletRequest request) {
|
||||
@ -148,7 +149,7 @@ public class FileController {
|
||||
@PostMapping("readFileAttribute")
|
||||
@ApiOperation(value = "读取文件属性")
|
||||
public DataResult<FileAttributeResp> readFileAttribute(@RequestBody FileAttributeReqVO vo, HttpServletRequest request) {
|
||||
String lang = request.getHeader(RedisKeyConstant.User.LANG);
|
||||
String lang = request.getHeader(CommonConstant.LANG);
|
||||
FileAttributeResp fileAttributeResp = null;
|
||||
String msg = CommonConstant.Heartbeat.MSG + vo.getSerialNo();
|
||||
if (fileService.checkHeartbeat(vo.getSerialNo())) {
|
||||
@ -157,20 +158,34 @@ public class FileController {
|
||||
fileAttributeResp.setMsg(msg + CommonConstant.Heartbeat.FAIL);
|
||||
fileAttributeResp.setResponse(CommonConstant.NEGATIV_ONE);
|
||||
fileAttributeResp.setList(new ArrayList<>());
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
fileAttributeResp.setMsg(TranslateUtils.translate(fileAttributeResp.getMsg()));
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
fileAttributeResp.setMsg(TranslateUtils.translate(fileAttributeResp.getMsg(),CommonConstant.lang.EN));
|
||||
}else if (CommonConstant.langTemp.FR_FR.equals(lang)){
|
||||
fileAttributeResp.setMsg(TranslateUtils.translate(fileAttributeResp.getMsg(),CommonConstant.lang.FRA));
|
||||
}else if (CommonConstant.langTemp.ES_ES.equals(lang)){
|
||||
fileAttributeResp.setMsg(TranslateUtils.translate(fileAttributeResp.getMsg(),CommonConstant.lang.SPA));
|
||||
}else if (CommonConstant.langTemp.DE_DE.equals(lang)){
|
||||
fileAttributeResp.setMsg(TranslateUtils.translate(fileAttributeResp.getMsg(),CommonConstant.lang.DE));
|
||||
}else if (CommonConstant.langTemp.PL_PL.equals(lang)){
|
||||
fileAttributeResp.setMsg(TranslateUtils.translate(fileAttributeResp.getMsg(),CommonConstant.lang.PL));
|
||||
}else if (CommonConstant.langTemp.AR_EG.equals(lang)){
|
||||
fileAttributeResp.setMsg(TranslateUtils.translate(fileAttributeResp.getMsg(),CommonConstant.lang.ARA));
|
||||
}
|
||||
return DataResult.success(fileAttributeResp);
|
||||
}
|
||||
// String serialNo = vo.getSerialNo();
|
||||
// List<String> snList = MqttConfigUtil.getSnList();
|
||||
// if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||
fileAttributeResp = fileService.getFileAttribute(vo);
|
||||
// }else{
|
||||
// fileAttributeResp = anotherFileService.getFileAttribute(vo);
|
||||
// }
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
fileAttributeResp.setMsg(TranslateUtils.translate(fileAttributeResp.getMsg()));
|
||||
fileAttributeResp = fileService.getFileAttribute(vo);
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
fileAttributeResp.setMsg(TranslateUtils.translate(fileAttributeResp.getMsg(),CommonConstant.lang.EN));
|
||||
}else if (CommonConstant.langTemp.FR_FR.equals(lang)){
|
||||
fileAttributeResp.setMsg(TranslateUtils.translate(fileAttributeResp.getMsg(),CommonConstant.lang.FRA));
|
||||
}else if (CommonConstant.langTemp.ES_ES.equals(lang)){
|
||||
fileAttributeResp.setMsg(TranslateUtils.translate(fileAttributeResp.getMsg(),CommonConstant.lang.SPA));
|
||||
}else if (CommonConstant.langTemp.DE_DE.equals(lang)){
|
||||
fileAttributeResp.setMsg(TranslateUtils.translate(fileAttributeResp.getMsg(),CommonConstant.lang.DE));
|
||||
}else if (CommonConstant.langTemp.PL_PL.equals(lang)){
|
||||
fileAttributeResp.setMsg(TranslateUtils.translate(fileAttributeResp.getMsg(),CommonConstant.lang.PL));
|
||||
}else if (CommonConstant.langTemp.AR_EG.equals(lang)){
|
||||
fileAttributeResp.setMsg(TranslateUtils.translate(fileAttributeResp.getMsg(),CommonConstant.lang.ARA));
|
||||
}
|
||||
return DataResult.success(fileAttributeResp);
|
||||
}
|
||||
@ -179,20 +194,43 @@ public class FileController {
|
||||
@ApiOperation(value = "删除文件(删除边端文件)")
|
||||
@LogAnnotation(title = "文件服务", action = "删除文件(删除边端文件)")
|
||||
public DataResult<FileDeleteResp> deleteDeviceFiles(@RequestBody FileForDeviceReqVO fileDeleteReqVO, HttpServletRequest request) {
|
||||
String lang = request.getHeader(RedisKeyConstant.User.LANG);
|
||||
String lang = request.getHeader(CommonConstant.LANG);
|
||||
FileDeleteResp fileDeleteResp = null;
|
||||
String msg = CommonConstant.Heartbeat.MSG + fileDeleteReqVO.getSerialNo();
|
||||
if (fileService.checkHeartbeat(fileDeleteReqVO.getSerialNo())) {
|
||||
fileDeleteResp = new FileDeleteResp();
|
||||
fileDeleteResp.setDeleteStatus(CommonConstant.TWO);
|
||||
fileDeleteResp.setMsg(msg + CommonConstant.Heartbeat.FAIL);
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
fileDeleteResp.setMsg(TranslateUtils.translate(fileDeleteResp.getMsg(),CommonConstant.lang.EN));
|
||||
}else if (CommonConstant.langTemp.FR_FR.equals(lang)){
|
||||
fileDeleteResp.setMsg(TranslateUtils.translate(fileDeleteResp.getMsg(),CommonConstant.lang.FRA));
|
||||
}else if (CommonConstant.langTemp.ES_ES.equals(lang)){
|
||||
fileDeleteResp.setMsg(TranslateUtils.translate(fileDeleteResp.getMsg(),CommonConstant.lang.SPA));
|
||||
}else if (CommonConstant.langTemp.DE_DE.equals(lang)){
|
||||
fileDeleteResp.setMsg(TranslateUtils.translate(fileDeleteResp.getMsg(),CommonConstant.lang.DE));
|
||||
}else if (CommonConstant.langTemp.PL_PL.equals(lang)){
|
||||
fileDeleteResp.setMsg(TranslateUtils.translate(fileDeleteResp.getMsg(),CommonConstant.lang.PL));
|
||||
}else if (CommonConstant.langTemp.AR_EG.equals(lang)){
|
||||
fileDeleteResp.setMsg(TranslateUtils.translate(fileDeleteResp.getMsg(),CommonConstant.lang.ARA));
|
||||
}
|
||||
return DataResult.success(fileDeleteResp);
|
||||
}
|
||||
|
||||
fileDeleteResp = fileService.deleteDeviceFiles(fileDeleteReqVO);
|
||||
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
fileDeleteResp.setMsg(TranslateUtils.translate(fileDeleteResp.getMsg()));
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
fileDeleteResp.setMsg(TranslateUtils.translate(fileDeleteResp.getMsg(),CommonConstant.lang.EN));
|
||||
}else if (CommonConstant.langTemp.FR_FR.equals(lang)){
|
||||
fileDeleteResp.setMsg(TranslateUtils.translate(fileDeleteResp.getMsg(),CommonConstant.lang.FRA));
|
||||
}else if (CommonConstant.langTemp.ES_ES.equals(lang)){
|
||||
fileDeleteResp.setMsg(TranslateUtils.translate(fileDeleteResp.getMsg(),CommonConstant.lang.SPA));
|
||||
}else if (CommonConstant.langTemp.DE_DE.equals(lang)){
|
||||
fileDeleteResp.setMsg(TranslateUtils.translate(fileDeleteResp.getMsg(),CommonConstant.lang.DE));
|
||||
}else if (CommonConstant.langTemp.PL_PL.equals(lang)){
|
||||
fileDeleteResp.setMsg(TranslateUtils.translate(fileDeleteResp.getMsg(),CommonConstant.lang.PL));
|
||||
}else if (CommonConstant.langTemp.AR_EG.equals(lang)){
|
||||
fileDeleteResp.setMsg(TranslateUtils.translate(fileDeleteResp.getMsg(),CommonConstant.lang.ARA));
|
||||
}
|
||||
return DataResult.success(fileDeleteResp);
|
||||
}
|
||||
@ -202,7 +240,7 @@ public class FileController {
|
||||
//@HzPermission(value = PermissionConstant.REMOTECONTROL_FILE_UPLOAD)
|
||||
@LogAnnotation(title = "文件服务", action = "文件上传(向边端上传)")
|
||||
public DataResult<HeartbeatResp> fileUploadForDevice(HttpServletRequest request,@RequestPart("file") MultipartFile file, @RequestParam("stationId") Integer stationId, @RequestParam("serialNo") String serialNo, @RequestParam("filePath") String filePath) {
|
||||
String lang = request.getHeader(RedisKeyConstant.User.LANG);
|
||||
String lang = request.getHeader(CommonConstant.LANG);
|
||||
HeartbeatResp resp = fileService.checkHeartAndFileUsing(stationId, serialNo);
|
||||
if (null == resp) {
|
||||
resp = new HeartbeatResp();
|
||||
@ -210,24 +248,38 @@ public class FileController {
|
||||
if (file.isEmpty()) {
|
||||
resp.setHeartbeatStatus(CommonConstant.ZERO);
|
||||
resp.setMsg(BaseResponseCode.FILE_IS_EMPTY.getMsg());
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.EN));
|
||||
}else if (CommonConstant.langTemp.FR_FR.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.FRA));
|
||||
}else if (CommonConstant.langTemp.ES_ES.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.SPA));
|
||||
}else if (CommonConstant.langTemp.DE_DE.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.DE));
|
||||
}else if (CommonConstant.langTemp.PL_PL.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.PL));
|
||||
}else if (CommonConstant.langTemp.AR_EG.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.ARA));
|
||||
}
|
||||
return DataResult.success(resp);
|
||||
}
|
||||
// long fileSize = file.getSize();
|
||||
// if (5 * 1024 * 1024 < fileSize) {
|
||||
// throw new BusinessException(BaseResponseCode.FILE_IS_EXCEED_5M);
|
||||
// }
|
||||
resp.setMsg(CommonConstant.Heartbeat.MSG + serialNo + CommonConstant.Heartbeat.SUCCESS);
|
||||
resp.setHeartbeatStatus(CommonConstant.ONE);
|
||||
log.info("文件上传(向边端上传)开始上传");
|
||||
// List<String> snList = MqttConfigUtil.getSnList();
|
||||
// if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||
fileService.fileUploadForDevice(file, stationId, serialNo, filePath);
|
||||
// }else{
|
||||
// anotherFileService.fileUploadForDevice(file, stationId, serialNo, filePath);
|
||||
// }
|
||||
fileService.fileUploadForDevice(file, stationId, serialNo, filePath);
|
||||
}
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg()));
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.EN));
|
||||
}else if (CommonConstant.langTemp.FR_FR.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.FRA));
|
||||
}else if (CommonConstant.langTemp.ES_ES.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.SPA));
|
||||
}else if (CommonConstant.langTemp.DE_DE.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.DE));
|
||||
}else if (CommonConstant.langTemp.PL_PL.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.PL));
|
||||
}else if (CommonConstant.langTemp.AR_EG.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.ARA));
|
||||
}
|
||||
return DataResult.success(resp);
|
||||
}
|
||||
@ -238,13 +290,7 @@ public class FileController {
|
||||
@LogAnnotation(title = "文件服务", action = "文件下载")
|
||||
public DataResult<HeartbeatResp> downloadFromDevice(@RequestBody FileForDeviceReqVO fileForDeviceReqVO,HttpServletRequest request) {
|
||||
//todo 测试模拟返回成功
|
||||
/*if(true){
|
||||
HeartbeatResp heart = new HeartbeatResp();
|
||||
heart.setHeartbeatStatus(1);
|
||||
|
||||
return DataResult.success(heart);
|
||||
}*/
|
||||
String lang = request.getHeader(RedisKeyConstant.User.LANG);
|
||||
String lang = request.getHeader(CommonConstant.LANG);
|
||||
HeartbeatResp resp = fileService.checkHeartAndFileUsing(fileForDeviceReqVO.getStationId(), fileForDeviceReqVO.getSerialNo());
|
||||
if (null == resp) {
|
||||
resp = new HeartbeatResp();
|
||||
@ -252,16 +298,20 @@ public class FileController {
|
||||
resp.setHeartbeatStatus(CommonConstant.ONE);
|
||||
log.info("文件下载(从边端下载到云端)开始下载");
|
||||
fileService.downloadFromDevice(fileForDeviceReqVO);
|
||||
// String serialNo = fileForDeviceReqVO.getSerialNo();
|
||||
// List<String> snList = MqttConfigUtil.getSnList();
|
||||
// if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||
fileService.downloadFromDevice(fileForDeviceReqVO);
|
||||
// }else{
|
||||
// anotherFileService.downloadFromDevice(fileForDeviceReqVO);
|
||||
// }
|
||||
fileService.downloadFromDevice(fileForDeviceReqVO);
|
||||
}
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg()));
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.EN));
|
||||
}else if (CommonConstant.langTemp.FR_FR.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.FRA));
|
||||
}else if (CommonConstant.langTemp.ES_ES.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.SPA));
|
||||
}else if (CommonConstant.langTemp.DE_DE.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.DE));
|
||||
}else if (CommonConstant.langTemp.PL_PL.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.PL));
|
||||
}else if (CommonConstant.langTemp.AR_EG.equals(lang)){
|
||||
resp.setMsg(TranslateUtils.translate(resp.getMsg(),CommonConstant.lang.ARA));
|
||||
}
|
||||
return DataResult.success(resp);
|
||||
}
|
||||
@ -270,16 +320,20 @@ public class FileController {
|
||||
@ApiOperation(value = "文件下载进度(从边端下载到浏览器)")
|
||||
public DataResult<FileProcessRespVO> downloadProgressBar(@RequestBody FileProcessReqVO vo, HttpServletResponse response,HttpServletRequest request) {
|
||||
//todo 测试模拟返回成功
|
||||
/*if(true){
|
||||
FileProcessRespVO file =new FileProcessRespVO();
|
||||
file.setFileProcess(100);
|
||||
file.setFileStatus(1);
|
||||
return DataResult.success(file);
|
||||
}*/
|
||||
String lang = request.getHeader(RedisKeyConstant.User.LANG);
|
||||
String lang = request.getHeader(CommonConstant.LANG);
|
||||
FileProcessRespVO fileProcessRespVO = fileService.getDownloadProgress(vo);
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
fileProcessRespVO.setMsg(TranslateUtils.translate(fileProcessRespVO.getMsg()));
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
fileProcessRespVO.setMsg(TranslateUtils.translate(fileProcessRespVO.getMsg(),CommonConstant.lang.EN));
|
||||
}else if (CommonConstant.langTemp.FR_FR.equals(lang)){
|
||||
fileProcessRespVO.setMsg(TranslateUtils.translate(fileProcessRespVO.getMsg(),CommonConstant.lang.FRA));
|
||||
}else if (CommonConstant.langTemp.ES_ES.equals(lang)){
|
||||
fileProcessRespVO.setMsg(TranslateUtils.translate(fileProcessRespVO.getMsg(),CommonConstant.lang.SPA));
|
||||
}else if (CommonConstant.langTemp.DE_DE.equals(lang)){
|
||||
fileProcessRespVO.setMsg(TranslateUtils.translate(fileProcessRespVO.getMsg(),CommonConstant.lang.DE));
|
||||
}else if (CommonConstant.langTemp.PL_PL.equals(lang)){
|
||||
fileProcessRespVO.setMsg(TranslateUtils.translate(fileProcessRespVO.getMsg(),CommonConstant.lang.PL));
|
||||
}else if (CommonConstant.langTemp.AR_EG.equals(lang)){
|
||||
fileProcessRespVO.setMsg(TranslateUtils.translate(fileProcessRespVO.getMsg(),CommonConstant.lang.ARA));
|
||||
}
|
||||
return DataResult.success(fileProcessRespVO);
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ public class HeartbeatCheckController {
|
||||
@PostMapping("getHeartbeat")
|
||||
@ApiOperation(value = "心跳检测")
|
||||
public DataResult<HeartbeatResp> getHeartbeat(@RequestBody HeartbeatReq vo, HttpServletRequest request) {
|
||||
String lang = request.getHeader(RedisKeyConstant.User.LANG);
|
||||
String lang = request.getHeader(CommonConstant.LANG);
|
||||
HeartbeatResp heartbeatResp = new HeartbeatResp();
|
||||
//检测心跳
|
||||
DeviceReqVO deviceReqVO = new DeviceReqVO();
|
||||
@ -59,16 +59,36 @@ public class HeartbeatCheckController {
|
||||
log.info("getHeartbeat 当前设备没有配置SN");
|
||||
heartbeatResp.setHeartbeatStatus(CommonConstant.ZERO);
|
||||
heartbeatResp.setMsg(CommonConstant.DEVICE_NO_SN);
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
heartbeatResp.setMsg(CommonConstant.DEVICE_NO_SN_EN);
|
||||
}else if(CommonConstant.langTemp.FR_FR.equals(lang)){
|
||||
heartbeatResp.setMsg(CommonConstant.DEVICE_NO_SN_FRA);
|
||||
}else if(CommonConstant.langTemp.ES_ES.equals(lang)){
|
||||
heartbeatResp.setMsg(CommonConstant.DEVICE_NO_SN_SPA);
|
||||
}else if(CommonConstant.langTemp.DE_DE.equals(lang)){
|
||||
heartbeatResp.setMsg(CommonConstant.DEVICE_NO_SN_DE);
|
||||
}else if(CommonConstant.langTemp.PL_PL.equals(lang)){
|
||||
heartbeatResp.setMsg(CommonConstant.DEVICE_NO_SN_PL);
|
||||
}else if(CommonConstant.langTemp.AR_EG.equals(lang)){
|
||||
heartbeatResp.setMsg(CommonConstant.DEVICE_NO_SN_ARA);
|
||||
}
|
||||
return DataResult.success(heartbeatResp);
|
||||
}
|
||||
String sn = deviceList.get(0).getSerialNo();
|
||||
String heartbeatKey = RedisKeyConstant.HEARTBEAT + sn;
|
||||
String msg = CommonConstant.Heartbeat.MSG + sn;
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
msg = CommonConstant.Heartbeat.MSG_EN + sn;
|
||||
}else if(CommonConstant.langTemp.FR_FR.equals(lang)){
|
||||
msg = CommonConstant.Heartbeat.MSG_FRA + sn;
|
||||
}else if(CommonConstant.langTemp.ES_ES.equals(lang)){
|
||||
msg = CommonConstant.Heartbeat.MSG_SPA + sn;
|
||||
}else if(CommonConstant.langTemp.DE_DE.equals(lang)){
|
||||
msg = CommonConstant.Heartbeat.MSG_DE + sn;
|
||||
}else if(CommonConstant.langTemp.PL_PL.equals(lang)){
|
||||
msg = CommonConstant.Heartbeat.MSG_PL + sn;
|
||||
}else if(CommonConstant.langTemp.AR_EG.equals(lang)){
|
||||
msg = CommonConstant.Heartbeat.MSG_ARA + sn;
|
||||
}
|
||||
|
||||
if (redisService.hasKey(heartbeatKey)) {
|
||||
@ -79,15 +99,35 @@ public class HeartbeatCheckController {
|
||||
if (between >= 5) {
|
||||
heartbeatResp.setHeartbeatStatus(CommonConstant.ZERO);
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL);
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL_EN);
|
||||
}else if(CommonConstant.langTemp.FR_FR.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL_FRA);
|
||||
}else if(CommonConstant.langTemp.ES_ES.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL_SPA);
|
||||
}else if(CommonConstant.langTemp.DE_DE.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL_DE);
|
||||
}else if(CommonConstant.langTemp.PL_PL.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL_PL);
|
||||
}else if(CommonConstant.langTemp.AR_EG.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL_ARA);
|
||||
}
|
||||
log.info("getHeartbeat 超过5分钟没有检测到心跳:{}", between);
|
||||
return DataResult.success(heartbeatResp);
|
||||
}
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.SUCCESS);
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.SUCCESS_EN);
|
||||
}else if(CommonConstant.langTemp.FR_FR.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.SUCCESS_FRA);
|
||||
}else if(CommonConstant.langTemp.ES_ES.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.SUCCESS_SPA);
|
||||
}else if(CommonConstant.langTemp.DE_DE.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.SUCCESS_DE);
|
||||
}else if(CommonConstant.langTemp.PL_PL.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.SUCCESS_PL);
|
||||
}else if(CommonConstant.langTemp.AR_EG.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.SUCCESS_ARA);
|
||||
}
|
||||
heartbeatResp.setHeartbeatStatus(CommonConstant.ONE);
|
||||
return DataResult.success(heartbeatResp);
|
||||
@ -95,8 +135,18 @@ public class HeartbeatCheckController {
|
||||
log.info("getHeartbeat 没有检测到心跳{}", heartbeatKey);
|
||||
heartbeatResp.setHeartbeatStatus(CommonConstant.ZERO);
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL);
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL_EN);
|
||||
}else if(CommonConstant.langTemp.FR_FR.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL_FRA);
|
||||
}else if(CommonConstant.langTemp.ES_ES.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL_SPA);
|
||||
}else if(CommonConstant.langTemp.DE_DE.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL_DE);
|
||||
}else if(CommonConstant.langTemp.PL_PL.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL_PL);
|
||||
}else if(CommonConstant.langTemp.AR_EG.equals(lang)){
|
||||
heartbeatResp.setMsg(msg + CommonConstant.Heartbeat.FAIL_ARA);
|
||||
}
|
||||
return DataResult.success(heartbeatResp);
|
||||
}
|
||||
|
||||
@ -79,11 +79,11 @@ public class OrderSendController {
|
||||
// String userName = userDetailRespVO.getUsername();
|
||||
// String userNameKey = redisService.getUserNameKey(userDetailRespVO, userName);
|
||||
// SimpleUser user = (SimpleUser) redisService.get(userNameKey);
|
||||
String lang = request.getHeader(RedisKeyConstant.User.LANG);
|
||||
String lang = request.getHeader(CommonConstant.LANG);
|
||||
DataResult result = getDataResult(vo);
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
HeartbeatResp heartbeatResp= (HeartbeatResp)result.getData();
|
||||
heartbeatResp.setMsg(TranslateUtils.translate(heartbeatResp.getMsg()));
|
||||
heartbeatResp.setMsg(TranslateUtils.translate(heartbeatResp.getMsg(),CommonConstant.lang.EN));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -236,7 +236,7 @@ public class OrderSendController {
|
||||
@ApiOperation(value = "指令下发进度")
|
||||
@TokenIgnore
|
||||
public DataResult<OrderProcessResp> progressBar(@RequestBody OrderProgressReqVO vo, HttpServletRequest request) {
|
||||
String lang = request.getHeader(RedisKeyConstant.User.LANG);
|
||||
String lang = request.getHeader(CommonConstant.LANG);
|
||||
String key = vo.getStationId() + ":" + vo.getSrcId();
|
||||
log.info("指令下发进度 key:{}", key);
|
||||
OrderProcessResp orderProcessResp = new OrderProcessResp();
|
||||
@ -289,8 +289,8 @@ public class OrderSendController {
|
||||
}
|
||||
}
|
||||
orderProcessResp.setProcessList(processDetailRespList);
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
orderProcessResp.setMsg(TranslateUtils.translate(orderProcessResp.getMsg()));
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
orderProcessResp.setMsg(TranslateUtils.translate(orderProcessResp.getMsg(),CommonConstant.lang.EN));
|
||||
}
|
||||
return DataResult.success(orderProcessResp);
|
||||
}
|
||||
@ -339,10 +339,10 @@ public class OrderSendController {
|
||||
// @LogAnnotation(title = "命令下发曲线", action = "命令下发曲线")
|
||||
@TokenIgnore
|
||||
public DataResult<HeartbeatResp> sendPlanPowerOrder(@RequestBody OrderPlanPowerReq vo, HttpServletRequest request) {
|
||||
String lang = request.getHeader(RedisKeyConstant.User.LANG);
|
||||
String lang = request.getHeader(CommonConstant.LANG);
|
||||
HeartbeatResp heartbeatResp = orderSendService.sendPlanPowerOrder(vo);
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
heartbeatResp.setMsg(TranslateUtils.translate(heartbeatResp.getMsg()));
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
heartbeatResp.setMsg(TranslateUtils.translate(heartbeatResp.getMsg(),CommonConstant.lang.EN));
|
||||
}
|
||||
return DataResult.success(heartbeatResp);
|
||||
}
|
||||
@ -351,10 +351,10 @@ public class OrderSendController {
|
||||
@ApiOperation(value = "指令下发进度")
|
||||
@TokenIgnore
|
||||
public DataResult<OrderProcessResp> planPowerProgressBar(@RequestBody OrderPlanPowerReq vo, HttpServletRequest request) {
|
||||
String lang = request.getHeader(RedisKeyConstant.User.LANG);
|
||||
String lang = request.getHeader(CommonConstant.LANG);
|
||||
OrderProcessResp orderProcessResp = orderSendService.planPowerProgressBar(vo);
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
orderProcessResp.setMsg(TranslateUtils.translate(orderProcessResp.getMsg()));
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
orderProcessResp.setMsg(TranslateUtils.translate(orderProcessResp.getMsg(),CommonConstant.lang.EN));
|
||||
}
|
||||
return DataResult.success(orderProcessResp);
|
||||
}
|
||||
@ -364,11 +364,11 @@ public class OrderSendController {
|
||||
@ApiOperation(value = "指令下发")
|
||||
@TokenIgnore
|
||||
public DataResult<HeartbeatResp> orderIssued4plan(@RequestBody OrderIssuedReqVO vo, HttpServletRequest request) {
|
||||
String lang = request.getHeader(RedisKeyConstant.User.LANG);
|
||||
String lang = request.getHeader(CommonConstant.LANG);
|
||||
DataResult result = getDataResult(vo);
|
||||
if(RedisKeyConstant.User.EN_US.equals(lang)){
|
||||
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||
HeartbeatResp heartbeatResp= (HeartbeatResp)result.getData();
|
||||
heartbeatResp.setMsg(TranslateUtils.translate(heartbeatResp.getMsg()));
|
||||
heartbeatResp.setMsg(TranslateUtils.translate(heartbeatResp.getMsg(),CommonConstant.lang.EN));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user