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