|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.om.entity.dto.AppDiagLogDTO;
|
|
import com.om.entity.dto.AppDiagLogDTO;
|
|
import com.om.entity.dto.DiaLogQueryPageDTO;
|
|
import com.om.entity.dto.DiaLogQueryPageDTO;
|
|
import com.om.entity.dto.DiagnoseLogVehicleInfo;
|
|
import com.om.entity.dto.DiagnoseLogVehicleInfo;
|
|
|
|
+import com.om.entity.dto.GuidDTO;
|
|
import com.om.entity.po.*;
|
|
import com.om.entity.po.*;
|
|
import com.om.entity.vo.DiaLogQueryPageVO;
|
|
import com.om.entity.vo.DiaLogQueryPageVO;
|
|
import com.om.entity.vo.DiaLogQueryVO;
|
|
import com.om.entity.vo.DiaLogQueryVO;
|
|
@@ -13,6 +14,7 @@ import com.om.exception.BadReqException;
|
|
import com.om.mapper.DiagnosticLogMapper;
|
|
import com.om.mapper.DiagnosticLogMapper;
|
|
import com.om.service.*;
|
|
import com.om.service.*;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.om.utils.AesUtil;
|
|
import com.om.utils.HuaweiObsUtil;
|
|
import com.om.utils.HuaweiObsUtil;
|
|
import com.om.utils.Result;
|
|
import com.om.utils.Result;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -78,7 +80,7 @@ public class DiagnosticLogServiceImpl extends ServiceImpl<DiagnosticLogMapper, D
|
|
vo.setPages((int) page.getPages());
|
|
vo.setPages((int) page.getPages());
|
|
vo.setTotal((int) page.getTotal());
|
|
vo.setTotal((int) page.getTotal());
|
|
|
|
|
|
- if (dto.getAccount() != null || dto.getVciSn()!= null || beginTime != null || endTime != null) {
|
|
|
|
|
|
+ if (dto.getAccount() != null || dto.getVciSn() != null || beginTime != null || endTime != null) {
|
|
vo.setSearchCount(true);
|
|
vo.setSearchCount(true);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -87,12 +89,15 @@ public class DiagnosticLogServiceImpl extends ServiceImpl<DiagnosticLogMapper, D
|
|
for (DiagnosticLog record : records) {
|
|
for (DiagnosticLog record : records) {
|
|
DiaLogQueryVO diaLogQueryVO = BeanUtil.copyProperties(record, DiaLogQueryVO.class);
|
|
DiaLogQueryVO diaLogQueryVO = BeanUtil.copyProperties(record, DiaLogQueryVO.class);
|
|
diaLogQueryVO.setAccount(record.getUsername());
|
|
diaLogQueryVO.setAccount(record.getUsername());
|
|
- Brand brand = brandService.getById(record.getBrandId());
|
|
|
|
- diaLogQueryVO.setBrand(brand.getBrandCn());
|
|
|
|
-
|
|
|
|
- Client client = clientService.getById(record.getClientId());
|
|
|
|
- diaLogQueryVO.setClientNum(client.getNumber());
|
|
|
|
|
|
+ diaLogQueryVO.setBrand(record.getBrandName());
|
|
|
|
|
|
|
|
+ Client client = clientService
|
|
|
|
+ .lambdaQuery()
|
|
|
|
+ .eq(Client::getNumber,record.getClientNum())
|
|
|
|
+ .one();
|
|
|
|
+ if (client != null) {
|
|
|
|
+ diaLogQueryVO.setClientNum(client.getNumber());
|
|
|
|
+ }
|
|
diaLogQueryVO.setVciSn(record.getVciSn());
|
|
diaLogQueryVO.setVciSn(record.getVciSn());
|
|
|
|
|
|
//todo 车型id vehicleId 查询车型
|
|
//todo 车型id vehicleId 查询车型
|
|
@@ -109,22 +114,21 @@ public class DiagnosticLogServiceImpl extends ServiceImpl<DiagnosticLogMapper, D
|
|
//根据id集合查询
|
|
//根据id集合查询
|
|
List<DiagnosticLog> diagnosticLogs = this.listByIds(ids);
|
|
List<DiagnosticLog> diagnosticLogs = this.listByIds(ids);
|
|
|
|
|
|
- if (CollectionUtil.isEmpty(diagnosticLogs)){
|
|
|
|
|
|
+ if (CollectionUtil.isEmpty(diagnosticLogs)) {
|
|
throw new BadReqException("本页诊断文件异常");
|
|
throw new BadReqException("本页诊断文件异常");
|
|
}
|
|
}
|
|
|
|
|
|
- LocalDate now = LocalDate.now();
|
|
|
|
- int year = now.getYear();
|
|
|
|
- int monthValue = now.getMonthValue();
|
|
|
|
- int day = now.getDayOfMonth();
|
|
|
|
|
|
|
|
List<String> downloadUrls = new ArrayList<>();
|
|
List<String> downloadUrls = new ArrayList<>();
|
|
String prefix = DIAGNOSTIC_LOG_PREFIX;
|
|
String prefix = DIAGNOSTIC_LOG_PREFIX;
|
|
for (DiagnosticLog diagnosticLog : diagnosticLogs) {
|
|
for (DiagnosticLog diagnosticLog : diagnosticLogs) {
|
|
String nameLog = diagnosticLog.getNameLog();
|
|
String nameLog = diagnosticLog.getNameLog();
|
|
-
|
|
|
|
|
|
+ int lastIndexOf = nameLog.lastIndexOf("/");
|
|
|
|
+ if (lastIndexOf != -1) {
|
|
|
|
+ nameLog = nameLog.substring(lastIndexOf + 1);
|
|
|
|
+ }
|
|
//获取下载链接
|
|
//获取下载链接
|
|
- String downloadUrl = obsUtil.getDownloadUrl(nameLog, prefix);
|
|
|
|
|
|
+ String downloadUrl = obsUtil.getUploadUrl(nameLog, prefix);
|
|
downloadUrls.add(downloadUrl);
|
|
downloadUrls.add(downloadUrl);
|
|
}
|
|
}
|
|
return Result.ok(downloadUrls);
|
|
return Result.ok(downloadUrls);
|
|
@@ -141,50 +145,58 @@ public class DiagnosticLogServiceImpl extends ServiceImpl<DiagnosticLogMapper, D
|
|
|
|
|
|
//获取文件名称
|
|
//获取文件名称
|
|
String nameLog = diagnosticLog.getNameLog();
|
|
String nameLog = diagnosticLog.getNameLog();
|
|
- LocalDate now = LocalDate.now();
|
|
|
|
- int year = now.getYear();
|
|
|
|
- int monthValue = now.getMonthValue();
|
|
|
|
- int day = now.getDayOfMonth();
|
|
|
|
|
|
+ int lastIndexOf = nameLog.lastIndexOf("/");
|
|
|
|
+ if (lastIndexOf != -1) {
|
|
|
|
+ nameLog = nameLog.substring(lastIndexOf + 1);
|
|
|
|
+ }
|
|
String prefix = DIAGNOSTIC_LOG_PREFIX;
|
|
String prefix = DIAGNOSTIC_LOG_PREFIX;
|
|
//获取下载链接
|
|
//获取下载链接
|
|
- String downloadUrl = obsUtil.getDownloadUrl(nameLog, prefix);
|
|
|
|
|
|
+ String downloadUrl = obsUtil.getUploadUrl(nameLog, prefix);
|
|
return Result.ok(downloadUrl);
|
|
return Result.ok(downloadUrl);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
public Result updateDiagLog(AppDiagLogDTO dto) {
|
|
public Result updateDiagLog(AppDiagLogDTO dto) {
|
|
- if (BeanUtil.isEmpty(dto)){
|
|
|
|
|
|
+ if (BeanUtil.isEmpty(dto)) {
|
|
throw new BadReqException("参数为空!!");
|
|
throw new BadReqException("参数为空!!");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ String username = dto.getUsername();
|
|
String guid = dto.getGuid();
|
|
String guid = dto.getGuid();
|
|
-
|
|
|
|
|
|
+ GuidDTO guidDTO = AesUtil.getGuidDTOFromGuid(guid);
|
|
|
|
+ String clientNum = guidDTO.getClientNum();
|
|
List<DiagnoseLogVehicleInfo> vehicleInfo = dto.getVehicleInfo();
|
|
List<DiagnoseLogVehicleInfo> vehicleInfo = dto.getVehicleInfo();
|
|
|
|
|
|
for (DiagnoseLogVehicleInfo diagnoseLogVehicleInfo : vehicleInfo) {
|
|
for (DiagnoseLogVehicleInfo diagnoseLogVehicleInfo : vehicleInfo) {
|
|
DiagnosticLog diagnosticLog = BeanUtil.copyProperties(diagnoseLogVehicleInfo, DiagnosticLog.class);
|
|
DiagnosticLog diagnosticLog = BeanUtil.copyProperties(diagnoseLogVehicleInfo, DiagnosticLog.class);
|
|
-
|
|
|
|
- VciInfo vciInfo = vciInfoService.lambdaQuery()
|
|
|
|
|
|
+ /*
|
|
|
|
+ VciInfo vciInfo = vciInfoService.lambdaQuery()
|
|
.eq(VciInfo::getVciNum, diagnoseLogVehicleInfo.getVciSn())
|
|
.eq(VciInfo::getVciNum, diagnoseLogVehicleInfo.getVciSn())
|
|
.one();
|
|
.one();
|
|
if (BeanUtil.isEmpty(vciInfo)){
|
|
if (BeanUtil.isEmpty(vciInfo)){
|
|
throw new BadReqException("该vci设备不存在!!!");
|
|
throw new BadReqException("该vci设备不存在!!!");
|
|
}
|
|
}
|
|
|
|
+ */
|
|
|
|
|
|
- Brand brand = brandService.lambdaQuery()
|
|
|
|
- .eq(Brand::getBrandCn, diagnoseLogVehicleInfo.getBrand())
|
|
|
|
- .one();
|
|
|
|
- if (BeanUtil.isEmpty(brand)){
|
|
|
|
- throw new BadReqException("该品牌不存在!!!");
|
|
|
|
- }
|
|
|
|
- diagnosticLog.setVciSn(vciInfo.getVciNum());
|
|
|
|
- diagnosticLog.setBrandId(brand.getId());
|
|
|
|
|
|
+ diagnosticLog.setVciSn(diagnoseLogVehicleInfo.getVciSn());
|
|
|
|
+ diagnosticLog.setClientNum(clientNum);
|
|
|
|
+ diagnosticLog.setBrandName(diagnoseLogVehicleInfo.getBrand());
|
|
diagnosticLog.setCreateTime(LocalDateTime.now());
|
|
diagnosticLog.setCreateTime(LocalDateTime.now());
|
|
diagnosticLog.setUpdateTime(LocalDateTime.now());
|
|
diagnosticLog.setUpdateTime(LocalDateTime.now());
|
|
|
|
+ diagnosticLog.setUsername(username);
|
|
this.save(diagnosticLog);
|
|
this.save(diagnosticLog);
|
|
}
|
|
}
|
|
|
|
|
|
return Result.ok();
|
|
return Result.ok();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Result delete(Integer id) {
|
|
|
|
+ DiagnosticLog diagnosticLog = this.getById(id);
|
|
|
|
+ if (BeanUtil.isEmpty(diagnosticLog)) {
|
|
|
|
+ throw new BadReqException("该诊断日志不存在");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return Result.ok(this.removeById(diagnosticLog.getId()));
|
|
|
|
+ }
|
|
}
|
|
}
|