|
|
@ -28,8 +28,7 @@ package com.yxt.anrui.base.biz.basevehmodelconfig; |
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.anrui.base.api.basemodelconfig.AppCarConfigSummaryVo; |
|
|
|
import com.yxt.anrui.base.api.basemodelconfig.AppModelConfigListVo; |
|
|
|
import com.yxt.anrui.base.api.basemodelconfig.*; |
|
|
|
import com.yxt.anrui.base.api.basevehicle.ConfigInfo; |
|
|
|
import com.yxt.anrui.base.api.basevehmodelconfig.*; |
|
|
|
import com.yxt.anrui.base.biz.basemodelconfig.BaseModelConfigService; |
|
|
@ -785,4 +784,137 @@ public class BaseVehmodelConfigService extends MybatisBaseService<BaseVehmodelCo |
|
|
|
PagerVo<BaseVehmodelConfigVos> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean saveAndRelationConfig(BaseModelConfigDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String userSid = dto.getUserSid(); |
|
|
|
String useOrgSid = sysOrganizationFeign.getUseOrgByUserSid(userSid).getData().getSid(); |
|
|
|
BaseModelConfig entity = new BaseModelConfig(); |
|
|
|
dto.fillEntity(entity); |
|
|
|
String configName = ""; |
|
|
|
//颜色
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getCarColor())) { |
|
|
|
configName += dto.getCarColor() + "/"; |
|
|
|
} |
|
|
|
//缓速器
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getSlowMachine())) { |
|
|
|
configName += dto.getSlowMachine() + "/"; |
|
|
|
} |
|
|
|
//后视镜
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getRearViewMirror())) { |
|
|
|
configName += dto.getRearViewMirror() + "/"; |
|
|
|
} |
|
|
|
//轮胎
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getTireSize())) { |
|
|
|
configName += dto.getTireSize() + "/"; |
|
|
|
} |
|
|
|
//驾驶室规格
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getSpecification())) { |
|
|
|
configName += dto.getSpecification() + "/"; |
|
|
|
} |
|
|
|
//后桥
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getRearAxleValue())) { |
|
|
|
configName += dto.getRearAxleValue() + "/"; |
|
|
|
} |
|
|
|
//后桥速比
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getRearAxleRatio())) { |
|
|
|
configName += dto.getRearAxleRatio() + "/"; |
|
|
|
} |
|
|
|
//空调
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getAirConditioner())) { |
|
|
|
configName += dto.getAirConditioner() + "/"; |
|
|
|
} |
|
|
|
//轮毂材质
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getHubMaterial())) { |
|
|
|
configName += dto.getHubMaterial() + "/"; |
|
|
|
} |
|
|
|
//导流罩
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getBaffleModel())) { |
|
|
|
configName += dto.getBaffleModel() + "/"; |
|
|
|
} |
|
|
|
//悬架
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getSuspension())) { |
|
|
|
configName += dto.getSuspension() + "/"; |
|
|
|
} |
|
|
|
//座椅
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getSeat())) { |
|
|
|
configName += dto.getSeat() + "/"; |
|
|
|
} |
|
|
|
//护轮罩
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getTireCover())) { |
|
|
|
configName += dto.getTireCover() + "/"; |
|
|
|
} |
|
|
|
//鞍座
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getSaddle())) { |
|
|
|
configName += dto.getSaddle() + "/"; |
|
|
|
} |
|
|
|
//轴距
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getWheelbase())) { |
|
|
|
configName += dto.getWheelbase() + "/"; |
|
|
|
} |
|
|
|
//保险杠
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getBumper())) { |
|
|
|
configName += dto.getBumper() + "/"; |
|
|
|
} |
|
|
|
//配置包
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getConfiguringBao())) { |
|
|
|
configName += dto.getConfiguringBao() + "/"; |
|
|
|
} |
|
|
|
//独立热源
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getIndependentSources())) { |
|
|
|
configName += dto.getIndependentSources() + "/"; |
|
|
|
} |
|
|
|
//燃料箱
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getFuelTank())) { |
|
|
|
configName += dto.getFuelTank() + "/"; |
|
|
|
} |
|
|
|
//多媒体
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getMultimedia())) { |
|
|
|
configName += dto.getMultimedia() + "/"; |
|
|
|
} |
|
|
|
//货箱
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(dto.getPackingCase())) { |
|
|
|
configName += dto.getPackingCase() + "/"; |
|
|
|
} |
|
|
|
entity.setConfigName(configName); |
|
|
|
configName += dto.getOtherConfig(); |
|
|
|
BaseModelConfigVo baseModelConfigVo = baseModelConfigService.selectByConfigName(useOrgSid, configName); |
|
|
|
if (baseModelConfigVo != null){ |
|
|
|
String modelSid = dto.getVehicleSid(); |
|
|
|
String configurationItemsSid = baseModelConfigVo.getSid(); |
|
|
|
BaseVehmodelConfigVo vo = baseMapper.checkSave(modelSid, configurationItemsSid, useOrgSid); |
|
|
|
if (vo != null) { |
|
|
|
return rb.setMsg("当前常用配置信息已关联当前车型,请重新选择"); |
|
|
|
} |
|
|
|
BaseVehmodelConfig baseVehmodelConfig = new BaseVehmodelConfig(); |
|
|
|
String sid = baseVehmodelConfig.getSid(); |
|
|
|
BeanUtil.copyProperties(dto, baseVehmodelConfig); |
|
|
|
baseVehmodelConfig.setSid(sid); |
|
|
|
baseVehmodelConfig.setUseOrgSid(useOrgSid); |
|
|
|
baseVehmodelConfig.setModelSid(modelSid); |
|
|
|
baseVehmodelConfig.setConfigurationItemsSid(configurationItemsSid); |
|
|
|
save(baseVehmodelConfig); |
|
|
|
}else { |
|
|
|
entity.setCreateOrgSId(useOrgSid); |
|
|
|
// 配置编码
|
|
|
|
int i1 = baseModelConfigService.selectCount(); |
|
|
|
String num = String.format("%04d", i1 + 1); // 不足4位补0
|
|
|
|
entity.setConfigCode(num); |
|
|
|
boolean isSave = baseModelConfigService.save(entity); |
|
|
|
if (!isSave) { |
|
|
|
return rb.setMsg("保存失败"); |
|
|
|
} |
|
|
|
String modelSid = dto.getVehicleSid(); |
|
|
|
String configurationItemsSid = entity.getSid(); |
|
|
|
BaseVehmodelConfig baseVehmodelConfig = new BaseVehmodelConfig(); |
|
|
|
String sid = baseVehmodelConfig.getSid(); |
|
|
|
BeanUtil.copyProperties(dto, baseVehmodelConfig); |
|
|
|
baseVehmodelConfig.setSid(sid); |
|
|
|
baseVehmodelConfig.setUseOrgSid(useOrgSid); |
|
|
|
baseVehmodelConfig.setModelSid(modelSid); |
|
|
|
baseVehmodelConfig.setConfigurationItemsSid(configurationItemsSid); |
|
|
|
save(baseVehmodelConfig); |
|
|
|
} |
|
|
|
return rb.success().setMsg("关联成功"); |
|
|
|
} |
|
|
|
} |