pqbug解决

This commit is contained in:
wr
2023-05-22 15:59:51 +08:00
parent ded7f0f447
commit 682b40c849
4 changed files with 32 additions and 25 deletions

View File

@@ -58,7 +58,7 @@ public class ProgramVersionController extends BaseController {
@RequestParam("remark") String remark, @RequestParam("remark") String remark,
@RequestParam(value = "versionType",required = false) String versionType, @RequestParam(value = "versionType",required = false) String versionType,
@RequestParam("filename") String fileName, @RequestParam("filename") String fileName,
@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file) { @ApiParam(value = "文件") @RequestPart(value = "file",required = false) MultipartFile file) {
String methodDescribe = getMethodDescribe("addProgramVersion"); String methodDescribe = getMethodDescribe("addProgramVersion");
boolean res = programService.addProgramVersion(name,protocol,date,devType,remark,versionType,fileName,file); boolean res = programService.addProgramVersion(name,protocol,date,devType,remark,versionType,fileName,file);
if (res) { if (res) {
@@ -93,7 +93,7 @@ public class ProgramVersionController extends BaseController {
@RequestParam("remark") String remark, @RequestParam("remark") String remark,
@RequestParam(value = "versionType",required = false) String versionType, @RequestParam(value = "versionType",required = false) String versionType,
@RequestParam("filename") String fileName, @RequestParam("filename") String fileName,
@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file) { @ApiParam(value = "文件") @RequestPart(name = "file",required = false) MultipartFile file) {
String methodDescribe = getMethodDescribe("updateProgramVersion"); String methodDescribe = getMethodDescribe("updateProgramVersion");
boolean res = programService.updateProgramVersion(id,name,protocol,date,devType,remark,versionType,fileName,file); boolean res = programService.updateProgramVersion(id,name,protocol,date,devType,remark,versionType,fileName,file);
if (res) { if (res) {

View File

@@ -1,5 +1,6 @@
package com.njcn.device.pq.service.impl; package com.njcn.device.pq.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -79,17 +80,18 @@ public class ProgramVersionServiceImpl extends ServiceImpl<VersionMapper, Versio
} else { } else {
version.setVersionType(""); version.setVersionType("");
} }
if(ObjectUtil.isNotNull(file)){
byte[] b = null, bytes = null;
try {
b = file.getBytes();
byte[] b = null, bytes = null; InputStream in = file.getInputStream();
try { bytes = FileCopyUtils.copyToByteArray(in);
b = file.getBytes(); } catch (IOException e) {
e.printStackTrace();
InputStream in = file.getInputStream(); }
bytes = FileCopyUtils.copyToByteArray(in); version.setFile(b);
} catch (IOException e) {
e.printStackTrace();
} }
version.setFile(b);
version.setFileName(fileName); version.setFileName(fileName);
version.setVersionFlag(DataStateEnum.ENABLE.getCode()); version.setVersionFlag(DataStateEnum.ENABLE.getCode());
version.setState(DataStateEnum.ENABLE.getCode()); version.setState(DataStateEnum.ENABLE.getCode());
@@ -122,13 +124,15 @@ public class ProgramVersionServiceImpl extends ServiceImpl<VersionMapper, Versio
} else { } else {
version.setVersionType(""); version.setVersionType("");
} }
byte[] b = null; if(ObjectUtil.isNotNull(file)){
try { byte[] b = null;
b = file.getBytes(); try {
} catch (IOException e) { b = file.getBytes();
e.printStackTrace(); } catch (IOException e) {
e.printStackTrace();
}
version.setFile(b);
} }
version.setFile(b);
version.setFileName(fileName); version.setFileName(fileName);
version.setUpdateBy(RequestUtil.getUserIndex()); version.setUpdateBy(RequestUtil.getUserIndex());
version.setUpdateTime(LocalDateTime.now()); version.setUpdateTime(LocalDateTime.now());
@@ -169,11 +173,11 @@ public class ProgramVersionServiceImpl extends ServiceImpl<VersionMapper, Versio
nodeLambdaQueryWrapper nodeLambdaQueryWrapper
.eq(Version::getName, name) .eq(Version::getName, name)
.eq(Version::getState, DataStateEnum.ENABLE.getCode()); .eq(Version::getState, DataStateEnum.ENABLE.getCode());
int countByAccount = this.count(nodeLambdaQueryWrapper);
//更新的时候,需排除当前记录 //更新的时候,需排除当前记录
if (isExcludeSelf) { if (isExcludeSelf) {
nodeLambdaQueryWrapper.ne(Version::getId, id); nodeLambdaQueryWrapper.ne(Version::getId, id);
} }
int countByAccount = this.count(nodeLambdaQueryWrapper);
//大于等于1个则表示重复 //大于等于1个则表示重复
if (countByAccount >= 1) { if (countByAccount >= 1) {
throw new BusinessException(DeviceResponseEnum.FLOW_SAME_NAME); throw new BusinessException(DeviceResponseEnum.FLOW_SAME_NAME);

View File

@@ -138,7 +138,7 @@ public class ReportServiceImpl implements ReportService {
private final ReportMapper reportMapper; private final ReportMapper reportMapper;
public List<EventDetail> getED(DeviceInfoParam.BusinessParam businessParam) { public List<EventDetail> getED(DeviceInfoParam.BusinessParam businessParam,String id) {
List<EventDetail> info = new ArrayList<>(); List<EventDetail> info = new ArrayList<>();
List<GeneralDeviceDTO> deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(businessParam).getData(); List<GeneralDeviceDTO> deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(businessParam).getData();
List<String> lineIds = deviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList()); List<String> lineIds = deviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList());
@@ -146,6 +146,7 @@ public class ReportServiceImpl implements ReportService {
//数据暂降查询 //数据暂降查询
List<RmpEventDetailPO> eventDetails = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>() List<RmpEventDetailPO> eventDetails = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
.in(RmpEventDetailPO::getMeasurementPointId, lineIds) .in(RmpEventDetailPO::getMeasurementPointId, lineIds)
.eq(RmpEventDetailPO::getEventType, id)
.ge(StrUtil.isNotBlank(businessParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(businessParam.getSearchBeginTime()))) .ge(StrUtil.isNotBlank(businessParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(businessParam.getSearchBeginTime())))
.le(StrUtil.isNotBlank(businessParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(businessParam.getSearchEndTime()))) .le(StrUtil.isNotBlank(businessParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(businessParam.getSearchEndTime())))
); );
@@ -384,9 +385,11 @@ public class ReportServiceImpl implements ReportService {
public List<ReasonsVO> getReason(DeviceInfoParam.BusinessParam businessParam) { public List<ReasonsVO> getReason(DeviceInfoParam.BusinessParam businessParam) {
//获取暂降字典信息 //获取暂降字典信息
DictData dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData(); DictData dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
if(ObjectUtil.isNull(dictData)){
throw new BusinessException(DeviceResponseEnum.DIC_GET_EMPTY);
}
List<ReasonsVO> result = new ArrayList<>(); List<ReasonsVO> result = new ArrayList<>();
List<EventDetail> info = getED(businessParam); List<EventDetail> info = getED(businessParam, dictData.getId());
//获取字典表 //获取字典表
HttpResult<List<DictData>> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()); HttpResult<List<DictData>> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName());
List<DictData> data = reason.getData(); List<DictData> data = reason.getData();

View File

@@ -129,8 +129,8 @@ public class AuditServiceImpl extends ServiceImpl<UserLogMapper, UserLog> implem
aa.le("sys_user_log.update_time", endTime); aa.le("sys_user_log.update_time", endTime);
String nowTime = date + "" + endTime; String nowTime = date + "" + endTime;
//必须放到循环外,否则会刷新流 //必须放到循环外,否则会刷新流
ExcelWriter excelWriter = EasyExcel.write(generalInfo.getBusinessTempPath() + "//" + nowTime + ExcelTypeEnum.CSV.getValue(), UserLogExcel.class) ExcelWriter excelWriter = EasyExcel.write(generalInfo.getBusinessTempPath() + "//" + nowTime + ExcelTypeEnum.XLSX.getValue(), UserLogExcel.class)
.excelType(ExcelTypeEnum.CSV) // .excelType(ExcelTypeEnum.CSV)
.build(); .build();
try { try {
@@ -201,7 +201,7 @@ public class AuditServiceImpl extends ServiceImpl<UserLogMapper, UserLog> implem
try { try {
in = new FileInputStream(newFile); in = new FileInputStream(newFile);
String name = newFile.getName(); String name = newFile.getName();
String[] split = name.split(ExcelTypeEnum.CSV.getValue()); String[] split = name.split(ExcelTypeEnum.XLSX.getValue());
String[] splitTime = split[0].split(""); String[] splitTime = split[0].split("");
if (StrUtil.isBlank(splitTime[0]) || StrUtil.isBlank(splitTime[1])) { if (StrUtil.isBlank(splitTime[0]) || StrUtil.isBlank(splitTime[1])) {
@@ -212,7 +212,7 @@ public class AuditServiceImpl extends ServiceImpl<UserLogMapper, UserLog> implem
.le(UserLog::getCreateTime, splitTime[1].replace("_", ":")); .le(UserLog::getCreateTime, splitTime[1].replace("_", ":"));
this.remove(le); this.remove(le);
EasyExcel.read(newFile, UserLogExcel.class, new DemoDataListener(this.getBaseMapper())) EasyExcel.read(newFile, UserLogExcel.class, new DemoDataListener(this.getBaseMapper()))
.excelType(ExcelTypeEnum.CSV).doReadAll(); .excelType(ExcelTypeEnum.XLSX).doReadAll();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();