OTA-软件发布时间
This commit is contained in:
+35
-15
@@ -1,25 +1,34 @@
|
||||
package com.jero.modules.ota.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.ota.entity.OtaManageReceiveNsdp;
|
||||
import com.jero.modules.ota.service.IOtaManageReceiveNsdpService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.ota.entity.OtaManageReceiveNsdp;
|
||||
import com.jero.modules.ota.service.IOtaManageReceiveNsdpService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@@ -35,7 +44,7 @@ import com.jero.common.aspect.annotation.AutoLog;
|
||||
public class OtaManageReceiveNsdpController extends JeroController<OtaManageReceiveNsdp, IOtaManageReceiveNsdpService> {
|
||||
@Autowired
|
||||
private IOtaManageReceiveNsdpService otaManageReceiveNsdpService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@@ -167,4 +176,15 @@ public class OtaManageReceiveNsdpController extends JeroController<OtaManageRece
|
||||
return super.importExcel(request, response, OtaManageReceiveNsdp.class);
|
||||
}
|
||||
|
||||
|
||||
@AutoLog(value = "软件发布时间")
|
||||
@ApiOperation(value="软件发布时间", notes="软件发布时间")
|
||||
@GetMapping(value = "/getReleaseDate")
|
||||
public Result<String> getReleaseDate(String releaseName,String vehicle) {
|
||||
String time = otaManageReceiveNsdpService.getReleaseDate(releaseName,vehicle);
|
||||
return Result.OK(time);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+2
@@ -63,4 +63,6 @@ public interface IOtaManageReceiveNsdpService extends IService<OtaManageReceiveN
|
||||
List<OtaManageReceiveNsdp> getOtaManageReceiveNsdpSync();
|
||||
|
||||
List<OtaManageReceiveNsdp> getListByReleaseName(String releaseName);
|
||||
|
||||
String getReleaseDate(String releaseName,String vehicle);
|
||||
}
|
||||
|
||||
+55
-2
@@ -1,13 +1,21 @@
|
||||
package com.jero.modules.ota.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.modules.ota.entity.OtaManageReceiveNsdp;
|
||||
import com.jero.modules.ota.mapper.OtaManageReceiveNsdpMapper;
|
||||
import com.jero.modules.ota.service.IOtaManageReceiveNsdpService;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: OTA管理NSDP同步表
|
||||
@@ -100,4 +108,49 @@ public class OtaManageReceiveNsdpServiceImpl extends ServiceImpl<OtaManageReceiv
|
||||
queryWrapper.eq(OtaManageReceiveNsdp::getReleaseName, releaseName);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 软件发布时间
|
||||
* @param releaseName
|
||||
* @param vehicle
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getReleaseDate(String releaseName, String vehicle) {
|
||||
String releaseDate = "";
|
||||
if(!"全部".equals(vehicle)){
|
||||
//UAT清单修改为选择车型后,查新车型的PLM时间
|
||||
Collator comparator = Collator.getInstance(Locale.CHINESE);
|
||||
LambdaQueryWrapper<OtaManageReceiveNsdp> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OtaManageReceiveNsdp::getReleaseName, releaseName);
|
||||
List<OtaManageReceiveNsdp> list = this.list(queryWrapper);
|
||||
if(ObjectUtils.isEmpty(list)){
|
||||
return releaseDate;
|
||||
}
|
||||
List<OtaManageReceiveNsdp> otaManageReceiveNsdpList = list.stream().filter(e -> "PLM".equals(e.getDateName())).collect(Collectors.toList());
|
||||
if(ObjectUtils.isNotEmpty(otaManageReceiveNsdpList)){
|
||||
//根据适用车型过滤数据
|
||||
List<OtaManageReceiveNsdp> otaManageReceiveNsdpListTemp = new ArrayList<>();
|
||||
for (OtaManageReceiveNsdp otaManageReceiveNsdp : otaManageReceiveNsdpList) {
|
||||
String vehicleTemp = otaManageReceiveNsdp.getVehicle();
|
||||
if(StringUtils.isNotBlank(vehicleTemp)){
|
||||
//Aries G1.1 CN适用车型按此类格式进行拆分
|
||||
String[] splitArr = vehicleTemp.split(" ");
|
||||
if(splitArr.length == 3 && vehicle.equals(splitArr[0]+" "+splitArr[2])){
|
||||
otaManageReceiveNsdpListTemp.add(otaManageReceiveNsdp);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(otaManageReceiveNsdpListTemp)){
|
||||
Collections.sort(otaManageReceiveNsdpListTemp, (e1, e2) -> {
|
||||
String e1ReleaseDate = StringUtils.isNotBlank(e1.getReleaseDate()) ? e1.getReleaseDate() : "";
|
||||
String e2ReleaseDate = StringUtils.isNotBlank(e2.getReleaseDate()) ? e2.getReleaseDate() : "";
|
||||
return comparator.compare(e1ReleaseDate, e2ReleaseDate);
|
||||
});
|
||||
releaseDate = otaManageReceiveNsdpListTemp.get(0).getReleaseDate();
|
||||
}
|
||||
}
|
||||
}
|
||||
return releaseDate;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user