ota-软件版本,适用车型,市场下拉框数据

This commit is contained in:
zhn
2023-08-17 17:48:22 +08:00
parent b9bfb89658
commit 2a65a5e035
6 changed files with 60 additions and 40 deletions
@@ -21,9 +21,10 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
/**
* @Description: 数据对接表
* @Author: jero-boot
* @Date: 2023-08-09
@@ -74,18 +75,16 @@ public class OtaManageApplyEOController extends JeroController<OtaManageApplyEO,
return Result.OK(pageList);
}
/**
* OTA下拉数据
* 下拉数据-软件版本,适用车型,市场
*
* @param otaManageApplyEO
* @return
*/
@AutoLog(value = "OTA下拉数据")
@ApiOperation(value="OTA下拉数据", notes="OTA下拉数据")
@AutoLog(value = "下拉数据-软件版本,适用车型,市场")
@ApiOperation(value="下拉数据-软件版本,适用车型,市场", notes="下拉数据-软件版本,适用车型,市场")
@GetMapping(value = "/getOtaCarList")
public Result<?> getOtaCarList(OtaManageApplyEO otaManageApplyEO) {
List<String> otaCarList = otaManageApplyEOService.getOtaCarList(otaManageApplyEO);
return Result.OK(otaCarList);
public Result<?> getOtaCarList() {
Map<String, Object> result = otaManageApplyEOService.getOtaCarList();
return Result.OK(result);
}
@@ -1,5 +1,8 @@
package com.jero.modules.ota.enums;
import java.util.ArrayList;
import java.util.List;
public enum OtaCarEnum {
@@ -34,12 +37,11 @@ public enum OtaCarEnum {
public static OtaCarEnum getOtaTitleEnum(String name) {
public static List<String> getOtaNameList() {
List<String> nameList = new ArrayList<>();
for (OtaCarEnum e : values()) {
if (e.getName().equals(name)) {
return e;
}
nameList.add(e.getName());
}
return null;
return nameList;
}
}
@@ -29,6 +29,6 @@ public interface OtaManageApplyEOMapper extends BaseMapper<OtaManageApplyEO> {
List<VersionVO> getByAppliedVehicleProject(@Param("appliedVehicleProject") String appliedVehicleProject);
List<OtaManageApplyEO> getOtaCarList(@Param("otaManageApplyEO") OtaManageApplyEO otaManageApplyEO);
List<OtaManageApplyEO> getOtaCarList();
}
@@ -81,23 +81,6 @@
<select id="getOtaCarList" resultType="com.jero.modules.ota.entity.OtaManageApplyEO">
select * from ota_manage_receive
<where>
1=1
<if test="otaManageApplyEO.appliedVehicleProject != null and otaManageApplyEO.appliedVehicleProject != ''">
and ts.applied_vehicle_project LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.appliedVehicleProject}),'%')
</if>
<if test="otaManageApplyEO.issueKey != null and otaManageApplyEO.issueKey != ''">
and ts.issue_key LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.issueKey}),'%')
</if>
<if test="otaManageApplyEO.summary != null and otaManageApplyEO.summary != ''">
and ts.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}),'%'))
</if>
</where>
order by create_time desc
</select>
</mapper>
@@ -6,6 +6,7 @@ import com.jero.modules.ota.entity.OtaManageApplyEO;
import com.jero.modules.ota.vo.VersionVO;
import java.util.List;
import java.util.Map;
/**
* @Description: 数据对接表
@@ -80,9 +81,8 @@ public interface IOtaManageApplyEOService extends IService<OtaManageApplyEO> {
*/
IPage<OtaManageApplyEO> getOtaCarPage(OtaManageApplyEO otaManageApplyEO,Integer pageNo,Integer pageSize);
/**
* OTA下拉数据
* @param otaManageApplyEO
* 下拉数据-软件版本,适用车型,市场
* @return
*/
List<String> getOtaCarList(OtaManageApplyEO otaManageApplyEO);
Map<String,Object> getOtaCarList();
}
@@ -4,6 +4,7 @@ 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.jero.modules.ota.entity.OtaManageApplyEO;
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;
@@ -14,7 +15,11 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
@@ -142,18 +147,49 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
return null;
}
/**
* 下拉数据-软件版本,适用车型,市场
* @return
*/
@Override
public List<String> getOtaCarList(OtaManageApplyEO otaManageApplyEO) {
List<OtaManageApplyEO> otaManageApplyEOS = otaManageApplyEOMapper.getOtaCarList(otaManageApplyEO);
public Map<String,Object> getOtaCarList() {
List<OtaManageApplyEO> otaManageApplyEOS = otaManageApplyEOMapper.getOtaCarList();
Map<String,Object> result = new HashMap<>();
if(!otaManageApplyEOS.isEmpty()){
//软件版本 planned_bp_launch_batch_
List<String> plannedBpLaunchBatchList = otaManageApplyEOS.stream()
.filter(e -> StringUtils.isNotBlank(e.getPlannedBpLaunchBatch()))
.map(OtaManageApplyEO::getPlannedBpLaunchBatch).distinct().collect(Collectors.toList());
//适用车型 appliedVehicleProject
List<String> appliedVehicleProjectList = otaManageApplyEOS.stream()
.filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject()))
.map(OtaManageApplyEO::getAppliedVehicleProject).distinct().collect(Collectors.toList());
List<String> list = new ArrayList<>();
//过滤掉特殊的适用车型
List<String> otaNameList = OtaCarEnum.getOtaNameList();
Set<String> carSet = new HashSet<>();//适用车型
Set<String> marketSet = new HashSet<>();//市场
for (String appliedVehicleProject : appliedVehicleProjectList) {
list.addAll(Arrays.asList(appliedVehicleProject.split(",")));
for (String s : appliedVehicleProject.split(",")) {
String[] split = s.split(" ");
if(split.length == 2){
if (!otaNameList.contains(s)) {
carSet.add(split[0]);
marketSet.add(split[1]);
}
}else if(split.length == 3){
if (!otaNameList.contains(s)) {
carSet.add(split[0]);
marketSet.add(split[2]);
}
}
}
}
result.put("plannedBpLaunchBatchList",plannedBpLaunchBatchList);
result.put("carSet",carSet);
result.put("marketSet",marketSet);
}
return null;
return result;
}
}