bug调整
This commit is contained in:
@@ -18,7 +18,7 @@ public interface ICsWaveService extends IService<CsWave> {
|
||||
* @param fileName 文件名称
|
||||
* @return
|
||||
*/
|
||||
int findCountByName(String fileName);
|
||||
boolean findCountByName(String fileName);
|
||||
|
||||
/**
|
||||
* 修改文件状态
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.zlevent.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -8,6 +9,9 @@ import com.njcn.zlevent.pojo.po.CsWave;
|
||||
import com.njcn.zlevent.service.ICsWaveService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 治理波形文件记录表 服务实现类
|
||||
@@ -20,10 +24,11 @@ import org.springframework.stereotype.Service;
|
||||
public class CsWaveServiceImpl extends ServiceImpl<CsWaveMapper, CsWave> implements ICsWaveService {
|
||||
|
||||
@Override
|
||||
public int findCountByName(String fileName) {
|
||||
LambdaQueryWrapper<CsWave> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.like(CsWave::getRcdName,fileName).eq(CsWave::getStatus,1);
|
||||
return this.baseMapper.selectCount(lambdaQueryWrapper);
|
||||
public boolean findCountByName(String fileName) {
|
||||
List<CsWave> csWaveDat = selectCsWave(".dat",fileName);
|
||||
List<CsWave> csWaveCfg = selectCsWave(".cfg",fileName);
|
||||
// 判断两个查询结果是否都不为空
|
||||
return CollectionUtil.isNotEmpty(csWaveDat) && CollectionUtil.isNotEmpty(csWaveCfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,4 +37,11 @@ public class CsWaveServiceImpl extends ServiceImpl<CsWaveMapper, CsWave> impleme
|
||||
lambdaQueryWrapper.eq(CsWave::getRcdName,fileName).set(CsWave::getStatus,1);
|
||||
this.update(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
public List<CsWave> selectCsWave(String suffix, String fileName) {
|
||||
LambdaQueryWrapper<CsWave> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.like(CsWave::getRcdName, fileName.concat(suffix)).eq(CsWave::getStatus, 1);
|
||||
return this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -389,8 +389,8 @@ public class FileServiceImpl implements IFileService {
|
||||
List<String> list = new ArrayList<>();
|
||||
String[] parts = fileName.split(StrUtil.SLASH);
|
||||
fileName = parts[parts.length - 1].split("\\.")[0];
|
||||
int fileCounts = csWaveService.findCountByName(fileName);
|
||||
if (fileCounts >= 2){
|
||||
boolean result = csWaveService.findCountByName(fileName);
|
||||
if (result){
|
||||
CsEventParam csEventParam = new CsEventParam();
|
||||
csEventParam.setLineId(fileInfoDto.getLineId());
|
||||
csEventParam.setDeviceId(fileInfoDto.getDeviceId());
|
||||
|
||||
Reference in New Issue
Block a user