//先校验 | //先校验 | ||||
InvwCardDetails cardDetails = repo.findById(dto.getId()).orElse(null); | InvwCardDetails cardDetails = repo.findById(dto.getId()).orElse(null); | ||||
if (!InvDeviceStatus.NEW.equals(cardDetails.getStatus())){ | if (!InvDeviceStatus.NEW.equals(cardDetails.getStatus())){ | ||||
throw new ManagerException("设备正常在库时可移除"); | |||||
throw new ManagerException("设备正常在库时可移除!"); | |||||
} | } | ||||
InvwWarehouse warehouse = warehouseRepo.findByCodeAndStatus(cardDetails.getStoreCode(), EnableStatus.ENABLE); | InvwWarehouse warehouse = warehouseRepo.findByCodeAndStatus(cardDetails.getStoreCode(), EnableStatus.ENABLE); | ||||
String agencyId = findAgencyIdByToken(dto.getAccessToken()); | String agencyId = findAgencyIdByToken(dto.getAccessToken()); | ||||
if (warehouse.getWarehouseLevel() == 1){//一级仓库设备黔通人员可操作 | if (warehouse.getWarehouseLevel() == 1){//一级仓库设备黔通人员可操作 | ||||
if(!"52010106004".equals(agencyId)){ | if(!"52010106004".equals(agencyId)){ | ||||
throw new ManagerException("一级仓库设备仅黔通人员可操作"); | |||||
throw new ManagerException("一级仓库设备仅黔通人员可操作!"); | |||||
} | } | ||||
}else { | }else { | ||||
if (warehouse.getAgencyId().equals(agencyId)){ | |||||
throw new ManagerException("二三级仓库仅设备渠道人员可操作"); | |||||
if (!warehouse.getAgencyId().equals(agencyId)){ | |||||
throw new ManagerException("二三级仓库仅设备渠道人员可操作!"); | |||||
} | } | ||||
} | } | ||||
cardDetails.setStatus(InvDeviceStatus.DELETED); | cardDetails.setStatus(InvDeviceStatus.DELETED); | ||||
Map<String, String> storeMap = storeList.stream().collect(Collectors.toMap(InvwWarehouse::getCode, InvwWarehouse::getName)); | Map<String, String> storeMap = storeList.stream().collect(Collectors.toMap(InvwWarehouse::getCode, InvwWarehouse::getName)); | ||||
List<InvwCardDetailsExcelModel> excelModelList2 = excelModelList.stream().peek(t -> t.setStoreName(storeMap.get(t.getStoreCode()))).collect(Collectors.toList()); | List<InvwCardDetailsExcelModel> excelModelList2 = excelModelList.stream().peek(t -> t.setStoreName(storeMap.get(t.getStoreCode()))).collect(Collectors.toList()); | ||||
File file = EasyExcelUtil.exportExcelFile(InvwCardDetailsExcelModel.class, excelModelList2, "卡设备"); | File file = EasyExcelUtil.exportExcelFile(InvwCardDetailsExcelModel.class, excelModelList2, "卡设备"); | ||||
String filePath = minioUtil.fileUploadHttp(file, "invw", BucketFileBus.INVW); | |||||
String filePath = minioUtil.fileUploadHttp(file, BucketFileBus.INVW); | |||||
CommExcelFileResponseDTO responseDTO = new CommExcelFileResponseDTO(); | CommExcelFileResponseDTO responseDTO = new CommExcelFileResponseDTO(); | ||||
return responseDTO.setFilePath(filePath); | return responseDTO.setFilePath(filePath); | ||||
} | } |
// 写入数据 | // 写入数据 | ||||
EasyExcel.write(file, InvwQryCardBatchExcelModel.class).sheet(excelName).doWrite(excelModels); | EasyExcel.write(file, InvwQryCardBatchExcelModel.class).sheet(excelName).doWrite(excelModels); | ||||
// 上传文件 | // 上传文件 | ||||
String uploadUrl = minioUtil.fileUploadHttp(file, "invw", BucketFileBus.INVW); | |||||
String uploadUrl = minioUtil.fileUploadHttp(file, BucketFileBus.INVW); | |||||
CommExcelFileResponseDTO response = new CommExcelFileResponseDTO(); | CommExcelFileResponseDTO response = new CommExcelFileResponseDTO(); | ||||
response.setFilePath(minioUtil.getOuterUrl(uploadUrl)); | response.setFilePath(minioUtil.getOuterUrl(uploadUrl)); | ||||
return response; | return response; |
// 写入数据 | // 写入数据 | ||||
EasyExcel.write(file, InvwQryCardsExcelModel.class).sheet(excelName).doWrite(excelModels); | EasyExcel.write(file, InvwQryCardsExcelModel.class).sheet(excelName).doWrite(excelModels); | ||||
// 上传文件 | // 上传文件 | ||||
String uploadUrl = minioUtil.fileUploadHttp(file, "invw", BucketFileBus.INVW); | |||||
String uploadUrl = minioUtil.fileUploadHttp(file, BucketFileBus.INVW); | |||||
CommExcelFileResponseDTO response = new CommExcelFileResponseDTO(); | CommExcelFileResponseDTO response = new CommExcelFileResponseDTO(); | ||||
response.setFilePath(minioUtil.getOuterUrl(uploadUrl)); | response.setFilePath(minioUtil.getOuterUrl(uploadUrl)); | ||||
return response; | return response; |
throw new ManagerException("一级仓库设备仅黔通人员可操作"); | throw new ManagerException("一级仓库设备仅黔通人员可操作"); | ||||
} | } | ||||
}else { | }else { | ||||
if (warehouse.getAgencyId().equals(agencyId)){ | |||||
if (!warehouse.getAgencyId().equals(agencyId)){ | |||||
throw new ManagerException("二三级仓库仅设备渠道人员可操作"); | throw new ManagerException("二三级仓库仅设备渠道人员可操作"); | ||||
} | } | ||||
} | } | ||||
Map<String, String> storeMap = storeList.stream().collect(Collectors.toMap(InvwWarehouse::getCode, InvwWarehouse::getName)); | Map<String, String> storeMap = storeList.stream().collect(Collectors.toMap(InvwWarehouse::getCode, InvwWarehouse::getName)); | ||||
List<InvwObuDetailsExcelModel> excelModelList2 = excelModelList.stream().peek(t -> t.setStoreName(storeMap.get(t.getStoreCode()))).collect(Collectors.toList()); | List<InvwObuDetailsExcelModel> excelModelList2 = excelModelList.stream().peek(t -> t.setStoreName(storeMap.get(t.getStoreCode()))).collect(Collectors.toList()); | ||||
File file = EasyExcelUtil.exportExcelFile(InvwObuDetailsExcelModel.class, excelModelList2, "签设备"); | File file = EasyExcelUtil.exportExcelFile(InvwObuDetailsExcelModel.class, excelModelList2, "签设备"); | ||||
String filePath = minioUtil.fileUploadHttp(file, "invw", BucketFileBus.INVW); | |||||
String filePath = minioUtil.fileUploadHttp(file, BucketFileBus.INVW); | |||||
CommExcelFileResponseDTO responseDTO = new CommExcelFileResponseDTO(); | CommExcelFileResponseDTO responseDTO = new CommExcelFileResponseDTO(); | ||||
return responseDTO.setFilePath(filePath); | return responseDTO.setFilePath(filePath); | ||||
} | } |
// 写入数据 | // 写入数据 | ||||
EasyExcel.write(file, InvwQryObuBatchExcelModel.class).sheet(excelName).doWrite(excelModels); | EasyExcel.write(file, InvwQryObuBatchExcelModel.class).sheet(excelName).doWrite(excelModels); | ||||
// 上传文件 | // 上传文件 | ||||
String uploadUrl = minioUtil.fileUploadHttp(file, "invw", BucketFileBus.INVW); | |||||
String uploadUrl = minioUtil.fileUploadHttp(file, BucketFileBus.INVW); | |||||
CommExcelFileResponseDTO response = new CommExcelFileResponseDTO(); | CommExcelFileResponseDTO response = new CommExcelFileResponseDTO(); | ||||
response.setFilePath(minioUtil.getOuterUrl(uploadUrl)); | response.setFilePath(minioUtil.getOuterUrl(uploadUrl)); | ||||
return response; | return response; |
// 写入数据 | // 写入数据 | ||||
EasyExcel.write(file, InvwQryObusExcelModel.class).sheet(excelName).doWrite(excelModels); | EasyExcel.write(file, InvwQryObusExcelModel.class).sheet(excelName).doWrite(excelModels); | ||||
// 上传文件 | // 上传文件 | ||||
String uploadUrl = minioUtil.fileUploadHttp(file, "ivnw", BucketFileBus.INVW); | |||||
String uploadUrl = minioUtil.fileUploadHttp(file, BucketFileBus.INVW); | |||||
CommExcelFileResponseDTO response = new CommExcelFileResponseDTO(); | CommExcelFileResponseDTO response = new CommExcelFileResponseDTO(); | ||||
response.setFilePath(minioUtil.getOuterUrl(uploadUrl)); | response.setFilePath(minioUtil.getOuterUrl(uploadUrl)); | ||||
return response; | return response; |
try { | try { | ||||
File tempFile = File.createTempFile("temp_error_设备移除错误反馈表", ".xlsx"); | File tempFile = File.createTempFile("temp_error_设备移除错误反馈表", ".xlsx"); | ||||
EasyExcel.write(tempFile, InvwStocktakingInfoRemoveModel.class).sheet("设备移除错误反馈表").doWrite(result); | EasyExcel.write(tempFile, InvwStocktakingInfoRemoveModel.class).sheet("设备移除错误反馈表").doWrite(result); | ||||
return minioUtil.fileUploadHttp(tempFile, "invw", BucketFileBus.INVW); | |||||
return minioUtil.fileUploadHttp(tempFile, BucketFileBus.INVW); | |||||
} catch (Exception e) { | } catch (Exception e) { | ||||
throw e; | throw e; | ||||
} | } |
List<IssueOrderRefund> list = repo.list(pageRequest); | List<IssueOrderRefund> list = repo.list(pageRequest); | ||||
List<IssueOrderRefundExcelModel> excelModelList = SourceTargetMapper.INSTANCE.orderRefundToModelList(list); | List<IssueOrderRefundExcelModel> excelModelList = SourceTargetMapper.INSTANCE.orderRefundToModelList(list); | ||||
File file = EasyExcelUtil.exportExcelFile(IssueOrderRefundExcelModel.class, excelModelList, "退费管理"); | File file = EasyExcelUtil.exportExcelFile(IssueOrderRefundExcelModel.class, excelModelList, "退费管理"); | ||||
String filePath = minioUtil.fileUploadHttp(file, "managew", BucketFileBus.MANAGEW); | |||||
String filePath = minioUtil.fileUploadHttp(file, BucketFileBus.MANAGEW); | |||||
return new IssueOrderRefundExportResponseDTO(filePath); | return new IssueOrderRefundExportResponseDTO(filePath); | ||||
} | } | ||||
List<IssueOrderRefund> list = repo.list(pageRequest); | List<IssueOrderRefund> list = repo.list(pageRequest); | ||||
List<IssueOrderRefundExcelModel> excelModelList = SourceTargetMapper.INSTANCE.orderRefundToModelList(list); | List<IssueOrderRefundExcelModel> excelModelList = SourceTargetMapper.INSTANCE.orderRefundToModelList(list); | ||||
File file = EasyExcelUtil.exportExcelFile(IssueOrderRefundExcelModel.class, excelModelList, "退费管理"); | File file = EasyExcelUtil.exportExcelFile(IssueOrderRefundExcelModel.class, excelModelList, "退费管理"); | ||||
String filePath = minioUtil.fileUploadHttp(file, "settlew", BucketFileBus.SETTLEW); | |||||
String filePath = minioUtil.fileUploadHttp(file, BucketFileBus.SETTLEW); | |||||
return new IssueOrderRefundExportResponseDTO(filePath); | return new IssueOrderRefundExportResponseDTO(filePath); | ||||
} | } | ||||