|
@@ -25,6 +25,7 @@ import java.time.ZoneOffset;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.List;
|
|
|
+import java.util.function.Predicate;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -71,7 +72,7 @@ public class DiagnosisVersionInfoServiceImpl extends ServiceImpl<DiagnosisVersio
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
for (int i = 0; i < clientNums.length; i++) {
|
|
|
sb.append(clientNums[i]);
|
|
|
- if (clientNums.length != 1 && i != clientNums.length - 1){
|
|
|
+ if (clientNums.length != 1 && i != clientNums.length - 1) {
|
|
|
sb.append(",");
|
|
|
}
|
|
|
}
|
|
@@ -100,8 +101,6 @@ public class DiagnosisVersionInfoServiceImpl extends ServiceImpl<DiagnosisVersio
|
|
|
this.save(info);
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
LambdaQueryWrapper<DiagnosisVersionInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(DiagnosisVersionInfo::getId, info.getId());
|
|
|
//保存后获取
|
|
@@ -221,7 +220,7 @@ public class DiagnosisVersionInfoServiceImpl extends ServiceImpl<DiagnosisVersio
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public Result getByUserId( Integer id) {
|
|
|
+ public Result getByUserId(Integer id) {
|
|
|
DiagnosisVersionVO versionVO = this.getVO(id);
|
|
|
|
|
|
|
|
@@ -263,8 +262,8 @@ public class DiagnosisVersionInfoServiceImpl extends ServiceImpl<DiagnosisVersio
|
|
|
Client client = clientService.lambdaQuery()
|
|
|
.eq(Client::getNumber, diagClients.get(j).getClientNum())
|
|
|
.one();
|
|
|
- if (BeanUtil.isEmpty(client)){
|
|
|
- throw new BadReqException("该客户端编号"+diagClients.get(j).getClientNum()+"不存在");
|
|
|
+ if (BeanUtil.isEmpty(client)) {
|
|
|
+ throw new BadReqException("该客户端编号" + diagClients.get(j).getClientNum() + "不存在");
|
|
|
}
|
|
|
nums[j] = client.getNumber();
|
|
|
s[j] = client.getName();
|
|
@@ -291,8 +290,8 @@ public class DiagnosisVersionInfoServiceImpl extends ServiceImpl<DiagnosisVersio
|
|
|
Brand brand = brandService.lambdaQuery()
|
|
|
.eq(Brand::getBrandCode, info.getBrandCode())
|
|
|
.one();
|
|
|
- if (BeanUtil.isEmpty(brand)){
|
|
|
- throw new BadReqException(info.getDiagnosisName()+"此诊断程序中品牌编号有误");
|
|
|
+ if (BeanUtil.isEmpty(brand)) {
|
|
|
+ throw new BadReqException(info.getDiagnosisName() + "此诊断程序中品牌编号有误");
|
|
|
}
|
|
|
//传入客户端
|
|
|
versionVO.setLanguage(language);
|
|
@@ -326,7 +325,7 @@ public class DiagnosisVersionInfoServiceImpl extends ServiceImpl<DiagnosisVersio
|
|
|
queryWrapper.eq(DiagnosisVersionInfo::getId, id);
|
|
|
this.update(info, queryWrapper);
|
|
|
|
|
|
- if (CollectionUtil.isNotEmpty(diagnosisVersionInfoList)){
|
|
|
+ if (CollectionUtil.isNotEmpty(diagnosisVersionInfoList)) {
|
|
|
for (DiagnosisVersionInfo diagnosisVersionInfo : diagnosisVersionInfoList) {
|
|
|
diagnosisVersionInfo.setStatus(2);
|
|
|
}
|
|
@@ -418,7 +417,7 @@ public class DiagnosisVersionInfoServiceImpl extends ServiceImpl<DiagnosisVersio
|
|
|
}
|
|
|
User user = userService.getById(userId);
|
|
|
if (BeanUtil.isEmpty(user)) {
|
|
|
- return Result.fail(240339,"该客户端账号不存在",null);
|
|
|
+ return Result.fail(240339, "该客户端账号不存在", null);
|
|
|
}
|
|
|
List<VehicleDates> voList = new ArrayList<>();
|
|
|
|
|
@@ -427,19 +426,29 @@ public class DiagnosisVersionInfoServiceImpl extends ServiceImpl<DiagnosisVersio
|
|
|
|
|
|
List<DiagnosisVersionInfo> diagnosisVersionInfos = this.lambdaQuery()
|
|
|
.eq(DiagnosisVersionInfo::getBrandCode, vehicleDates.getBrandCode())
|
|
|
- .eq(user.getUserType() == 0,DiagnosisVersionInfo::getStatus,1)
|
|
|
- .eq(user.getUserType() == 1,DiagnosisVersionInfo::getStatus,0)
|
|
|
- .apply("CONCAT(',', client_number, ',') LIKE {0}", "%,"+clientNum+",%")
|
|
|
- .gt(StringUtils.isNotBlank(version),DiagnosisVersionInfo::getVersion, version)
|
|
|
+ .eq(user.getUserType() == 0, DiagnosisVersionInfo::getStatus, 1)
|
|
|
+ .eq(user.getUserType() == 1, DiagnosisVersionInfo::getStatus, 0)
|
|
|
+ .apply("CONCAT(',', client_number, ',') LIKE {0}", "%," + clientNum + ",%")
|
|
|
+ //.gt(StringUtils.isNotBlank(version),DiagnosisVersionInfo::getVersion, version)
|
|
|
.orderByDesc(DiagnosisVersionInfo::getVersion)
|
|
|
.list();
|
|
|
- if(CollectionUtil.isEmpty(diagnosisVersionInfos)){
|
|
|
- continue;
|
|
|
+ if (CollectionUtil.isEmpty(diagnosisVersionInfos)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ diagnosisVersionInfos = diagnosisVersionInfos.stream().filter(diagnosisVersionInfo ->
|
|
|
+ VersionComparator.compareVersions(diagnosisVersionInfo.getVersion(), version) >= 0)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (CollectionUtil.isEmpty(diagnosisVersionInfos)) {
|
|
|
+ continue;
|
|
|
}
|
|
|
+
|
|
|
DiagnosisVersionInfo diagnosisVersionInfo = diagnosisVersionInfos.get(0);
|
|
|
+
|
|
|
+
|
|
|
//根据品牌id查询品牌
|
|
|
Brand brand = brandService.lambdaQuery()
|
|
|
- .eq(Brand::getBrandCode,diagnosisVersionInfo.getBrandCode())
|
|
|
+ .eq(Brand::getBrandCode, diagnosisVersionInfo.getBrandCode())
|
|
|
.one();
|
|
|
VehicleDates vehicleDates1 = BeanUtil.copyProperties(diagnosisVersionInfo, VehicleDates.class);
|
|
|
|
|
@@ -450,7 +459,7 @@ public class DiagnosisVersionInfoServiceImpl extends ServiceImpl<DiagnosisVersio
|
|
|
.one();
|
|
|
if (!BeanUtil.isEmpty(diagnosisVersionDescribe)) {
|
|
|
vehicleDates1.setDescription(diagnosisVersionDescribe.getDescription());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
vehicleDates1.setDescription("");
|
|
|
}
|
|
|
//获取下载链接
|
|
@@ -484,17 +493,17 @@ public class DiagnosisVersionInfoServiceImpl extends ServiceImpl<DiagnosisVersio
|
|
|
pushInfo.setPushInfoType(2);
|
|
|
VehicleInfo vehicleInfo = new VehicleInfo();
|
|
|
|
|
|
- BeanUtil.copyProperties(diagnosisVersionInfo, vehicleInfo);
|
|
|
+ BeanUtil.copyProperties(diagnosisVersionInfo, vehicleInfo);
|
|
|
Brand brand = brandService.lambdaQuery()
|
|
|
- .eq(Brand::getBrandCode,diagnosisVersionInfo.getBrandCode())
|
|
|
+ .eq(Brand::getBrandCode, diagnosisVersionInfo.getBrandCode())
|
|
|
.one();
|
|
|
if (BeanUtil.isEmpty(brand)) {
|
|
|
- throw new BadReqException("该品牌"+diagnosisVersionInfo.getBrandCode()+"不存在");
|
|
|
+ throw new BadReqException("该品牌" + diagnosisVersionInfo.getBrandCode() + "不存在");
|
|
|
}
|
|
|
vehicleInfo.setBrandName(brand.getBrandCn());
|
|
|
vehicleInfo.setBrandNameEn(brand.getBrandEn());
|
|
|
- if (diagnosisVersionInfo.getDiagnosisName()!=null){
|
|
|
- vehicleInfo.setSortLetter(diagnosisVersionInfo.getDiagnosisName().substring(0,1));
|
|
|
+ if (diagnosisVersionInfo.getDiagnosisName() != null) {
|
|
|
+ vehicleInfo.setSortLetter(diagnosisVersionInfo.getDiagnosisName().substring(0, 1));
|
|
|
}
|
|
|
vehicleInfo.setUrl(diagnosisVersionInfo.getSavePath());
|
|
|
List<Describe> describeList = new ArrayList<>();
|
|
@@ -515,7 +524,7 @@ public class DiagnosisVersionInfoServiceImpl extends ServiceImpl<DiagnosisVersio
|
|
|
List<DiagClients> diagClients = diagClientsService.lambdaQuery()
|
|
|
.eq(DiagClients::getDiagId, diagnosisVersionInfo.getId())
|
|
|
.list();
|
|
|
- String[] tokens = null;
|
|
|
+ String[] tokens = null;
|
|
|
if (!diagClients.isEmpty()) {
|
|
|
List<String> clientNums = diagClients.stream().map(c -> c.getClientNum()).collect(Collectors.toList());
|
|
|
List<String> tokenList = new ArrayList<>();
|
|
@@ -526,7 +535,7 @@ public class DiagnosisVersionInfoServiceImpl extends ServiceImpl<DiagnosisVersio
|
|
|
//调用工具类
|
|
|
pushInfo.setJson(GsonUtils.toJsonString(vehicleInfo));
|
|
|
try {
|
|
|
- pushUtil.sendAndroidListcastJSON(tokens,pushInfo);
|
|
|
+ pushUtil.sendAndroidListcastJSON(tokens, pushInfo);
|
|
|
} catch (Exception e) {
|
|
|
throw new BizException("推送失败!!!");
|
|
|
}
|
|
@@ -551,6 +560,6 @@ public class DiagnosisVersionInfoServiceImpl extends ServiceImpl<DiagnosisVersio
|
|
|
|
|
|
return list.stream().map(c -> c.getDeviceToken()).collect(Collectors.toList());
|
|
|
}
|
|
|
- return null;
|
|
|
+ return null;
|
|
|
}
|
|
|
}
|