From 82e4e5f6129be2e691138cd8b8ea3262e64943af Mon Sep 17 00:00:00 2001
From: rain <167982779@qq.com>
Date: Thu, 04 Jul 2024 15:54:19 +0800
Subject: [PATCH] 修改播放地址
---
src/main/java/com/dji/sample/patches/service/impl/GetPatchesServiceImpl.java | 130 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 114 insertions(+), 16 deletions(-)
diff --git a/src/main/java/com/dji/sample/patches/service/impl/GetPatchesServiceImpl.java b/src/main/java/com/dji/sample/patches/service/impl/GetPatchesServiceImpl.java
index df577ca..5294366 100644
--- a/src/main/java/com/dji/sample/patches/service/impl/GetPatchesServiceImpl.java
+++ b/src/main/java/com/dji/sample/patches/service/impl/GetPatchesServiceImpl.java
@@ -1,20 +1,26 @@
package com.dji.sample.patches.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dji.sample.common.model.Pagination;
import com.dji.sample.common.model.PaginationData;
import com.dji.sample.media.dao.IFileMapper;
+import com.dji.sample.media.dao.IMarkMapper;
import com.dji.sample.media.model.MediaFileEntity;
+import com.dji.sample.media.model.MediaFileMarkEntity;
import com.dji.sample.patches.dao.GetPatchesMapper;
import com.dji.sample.patches.model.Param.PatchesParam;
import com.dji.sample.patches.model.entity.LotInfo;
import com.dji.sample.patches.service.GetPatchesService;
-import com.dji.sample.wayline.model.entity.WaylineFileEntity;
+import com.dji.sample.patches.utils.DistrictCodeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import java.util.stream.Collectors;
@Service
@@ -23,30 +29,122 @@
private GetPatchesMapper mapper;
@Autowired
private IFileMapper fileMapper;
+ @Autowired
+ private IMarkMapper markMapper;
+ /**
+ * 分页获取数据的接口实现。
+ *
+ * @param param 包含分页信息和查询条件的工作空间ID。
+ * @return 返回一个包含查询结果和分页信息的PaginationData对象。
+ */
@Override
public PaginationData<LotInfo> limitGet(PatchesParam param) {
- Page<LotInfo> page = mapper.selectPage(new Page<LotInfo>(param.getPage(), param.getPageSize()),
- new LambdaQueryWrapper<LotInfo>()
- .eq(LotInfo::getWorkspaceId,param.getWorkspaceId()));
- List<LotInfo> records = page.getRecords()
+ // 创建分页对象
+ Page<LotInfo> page = new Page<>(param.getPage(), param.getPageSize());
+
+ // 创建查询条件对象
+ LambdaQueryWrapper<LotInfo> queryWrapper = new LambdaQueryWrapper<>();
+
+ // 添加查询条件
+ queryWrapper.eq(LotInfo::getWorkspaceId, param.getWorkspaceId());
+
+ if (param.getDkbh() != null && !param.getDkbh().isEmpty()) {
+ queryWrapper.like(LotInfo::getDkbh, param.getDkbh());
+ }
+ if (param.getInvestigate() != null) {
+ queryWrapper.eq(LotInfo::getInvestigate, param.getInvestigate());
+ }
+ if (param.getDkbh() != null && !param.getDkbh().isEmpty()) {
+ queryWrapper.like(LotInfo::getDkbh, param.getDkbh());
+ }
+ if (param.getXzqdm() != null && !param.getXzqdm().isEmpty()) {
+ queryWrapper.like(LotInfo::getXzqdm, param.getXzqdm());
+ }
+ if (param.getXmc() != null && !param.getXmc().isEmpty()) {
+ queryWrapper.like(LotInfo::getXmc, param.getXmc());
+ }
+ if (param.getBsm() != null && !param.getBsm().isEmpty()) {
+ queryWrapper.like(LotInfo::getXmc, param.getBsm());
+ }
+
+ // 执行分页查询
+ Page<LotInfo> resultPage = mapper.selectPage(page, queryWrapper);
+
+ // 处理查询结果
+ List<LotInfo> records = resultPage.getRecords()
.stream()
+ .peek(lotInfo -> {
+ // 修改 xzqdm 字段的值
+ lotInfo.setXmc(DistrictCodeUtils.codeToName(lotInfo.getXzqdm()));
+ })
.collect(Collectors.toList());
- return new PaginationData<LotInfo>(records, new Pagination(page));
+
+ // 返回分页数据
+ return new PaginationData<>(records, new Pagination(resultPage));
+ }
+ @Override
+ public int delPatches(String workspaceId) {
+ return mapper.delete(new LambdaQueryWrapper<LotInfo>().eq(LotInfo::getWorkspaceId,workspaceId));
}
@Override
- public void delPatches() {
- mapper.delete(null);
+ public int deleteOne(int id) {
+ return mapper.deleteById(id);
}
@Override
- public PaginationData<MediaFileEntity> getPhoto(PatchesParam param,String dkbh) {
- Page<MediaFileEntity> page=fileMapper.selectPage(new Page<MediaFileEntity>(param.getPage(), param.getPageSize()),
- new LambdaQueryWrapper<MediaFileEntity>().like(MediaFileEntity::getFileName, "%" + dkbh + "%") );
- List<MediaFileEntity> records = page.getRecords()
- .stream()
- .collect(Collectors.toList());
- return new PaginationData<MediaFileEntity>(records, new Pagination(page));
+ public PaginationData getPhoto(PatchesParam param, String dkbh) {
+ LotInfo lotInfo=getLotinfoToDb(dkbh);
+ int statue=lotInfo.getIsPush();
+ if (statue==1){
+ Page<MediaFileMarkEntity> page = markMapper.selectPage(new Page<MediaFileMarkEntity>(param.getPage(), param.getPageSize()),
+ new LambdaQueryWrapper<MediaFileMarkEntity>().like(MediaFileMarkEntity::getFileName, "%" + dkbh + "~" + "%"));
+ List<MediaFileMarkEntity> records = page.getRecords()
+ .stream()
+ .collect(Collectors.toList());
+ return new PaginationData<MediaFileMarkEntity>(records, new Pagination(page));}
+ else {
+ Page<MediaFileEntity> page = fileMapper.selectPage(new Page<MediaFileEntity>(param.getPage(), param.getPageSize()),
+ new LambdaQueryWrapper<MediaFileEntity>().like(MediaFileEntity::getFileName, "%" + dkbh + "~" + "%"));
+ List<MediaFileEntity> records = page.getRecords()
+ .stream()
+ .collect(Collectors.toList());
+ return new PaginationData<MediaFileEntity>(records, new Pagination(page));}
+
+ }
+
+ public List<MediaFileEntity> listPohto(String dkbh, String workspaceId) {
+ return fileMapper.selectList(new LambdaQueryWrapper<MediaFileEntity>().like(MediaFileEntity::getFileName, "%" + dkbh + "%")
+ .eq(MediaFileEntity::getWorkspaceId, workspaceId));
+ }
+ public LotInfo getLotinfo(String dkbh, String workspaceId) {
+ return mapper.selectOne(new LambdaQueryWrapper<LotInfo>().eq(LotInfo::getDkbh, dkbh)
+ .eq(LotInfo::getWorkspaceId, workspaceId));
+ }
+ public void patchesPushed(String taskId, String dkbh, String workspaceId) {
+ LambdaUpdateWrapper<LotInfo> updateWrapper = new LambdaUpdateWrapper<>();
+ updateWrapper.set(LotInfo::getIsPush, 1)
+ .eq(LotInfo::getWorkspaceId, workspaceId)
+ .eq(LotInfo::getDkbh, dkbh)
+ .eq(LotInfo::getTaskId, taskId);
+ mapper.update(null, updateWrapper);
+ }
+ public LotInfo getLotinfoToDb(String dkbh) {
+ return mapper.selectOne(new LambdaQueryWrapper<LotInfo>().eq(LotInfo::getDkbh, dkbh));
+ }
+
+ public List<LotInfo> listLotinfo() {
+ return mapper.selectList(null);
+ }
+ @Override
+ public LotInfo getPatchesFromId(String patchesId){
+ return mapper.selectOne(new LambdaQueryWrapper<LotInfo>().eq(LotInfo::getId,patchesId));
+ }
+ @Override
+ public void insertLotinfo(List<LotInfo> list) {
+ for (int i = 0; i < list.size(); i++) {
+ mapper.insert(list.get(i));
+ }
}
}
--
Gitblit v1.9.3