diff --git a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/PageUtil.java b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/PageUtil.java new file mode 100644 index 000000000..fe62ec525 --- /dev/null +++ b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/PageUtil.java @@ -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; + } +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageApplyEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageApplyEO.java index 66d5adaf1..0ec1e59e4 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageApplyEO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageApplyEO.java @@ -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 = "软件发布时间-开始") diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageReceiveNsdpEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageReceiveNsdpEO.java new file mode 100644 index 000000000..264cd6d96 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageReceiveNsdpEO.java @@ -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; +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/OtaManageApplyEOMapper.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/OtaManageApplyEOMapper.java index 659fde5fc..8ba7fdf94 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/OtaManageApplyEOMapper.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/OtaManageApplyEOMapper.java @@ -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 { - Page getOtaPage(Page page, @Param("otaManageApplyEO") OtaManageApplyEO otaManageApplyEO); +// Page getOtaPage(Page page, @Param("otaManageApplyEO") OtaManageApplyEO otaManageApplyEO); + List getOtaList(@Param("otaManageApplyEO") OtaManageApplyEO otaManageApplyEO); /** * 分车型列表-分页列表查询 @@ -31,4 +34,6 @@ public interface OtaManageApplyEOMapper extends BaseMapper { List getOtaCarList(); + List getReleaseDate(@Param("plannedBpLaunchBatchList") List plannedBpLaunchBatchList); + } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/xml/OtaManageApplyEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/xml/OtaManageApplyEOMapper.xml index 9cf91e2be..91ee53ee9 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/xml/OtaManageApplyEOMapper.xml +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/xml/OtaManageApplyEOMapper.xml @@ -15,44 +15,62 @@ - select * from ota_manage_receive - 1=1 - - and trim( REPLACE ( software_version, ' ', '' ) ) LIKE trim( - REPLACE ( CONCAT( '%', #{otaManageApplyEO.softwareVersion}, '%' ), ' ', '' )) - - - and ts.platform LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.platform}),'%') - - - and ts.applied_vehicle_project LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.appliedVehicleProject}),'%') - - - and ts.market LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.market}),'%') - - - and ts.software_issue_time >=#{otaManageApplyEO.softwareIssueTimeStart} - - - and ts.software_issue_time <=#{otaManageApplyEO.softwareIssueTimeEnd} + + planned_bp_launch_batch_ =#{otaManageApplyEO.plannedBpLaunchBatch} + + and applied_vehicle_project LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.appliedVehicleProject}),'%') + + + + and applied_vehicle_project LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.market}),'%') + - and ts.issue_key LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.issueKey}),'%') + and id LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.issueKey}),'%') - and ts.summary LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.summary}),'%') + and summary LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.summary}),'%') - 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}),'%')) order by create_time desc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java index a44873f62..a38ec4f87 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java @@ -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 getOtaPage(OtaManageApplyEO otaManageApplyEO, Integer pageNo, Integer pageSize) { - Page page = new Page(pageNo, pageSize); - return otaManageApplyEOMapper.getOtaPage(page, otaManageApplyEO); + List otaManageApplyEOList = otaManageApplyEOMapper.getOtaList(otaManageApplyEO); + if(!otaManageApplyEOList.isEmpty()){ + List otaNameList = OtaCarEnum.getOtaNameList(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); + List plannedBpLaunchBatchList = otaManageApplyEOList.stream() + .filter(e -> StringUtils.isNotBlank(e.getPlannedBpLaunchBatch())) + .map(OtaManageApplyEO::getPlannedBpLaunchBatch).distinct().collect(Collectors.toList()); + if(!plannedBpLaunchBatchList.isEmpty()){ + List manageReceiveNsdpEOList = otaManageApplyEOMapper.getReleaseDate(plannedBpLaunchBatchList); + for (OtaManageApplyEO manageApplyEO : otaManageApplyEOList) { + List collect = manageReceiveNsdpEOList.stream() + .filter(e -> StringUtils.isNotBlank(e.getReleaseName()) + && e.getReleaseName().equals(manageApplyEO.getPlannedBpLaunchBatch())).collect(Collectors.toList()); + if(!collect.isEmpty()){ + List releaseDateList = collect.stream().map(OtaManageReceiveNsdpEO::getReleaseDate).distinct().collect(Collectors.toList()); + List 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 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; } /**