Browse Source

#离线巡检图片上传问题修复

zhongwei
yang_shj 4 months ago
parent
commit
71df561902
  1. 4
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/PlanGenerationMapper.java
  2. 22
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/filter/ContentTypeFilter.java
  3. 53
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/filter/ContentTypeRequestWrapper.java
  4. 57
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java
  5. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java
  6. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/CentralMonitorService.java
  7. 39
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java
  8. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/service/impl/AlarmServiceImpl.java
  9. 26
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/service/impl/PointServiceImpl.java

4
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/PlanGenerationMapper.java

@ -10,7 +10,7 @@ import java.util.Map;
public interface PlanGenerationMapper extends UserDataScopeBaseMapper<PlanGenerationEntity> { public interface PlanGenerationMapper extends UserDataScopeBaseMapper<PlanGenerationEntity> {
Float selectPlanGenertionYearCount(String stationId, int year); Float selectPlanGenertionYearCount(@Param("stationId") String stationId,@Param("year") int year);
List<PlanGenerationEntity> selectListAll(@Param("date") String date); List<PlanGenerationEntity> selectListAll(@Param("date") String date);
@ -42,5 +42,5 @@ public interface PlanGenerationMapper extends UserDataScopeBaseMapper<PlanGenera
* @param year * @param year
* @return * @return
*/ */
List<PlanGenerationEntity> getPlanPowerByYear(String code, int year); List<PlanGenerationEntity> getPlanPowerByYear(@Param("code") String code,@Param("year") int year);
} }

22
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/filter/ContentTypeFilter.java

@ -0,0 +1,22 @@
package com.hnac.hzinfo.inspect.offline.filter;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
* @author ysj
* @version 4.0.0
* @create 2024-07-24-19:07
*/
@WebFilter(filterName = "ContentTypeFilter", urlPatterns = "/offline/syncOfflineDataToOnline")
public class ContentTypeFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
ContentTypeRequestWrapper wrappedRequest = new ContentTypeRequestWrapper(httpRequest);
chain.doFilter(wrappedRequest, response);
}
}

53
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/filter/ContentTypeRequestWrapper.java

@ -0,0 +1,53 @@
package com.hnac.hzinfo.inspect.offline.filter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
/**
* @author ysj
* @version 4.0.0
* @create 2024-07-24-19:08
*/
public class ContentTypeRequestWrapper extends HttpServletRequestWrapper {
private final String newContentType;
public ContentTypeRequestWrapper(HttpServletRequest request) {
super(request);
// 你想要设置的新Content-Type
this.newContentType = "form-data";
}
@Override
public String getHeader(String name) {
if ("Content-Type".equalsIgnoreCase(name)) {
return newContentType;
}
return super.getHeader(name);
}
@Override
public Enumeration<String> getHeaders(String name) {
if ("Content-Type".equalsIgnoreCase(name)) {
return Collections.enumeration(Collections.singleton(newContentType));
}
return super.getHeaders(name);
}
@Override
public Enumeration<String> getHeaderNames() {
Map<String, String> headers = new HashMap<>();
HttpServletRequest originalRequest = (HttpServletRequest) getRequest();
Enumeration<String> headerNames = originalRequest.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
headers.put(headerName, headerName);
}
headers.put("Content-Type", "Content-Type");
return Collections.enumeration(headers.keySet());
}
}

57
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java

@ -37,6 +37,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
@ -53,6 +54,7 @@ import org.springblade.core.tool.utils.StringUtil;
import org.springblade.offline.service.IOfflineDataService; import org.springblade.offline.service.IOfflineDataService;
import org.springblade.resource.feign.IOssClient; import org.springblade.resource.feign.IOssClient;
import org.springblade.system.vo.CreateTableVO; import org.springblade.system.vo.CreateTableVO;
import org.springblade.system.vo.TemplateVO;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
@ -69,6 +71,7 @@ import java.lang.reflect.Method;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.nio.file.Files;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -905,8 +908,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
} }
R<BladeFile> r = null; R<BladeFile> r = null;
try { try {
MultipartFile multipartFile = this.getMultipartFile(file); r = putFile(file);
r = ossClient.putFile(multipartFile);
if (!r.isSuccess()) { if (!r.isSuccess()) {
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r); throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r);
} }
@ -948,8 +950,8 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
} }
R<BladeFile> r = null; R<BladeFile> r = null;
try { try {
MultipartFile multipartFile = this.getMultipartFile(file);
r = ossClient.putFile(multipartFile); r = putFile(file);
if (!r.isSuccess()) { if (!r.isSuccess()) {
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r); throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r);
} }
@ -963,46 +965,21 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
}); });
} }
private MultipartFile getMultipartFile(File file) { public R<BladeFile> putFile(File file) throws IOException {
FileItem fileItem = this.createFileItem(file); FileItem fileItem = new DiskFileItem("file", Files.probeContentType(file.toPath()),false,file.getName(),(int)file.length(),file.getParentFile());
return new CommonsMultipartFile(fileItem); try (InputStream inputStream = new FileInputStream(file); OutputStream os = fileItem.getOutputStream()){
} IOUtils.copy(inputStream,os);
public FileItem createFileItem(File file) {
FileItemFactory factory = new DiskFileItemFactory(16, null);
String textFieldName = "file";
FileItem item = factory.createItem(textFieldName, "text/plain", false,
file.getName());
int bytesRead = 0;
byte[] buffer = new byte[1024];
FileInputStream fis = null;
OutputStream os = null;
try {
fis = new FileInputStream(file);
os = item.getOutputStream();
while ((bytesRead = fis.read(buffer, 0, buffer.length)) != -1) { /*
os.write(buffer, 0, bytesRead); 把用户上传的zip包中的视频文件照片文件上传到miniio服务器并且返回映射关系的map
} */
os.close(); MultipartFile multipartFile = new CommonsMultipartFile(fileItem);
fis.close(); R<BladeFile> r = ossClient.putFile(multipartFile);
} catch (IOException e) { return r;
e.printStackTrace();
} finally {
try {
if (null != os) {
os.close();
}
if (null != fis) {
fis.close();
}
}catch (IOException e){ }catch (IOException e){
e.printStackTrace(); e.printStackTrace();
} }
return R.fail("shangc");
} }
return item;
}
} }

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java

@ -53,8 +53,8 @@ public class CentralMonitorController extends BladeController {
public R selectCommunication(@PathVariable Integer page, public R selectCommunication(@PathVariable Integer page,
@PathVariable Integer size, @PathVariable Integer size,
String roleId, String roleId,
Date start, String start,
Date end){ String end){
IPage<PointDataVo> result = monitorService.selectOriginalDataByRealIds(page, size, roleId,start,end); IPage<PointDataVo> result = monitorService.selectOriginalDataByRealIds(page, size, roleId,start,end);
return R.data(result); return R.data(result);
} }
@ -62,7 +62,7 @@ public class CentralMonitorController extends BladeController {
@GetMapping("/communications") @GetMapping("/communications")
@ApiOperation("查询通讯告警图表数据") @ApiOperation("查询通讯告警图表数据")
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
public R<List<PointDataVo>> communications(String roleId,Date start,Date end){ public R<List<PointDataVo>> communications(String roleId,String start,String end){
return R.data(monitorService.communications(roleId,start,end)); return R.data(monitorService.communications(roleId,start,end));
} }
} }

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/CentralMonitorService.java

@ -29,7 +29,7 @@ public interface CentralMonitorService{
* @param roleId * @param roleId
* @return * @return
*/ */
IPage<PointDataVo> selectOriginalDataByRealIds(Integer page, Integer size, String roleId, Date start, Date end); IPage<PointDataVo> selectOriginalDataByRealIds(Integer page, Integer size, String roleId, String start, String end);
List<PointDataVo> communications(String roleId, Date start, Date end); List<PointDataVo> communications(String roleId, String start, String end);
} }

39
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java

@ -22,6 +22,7 @@ import lombok.RequiredArgsConstructor;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
@ -37,10 +38,7 @@ import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Calendar; import java.util.*;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -94,7 +92,7 @@ public class CentralMonitorServiceImpl implements CentralMonitorService {
* @return * @return
*/ */
@Override @Override
public IPage<PointDataVo> selectOriginalDataByRealIds(Integer page, Integer size, String roleId,Date start,Date end) { public IPage<PointDataVo> selectOriginalDataByRealIds(Integer page, Integer size, String roleId,String start,String end) {
OriginalDataQuery originalDataQuery = new OriginalDataQuery(); OriginalDataQuery originalDataQuery = new OriginalDataQuery();
originalDataQuery.setRealId(roleId); originalDataQuery.setRealId(roleId);
originalDataQuery.setLimit(size); originalDataQuery.setLimit(size);
@ -109,12 +107,13 @@ public class CentralMonitorServiceImpl implements CentralMonitorService {
calendar.add(Calendar.MILLISECOND,-calendar.get(Calendar.MILLISECOND)); calendar.add(Calendar.MILLISECOND,-calendar.get(Calendar.MILLISECOND));
originalDataQuery.setBeginTime(calendar.getTime()); originalDataQuery.setBeginTime(calendar.getTime());
}else{ }else{
originalDataQuery.setBeginTime(start); originalDataQuery.setBeginTime(DateUtil.parse(start,DateUtil.PATTERN_DATETIME));
originalDataQuery.setEndTime(end); originalDataQuery.setEndTime(DateUtil.parse(end,DateUtil.PATTERN_DATETIME));
} }
IPage<PointDataVo> iPage = new Page<>(page, size);
Result<HzPage<PointData>> originalDataByRealIds = historyDataSearchClient.getOriginalDataByRealIds(originalDataQuery); Result<HzPage<PointData>> originalDataByRealIds = historyDataSearchClient.getOriginalDataByRealIds(originalDataQuery);
if (!originalDataByRealIds.isSuccess()) { if (!originalDataByRealIds.isSuccess() || ObjectUtil.isEmpty(originalDataByRealIds.getData()) || CollectionUtil.isEmpty(originalDataByRealIds.getData().getRecords())) {
throw new ServiceException("数据不存在"); return iPage;
} }
HzPage<PointData> data = originalDataByRealIds.getData(); HzPage<PointData> data = originalDataByRealIds.getData();
List<PointDataVo> collect = data.getRecords().stream().map(item -> { List<PointDataVo> collect = data.getRecords().stream().map(item -> {
@ -130,8 +129,6 @@ public class CentralMonitorServiceImpl implements CentralMonitorService {
} }
return pointDataVo; return pointDataVo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
IPage<PointDataVo> iPage = new Page<>(data.getCurrent(), data.getSize());
iPage.setRecords(collect); iPage.setRecords(collect);
iPage.setTotal(originalDataByRealIds.getData().getTotal()); iPage.setTotal(originalDataByRealIds.getData().getTotal());
return iPage; return iPage;
@ -145,11 +142,11 @@ public class CentralMonitorServiceImpl implements CentralMonitorService {
* @return * @return
*/ */
@Override @Override
public List<PointDataVo> communications(String roleId, Date start, Date end) { public List<PointDataVo> communications(String roleId, String start, String end) {
OriginalDataQuery originalDataQuery = new OriginalDataQuery(); OriginalDataQuery originalDataQuery = new OriginalDataQuery();
originalDataQuery.setRealId(roleId); originalDataQuery.setRealId(roleId);
originalDataQuery.setLimit(1); originalDataQuery.setLimit(10000);
originalDataQuery.setPage(100000); originalDataQuery.setPage(1);
// 当日 // 当日
if(ObjectUtil.isEmpty(start) && ObjectUtil.isEmpty(end)){ if(ObjectUtil.isEmpty(start) && ObjectUtil.isEmpty(end)){
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
@ -160,22 +157,22 @@ public class CentralMonitorServiceImpl implements CentralMonitorService {
calendar.add(Calendar.MILLISECOND,-calendar.get(Calendar.MILLISECOND)); calendar.add(Calendar.MILLISECOND,-calendar.get(Calendar.MILLISECOND));
originalDataQuery.setBeginTime(calendar.getTime()); originalDataQuery.setBeginTime(calendar.getTime());
}else{ }else{
originalDataQuery.setBeginTime(start); originalDataQuery.setBeginTime(DateUtil.parse(start,DateUtil.PATTERN_DATETIME));
originalDataQuery.setEndTime(end); originalDataQuery.setEndTime(DateUtil.parse(end,DateUtil.PATTERN_DATETIME));
} }
Result<HzPage<PointData>> originalDataByRealIds = historyDataSearchClient.getOriginalDataByRealIds(originalDataQuery); Result<HzPage<PointData>> originalDataByRealIds = historyDataSearchClient.getOriginalDataByRealIds(originalDataQuery);
if (!originalDataByRealIds.isSuccess()) { if (!originalDataByRealIds.isSuccess() || ObjectUtil.isEmpty(originalDataByRealIds.getData()) || CollectionUtil.isEmpty(originalDataByRealIds.getData().getRecords())) {
throw new ServiceException("数据不存在"); return new ArrayList<>();
} }
HzPage<PointData> data = originalDataByRealIds.getData(); HzPage<PointData> data = originalDataByRealIds.getData();
StationEntity station = stationService.getOne(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getCode,originalDataByRealIds.getData().getRecords().get(0).getStation())
);
return data.getRecords().stream().map(item -> { return data.getRecords().stream().map(item -> {
PointDataVo pointDataVo = new PointDataVo(); PointDataVo pointDataVo = new PointDataVo();
BeanUtils.copyProperties(item, pointDataVo); BeanUtils.copyProperties(item, pointDataVo);
//通过站点id获取站点名称 //通过站点id获取站点名称
String code = pointDataVo.getStation(); String code = pointDataVo.getStation();
StationEntity station = stationService.getOne(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getCode,code)
);
if(ObjectUtil.isNotEmpty(station)){ if(ObjectUtil.isNotEmpty(station)){
pointDataVo.setStationName(station.getName()); pointDataVo.setStationName(station.getName());
} }

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/service/impl/AlarmServiceImpl.java

@ -3,6 +3,7 @@ package com.hnac.hzims.operational.history.service.impl;
import com.hnac.hzims.operational.history.service.AlarmService; import com.hnac.hzims.operational.history.service.AlarmService;
import com.hnac.hzims.operational.history.vo.HistoryProjectAlarmVo; import com.hnac.hzims.operational.history.vo.HistoryProjectAlarmVo;
import com.hnac.hzinfo.sdk.core.response.Result; import com.hnac.hzinfo.sdk.core.response.Result;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import com.hnac.hzinfo.sdk.v5.soe.SoeDataClient; import com.hnac.hzinfo.sdk.v5.soe.SoeDataClient;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -42,7 +43,10 @@ public class AlarmServiceImpl implements AlarmService {
query.getCurrent(), query.getCurrent(),
query.getSize() query.getSize()
); );
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ if(!result.isSuccess()){
throw new ServiceException(result.getMsg());
}
if(CollectionUtil.isEmpty(result.getData())){
return new HashMap<>(); return new HashMap<>();
} }
return result.getData(); return result.getData();

26
hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/service/impl/PointServiceImpl.java

@ -15,10 +15,14 @@ import com.hnac.hzinfo.sdk.v5.project.ProjectClient;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.IResultCode;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.api.ResultCode;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -48,7 +52,7 @@ public class PointServiceImpl implements PointService {
public List<FacDeviceVO> projectFacDevice(String projectId,String attrName) { public List<FacDeviceVO> projectFacDevice(String projectId,String attrName) {
Result<List<FacDeviceVO>> result = hzFacClient.facDeviceByProjectId(projectId,attrName); Result<List<FacDeviceVO>> result = hzFacClient.facDeviceByProjectId(projectId,attrName);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
throw new ServiceException(DataResultCode.FAIL,result.getMsg()); return new ArrayList<>();
} }
return result.getData(); return result.getData();
} }
@ -63,7 +67,7 @@ public class PointServiceImpl implements PointService {
public List<FacDeviceAttrVO> projectFacDeviceAttr(String facDeviceId, String attrName) { public List<FacDeviceAttrVO> projectFacDeviceAttr(String facDeviceId, String attrName) {
Result<List<FacDeviceAttrVO>> result = hzFacClient.facDeviceAttrList(facDeviceId,attrName); Result<List<FacDeviceAttrVO>> result = hzFacClient.facDeviceAttrList(facDeviceId,attrName);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
throw new ServiceException(DataResultCode.FAIL,result.getMsg()); return new ArrayList<>();
} }
return result.getData(); return result.getData();
} }
@ -77,7 +81,7 @@ public class PointServiceImpl implements PointService {
public List<DeviceInstanceVO> projectDeviceInstance(String projectId,String attrName) { public List<DeviceInstanceVO> projectDeviceInstance(String projectId,String attrName) {
R<List<DeviceInstanceVO>> result = deviceClient.getOnlineDeviceInstanceSearchName(projectId,attrName); R<List<DeviceInstanceVO>> result = deviceClient.getOnlineDeviceInstanceSearchName(projectId,attrName);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
throw new ServiceException(DataResultCode.FAIL,result.getMsg()); return new ArrayList<>();
} }
return result.getData(); return result.getData();
} }
@ -92,7 +96,7 @@ public class PointServiceImpl implements PointService {
public List<DeviceInstanceAttrVO> projectDeviceInstanceAttr(String deviceCode, String attrName) { public List<DeviceInstanceAttrVO> projectDeviceInstanceAttr(String deviceCode, String attrName) {
Result<List<DeviceInstanceAttrVO>> result = deviceClient.getDeviceAttrByName(deviceCode,attrName); Result<List<DeviceInstanceAttrVO>> result = deviceClient.getDeviceAttrByName(deviceCode,attrName);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
throw new ServiceException(DataResultCode.FAIL,result.getMsg()); return new ArrayList<>();
} }
return result.getData(); return result.getData();
} }
@ -117,8 +121,11 @@ public class PointServiceImpl implements PointService {
curve.getCurrent(), curve.getCurrent(),
curve.getPageSize() curve.getPageSize()
); );
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ if(!result.isSuccess()){
throw new ServiceException(DataResultCode.FAIL,result.getMsg()); throw new ServiceException(result.getMsg());
}
if(CollectionUtil.isEmpty(result.getData())){
return new HashMap<>();
} }
return result.getData(); return result.getData();
} }
@ -140,8 +147,11 @@ public class PointServiceImpl implements PointService {
curve.getEndTime(), curve.getEndTime(),
curve.getDimension(), curve.getDimension(),
curve.getIntervalType()); curve.getIntervalType());
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ if(!result.isSuccess()){
throw new ServiceException(DataResultCode.FAIL,result.getMsg()); throw new ServiceException(result.getMsg());
}
if(CollectionUtil.isEmpty(result.getData())){
return new HashMap<>();
} }
return result.getData(); return result.getData();
} }

Loading…
Cancel
Save