Commit 393622ea by 卓清洪

fix:设备列表空指针处理

parent a2fcd51a
package com.makeit.utils.data.excel; package com.makeit.utils.data.excel;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.makeit.common.vo.ExcelErrorVo; import com.makeit.common.vo.ExcelErrorVo;
import com.makeit.common.vo.ExcelImportVo; import com.makeit.common.vo.ExcelImportVo;
...@@ -194,18 +195,23 @@ public class ExcelValidatorUtil { ...@@ -194,18 +195,23 @@ public class ExcelValidatorUtil {
} }
List<ExcelErrorVo> errorVoList = bizValidate(beanMap, row.stream().collect(Collectors.groupingBy(ExcelErrorVo::getTitle)), start + i, o); List<ExcelErrorVo> errorVoList = bizValidate(beanMap, row.stream().collect(Collectors.groupingBy(ExcelErrorVo::getTitle)), start + i, o);
if (errorVoList == null || errorVoList.isEmpty()) { if (CollUtil.isEmpty(errorVoList) || errorVoList.isEmpty()) {
successCount++; successCount++;
} }
excelErrorVoList.addAll(errorVoList); excelErrorVoList.addAll(errorVoList);
} }
int errorCount = list.size() - successCount;
ExcelImportVo excelImportVo = new ExcelImportVo(); ExcelImportVo excelImportVo = new ExcelImportVo();
excelImportVo.setTotalCount(list.size()); excelImportVo.setTotalCount(list.size());
excelImportVo.setErrorCount(list.size() - successCount); excelImportVo.setErrorCount(errorCount);
excelImportVo.setSuccessCount(successCount); excelImportVo.setSuccessCount(successCount);
excelImportVo.setList(excelErrorVoList); excelImportVo.setList(excelErrorVoList);
excelImportVo.setMatchesCount(successCount);
if (errorCount > 0) {
excelImportVo.setSuccessCount(0);
}
if (excelImportVo.getErrorCount() == 0 && saveBatch != null) { if (excelImportVo.getErrorCount() == 0 && saveBatch != null) {
saveBatch.accept(list); saveBatch.accept(list);
......
...@@ -389,7 +389,7 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -389,7 +389,7 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
@Override @Override
public PageVO<PlatDeviceListVO> pageSaas(PageReqDTO<PlatDevice> pageReqDTO) { public PageVO<PlatDeviceListVO> pageSaas(PageReqDTO<PlatDevice> pageReqDTO) {
//PlatDevice param = pageReqDTO.getData(); //PlatDevice param = pageReqDTO.getData();
Page<PlatDevice> page = PageUtil.toMpPage(pageReqDTO); //Page<PlatDevice> page = PageUtil.toMpPage(pageReqDTO);
//LambdaQueryWrapper<PlatDevice> lambdaQueryWrapper = getLambdaQueryWrapper(param); //LambdaQueryWrapper<PlatDevice> lambdaQueryWrapper = getLambdaQueryWrapper(param);
//Page<PlatDevice> devicePage = page(page, lambdaQueryWrapper); //Page<PlatDevice> devicePage = page(page, lambdaQueryWrapper);
//List<PlatDevice> records = devicePage.getRecords(); //List<PlatDevice> records = devicePage.getRecords();
...@@ -398,13 +398,15 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -398,13 +398,15 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
PageReqDTO<PlatDeviceQueryDTO> request = new PageReqDTO<>(); PageReqDTO<PlatDeviceQueryDTO> request = new PageReqDTO<>();
request.setData(platDeviceQueryDTO); request.setData(platDeviceQueryDTO);
request.setPage(pageReqDTO.getPage());
request.setLimit(pageReqDTO.getLimit());
PageVO<PlatDeviceListVO> pageVO = page(request); PageVO<PlatDeviceListVO> pageVO = page(request);
List<PlatDeviceListVO> platDeviceListVOS = BeanDtoVoUtils.listVo(pageVO.getList(), PlatDeviceListVO.class); List<PlatDeviceListVO> platDeviceListVOS = BeanDtoVoUtils.listVo(pageVO.getList(), PlatDeviceListVO.class);
JoinUtil.join(platDeviceListVOS, platTenantService, BaseTenantDTO::getTenantId, BaseEntity::getId, (d, o) -> { JoinUtil.join(platDeviceListVOS, platTenantService, BaseTenantDTO::getTenantId, BaseEntity::getId, (d, o) -> {
d.setTenantName(o.getName()); d.setTenantName(o.getName());
}); });
return PageUtil.toPageVO(platDeviceListVOS, page); return pageVO;
} }
@Override @Override
......
...@@ -482,6 +482,9 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder ...@@ -482,6 +482,9 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
//List<SysConfigVO> sysConfigVOS1 = sysConfigService.viewListByCategoryCode(SysConfigCategoryConst.ELDER_CERTIFICATE_TYPE); //List<SysConfigVO> sysConfigVOS1 = sysConfigService.viewListByCategoryCode(SysConfigCategoryConst.ELDER_CERTIFICATE_TYPE);
ExcelImportVo result = new ExcelImportVo();
return ExcelValidatorUtil.validateMain(3, list, l -> { return ExcelValidatorUtil.validateMain(3, list, l -> {
int start = 3; int start = 3;
......
...@@ -721,6 +721,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -721,6 +721,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
excelImportVo.setErrorCount(errorCount); excelImportVo.setErrorCount(errorCount);
excelImportVo.setSuccessCount(successCount); excelImportVo.setSuccessCount(successCount);
excelImportVo.setList(errorVoList); excelImportVo.setList(errorVoList);
excelImportVo.setMatchesCount(successCount);
if(errorCount > 0){ if(errorCount > 0){
excelImportVo.setSuccessCount(0); excelImportVo.setSuccessCount(0);
excelImportVo.setMatchesCount(successCount); excelImportVo.setMatchesCount(successCount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment