OTA列表和全车型列表

This commit is contained in:
zhn
2023-08-17 20:07:54 +08:00
parent 2a65a5e035
commit 3c1d347e74
6 changed files with 190 additions and 28 deletions
@@ -0,0 +1,40 @@
package com.jero.common.util;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.List;
/**
* @description
* @date 2022/12/7 14:02
* @auth zhn
*/
public class PageUtil {
public static Page getPages(Integer currentPage, Integer pageSize, List<?> entityList){
Page page =new Page();
if(entityList==null){
return null;
}
int size = entityList.size();
if(pageSize > size){
pageSize = size;
}
if(pageSize!=0){
//求出最⼤页数,防⽌currentPage越界
int maxPage = size % pageSize ==0? size / pageSize : size / pageSize +1;
if(currentPage > maxPage){
currentPage = maxPage;
}
}
//当前页第⼀条数据的下标
int curIdx = currentPage >1?(currentPage -1)* pageSize :0;
List pageList =new ArrayList();
//将当前页的数据放进pageList
for(int i =0; i < pageSize && curIdx + i < size; i++){
pageList.add(entityList.get(curIdx + i));
}
page.setCurrent(currentPage).setSize(pageSize).setTotal(entityList.size()).setRecords(pageList);
return page;
}
}
@@ -100,7 +100,11 @@ public class OtaManageApplyEO implements Serializable {
@TableField(exist = false)
@ApiModelProperty(value = "软件发布时间")
private java.util.Date softwareIssueTime;
private String releaseName;
@TableField(exist = false)
@ApiModelProperty(value = "软件发布时间")
private java.util.Date releaseNameDate;
@TableField(exist = false)
@ApiModelProperty(value = "软件发布时间-开始")
@@ -0,0 +1,17 @@
package com.jero.modules.ota.entity;
import lombok.Data;
/**
* @description
* @date 2023/8/17 18:38
* @auth zhn
*/
@Data
public class OtaManageReceiveNsdpEO {
//软件版本
private String releaseName;
//发布时间
private String releaseDate;
}
@@ -2,10 +2,12 @@ package com.jero.modules.ota.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.modules.ota.entity.OtaManageReceiveNsdpEO;
import com.jero.modules.ota.vo.VersionVO;
import org.apache.ibatis.annotations.Param;
import com.jero.modules.ota.entity.OtaManageApplyEO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.pptx4j.pml.STTLTriggerRuntimeNode;
import java.util.List;
@@ -17,7 +19,8 @@ import java.util.List;
*/
public interface OtaManageApplyEOMapper extends BaseMapper<OtaManageApplyEO> {
Page<OtaManageApplyEO> getOtaPage(Page<OtaManageApplyEO> page, @Param("otaManageApplyEO") OtaManageApplyEO otaManageApplyEO);
// Page<OtaManageApplyEO> getOtaPage(Page<OtaManageApplyEO> page, @Param("otaManageApplyEO") OtaManageApplyEO otaManageApplyEO);
List<OtaManageApplyEO> getOtaList(@Param("otaManageApplyEO") OtaManageApplyEO otaManageApplyEO);
/**
* 分车型列表-分页列表查询
@@ -31,4 +34,6 @@ public interface OtaManageApplyEOMapper extends BaseMapper<OtaManageApplyEO> {
List<OtaManageApplyEO> getOtaCarList();
List<OtaManageReceiveNsdpEO> getReleaseDate(@Param("plannedBpLaunchBatchList") List<String> plannedBpLaunchBatchList);
}
@@ -15,44 +15,62 @@
<result column="remark" property="remark" />
</resultMap>
<select id="getOtaPage" resultType="com.jero.modules.ota.entity.OtaManageApplyEO">
<select id="getOtaList" resultType="com.jero.modules.ota.entity.OtaManageApplyEO">
select * from ota_manage_receive
<where>
1=1
<if test="otaManageApplyEO.softwareVersion != null and otaManageApplyEO.softwareVersion != ''">
and trim( REPLACE ( software_version, ' ', '' ) ) LIKE trim(
REPLACE ( CONCAT( '%', #{otaManageApplyEO.softwareVersion}, '%' ), ' ', '' ))
</if>
<if test="otaManageApplyEO.platform != null and otaManageApplyEO.platform != ''">
and ts.platform LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.platform}),'%')
</if>
<if test="otaManageApplyEO.appliedVehicleProject != null and otaManageApplyEO.appliedVehicleProject != ''">
and ts.applied_vehicle_project LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.appliedVehicleProject}),'%')
</if>
<if test="otaManageApplyEO.market != null and otaManageApplyEO.market != ''">
and ts.market LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.market}),'%')
</if>
<if test="otaManageApplyEO.softwareIssueTimeStart != null">
and ts.software_issue_time &gt;=#{otaManageApplyEO.softwareIssueTimeStart}
</if>
<if test="otaManageApplyEO.softwareIssueTimeEnd != null">
and ts.software_issue_time &lt;=#{otaManageApplyEO.softwareIssueTimeEnd}
<if test="otaManageApplyEO.plannedBpLaunchBatch != null and otaManageApplyEO.plannedBpLaunchBatch != ''">
planned_bp_launch_batch_ =#{otaManageApplyEO.plannedBpLaunchBatch}
</if>
<if test="otaManageApplyEO.appliedVehicleProject != null and otaManageApplyEO.appliedVehicleProject != ''">
and applied_vehicle_project LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.appliedVehicleProject}),'%')
</if>
<if test="otaManageApplyEO.market != null and otaManageApplyEO.market != ''">
and applied_vehicle_project LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.market}),'%')
</if>
<if test="otaManageApplyEO.issueKey != null and otaManageApplyEO.issueKey != ''">
and ts.issue_key LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.issueKey}),'%')
and id LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.issueKey}),'%')
</if>
<if test="otaManageApplyEO.summary != null and otaManageApplyEO.summary != ''">
and ts.summary LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.summary}),'%')
and summary LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.summary}),'%')
</if>
<if test="otaManageApplyEO.impactHomo != null and otaManageApplyEO.impactHomo != ''">
and (ts.impact_cn_homo LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.impactHomo}),'%')
or impact_eu_homo ts.impact_cn_homo LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.impactHomo}),'%'))
and (impact_cn_homo LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.impactHomo}),'%')
or impact_eu_homo impact_cn_homo LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.impactHomo}),'%'))
</if>
</where>
order by create_time desc
</select>
<!-- <select id="getOtaPage" resultType="com.jero.modules.ota.entity.OtaManageApplyEO">-->
<!-- select * from ota_manage_receive-->
<!-- <where>-->
<!-- <if test="otaManageApplyEO.plannedBpLaunchBatch != null and otaManageApplyEO.plannedBpLaunchBatch != ''">-->
<!-- planned_bp_launch_batch_ =#{otaManageApplyEO.plannedBpLaunchBatch}-->
<!-- </if>-->
<!-- <if test="otaManageApplyEO.appliedVehicleProject != null and otaManageApplyEO.appliedVehicleProject != ''">-->
<!-- and applied_vehicle_project LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.appliedVehicleProject}),'%')-->
<!-- </if>-->
<!-- <if test="otaManageApplyEO.market != null and otaManageApplyEO.market != ''">-->
<!-- and applied_vehicle_project LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.market}),'%')-->
<!-- </if>-->
<!-- <if test="otaManageApplyEO.issueKey != null and otaManageApplyEO.issueKey != ''">-->
<!-- and id LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.issueKey}),'%')-->
<!-- </if>-->
<!-- <if test="otaManageApplyEO.summary != null and otaManageApplyEO.summary != ''">-->
<!-- and summary LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.summary}),'%')-->
<!-- </if>-->
<!-- <if test="otaManageApplyEO.impactHomo != null and otaManageApplyEO.impactHomo != ''">-->
<!-- and (impact_cn_homo LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.impactHomo}),'%')-->
<!-- or impact_eu_homo impact_cn_homo LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.impactHomo}),'%'))-->
<!-- </if>-->
<!-- </where>-->
<!-- order by create_time desc-->
<!-- </select>-->
<select id="getOtaCarPage" resultType="com.jero.modules.ota.entity.OtaManageApplyEO">
select omr.*,
oma.project_version,oma.attestation_schedule.oma.match_status,oma.remark,
@@ -83,4 +101,12 @@
select * from ota_manage_receive
</select>
<select id="getReleaseDate" resultType="com.jero.modules.ota.entity.OtaManageReceiveNsdpEO">
select * from ota_manage_receive_nsdp
where release_name in
<foreach collection="plannedBpLaunchBatchList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
@@ -3,17 +3,24 @@ package com.jero.modules.ota.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hankcs.hanlp.dependency.nnparser.util.Log;
import com.jero.common.util.PageUtil;
import com.jero.modules.ota.entity.OtaManageApplyEO;
import com.jero.modules.ota.entity.OtaManageReceiveNsdpEO;
import com.jero.modules.ota.enums.OtaCarEnum;
import com.jero.modules.ota.mapper.OtaManageApplyEOMapper;
import com.jero.modules.ota.service.IOtaManageApplyEOService;
import com.jero.modules.ota.vo.VersionVO;
import com.jero.modules.system.util.StringUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -115,8 +122,71 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
*/
@Override
public IPage<OtaManageApplyEO> getOtaPage(OtaManageApplyEO otaManageApplyEO, Integer pageNo, Integer pageSize) {
Page<OtaManageApplyEO> page = new Page<OtaManageApplyEO>(pageNo, pageSize);
return otaManageApplyEOMapper.getOtaPage(page, otaManageApplyEO);
List<OtaManageApplyEO> otaManageApplyEOList = otaManageApplyEOMapper.getOtaList(otaManageApplyEO);
if(!otaManageApplyEOList.isEmpty()){
List<String> otaNameList = OtaCarEnum.getOtaNameList();
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
List<String> plannedBpLaunchBatchList = otaManageApplyEOList.stream()
.filter(e -> StringUtils.isNotBlank(e.getPlannedBpLaunchBatch()))
.map(OtaManageApplyEO::getPlannedBpLaunchBatch).distinct().collect(Collectors.toList());
if(!plannedBpLaunchBatchList.isEmpty()){
List<OtaManageReceiveNsdpEO> manageReceiveNsdpEOList = otaManageApplyEOMapper.getReleaseDate(plannedBpLaunchBatchList);
for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) {
List<OtaManageReceiveNsdpEO> collect = manageReceiveNsdpEOList.stream()
.filter(e -> StringUtils.isNotBlank(e.getReleaseName())
&& e.getReleaseName().equals(manageApplyEO.getPlannedBpLaunchBatch())).collect(Collectors.toList());
if(!collect.isEmpty()){
List<String> releaseDateList = collect.stream().map(OtaManageReceiveNsdpEO::getReleaseDate).distinct().collect(Collectors.toList());
List<Integer> list = new ArrayList<>();
for (String s : releaseDateList) {
list.add(Integer.parseInt(s.replaceAll("-","")));
}
Integer max = Collections.max(list);
try {
//发布时间
manageApplyEO.setReleaseName(sdf.format(dateFormat.parse(max.toString())));
manageApplyEO.setReleaseNameDate(dateFormat.parse(max.toString()));
} catch (ParseException e) {
log.error(e.getMessage(), e);
}
}
//市场
String appliedVehicleProject = manageApplyEO.getAppliedVehicleProject();
if(StringUtils.isNotBlank(appliedVehicleProject)){
Set<String> marketSet = new HashSet<>();
for (String s : appliedVehicleProject.split(",")) {
String[] split = s.split(" ");
if(split.length == 2){
if (!otaNameList.contains(s)) {
marketSet.add(split[1]);
}
}else if(split.length == 3){
if (!otaNameList.contains(s)) {
marketSet.add(split[2]);
}
}
}
if(!marketSet.isEmpty()){
manageApplyEO.setMarket(StringUtils.join(marketSet, ","));
}
}
}
}
}
if(ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeStart())){
otaManageApplyEOList = otaManageApplyEOList.stream()
.filter(e->StringUtils.isNotBlank(e.getReleaseName())
&& (e.getReleaseNameDate().after(otaManageApplyEO.getSoftwareIssueTimeStart())
|| e.getReleaseNameDate().equals(otaManageApplyEO.getSoftwareIssueTimeStart()))).collect(Collectors.toList());
}
if(ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeEnd())){
otaManageApplyEOList = otaManageApplyEOList.stream().filter(e-> StringUtils.isNotBlank(e.getReleaseName())
&& (e.getReleaseNameDate().before(otaManageApplyEO.getSoftwareIssueTimeEnd())
|| e.getReleaseNameDate().equals(otaManageApplyEO.getSoftwareIssueTimeEnd()))).collect(Collectors.toList());
}
Page pages = PageUtil.getPages(pageNo, pageSize, otaManageApplyEOList);
return pages;
}
/**