feat(repository): 更新报价模型配置服务接口和实现
- 在 IQuotationModelConfigService 接口中为 getEffectives 方法添加 configId 参数 - 在 QuotationModelConfigMapper 中同步更新 getEffectives 方法签名 - 重构 QuotationModelConfigMapper.xml 中的 SQL 查询逻辑,使用 LEFT JOIN 替代 INNER JOIN - 在 QuotationModelConfigServiceImpl 中更新方法实现以匹配新的参数列表 - 在 ShoppingController 中调用时传递新增的 configId 参数 - 在 RatioConfigController 中添加空集合检查以避免 NPE 异常
This commit is contained in:
parent
b44d6b6d94
commit
4c42afc6b9
|
|
@ -71,6 +71,7 @@ public class RatioConfigController extends ControllerBase {
|
|||
TargetUserVO vo = new TargetUserVO();
|
||||
if (isMarketingDirector) {
|
||||
List<QuotationModelRatioAgentItemDTO> agentItems = ratioAgentItemService.getEffectives();
|
||||
if (CollectionUtil.isNotEmpty(agentItems)) {
|
||||
vo.setAppUsers(
|
||||
appUserService.lambdaQuery()
|
||||
.in(AppUser::getId, agentItems.stream().map(QuotationModelRatioAgentItemDTO::getUserId).collect(Collectors.toList()))
|
||||
|
|
@ -83,7 +84,9 @@ public class RatioConfigController extends ControllerBase {
|
|||
)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
List<QuotationModelRatioDirectItemDTO> directItems = ratioDirectItemService.getEffectives();
|
||||
if (CollectionUtil.isNotEmpty(directItems)) {
|
||||
vo.setAdminUsers(
|
||||
adminUserService.lambdaQuery()
|
||||
.in(AdminUser::getId, directItems.stream().map(QuotationModelRatioDirectItemDTO::getUserId).collect(Collectors.toList()))
|
||||
|
|
@ -97,6 +100,7 @@ public class RatioConfigController extends ControllerBase {
|
|||
.collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
}
|
||||
return ApiResult.success(vo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ public class ShoppingController extends ControllerBase {
|
|||
vo.setDiscount(vo.getTotalFee().subtract(vo.getActualFee()));
|
||||
log.debug("机型【{}】价格为{},优惠{}", request.getModelNo(), vo.getActualFee(), vo.getDiscount());
|
||||
//获取部件配置
|
||||
List<ModelConfigEffectiveDTO> parts = modelConfigService.getEffectives(modelPrice.getPriceId(), categoryId, MultilingualUtil.getLanguage());
|
||||
List<ModelConfigEffectiveDTO> parts = modelConfigService.getEffectives(modelPrice.getConfigId(),modelPrice.getPriceId(), categoryId, MultilingualUtil.getLanguage());
|
||||
VUtils.trueThrowBusinessError(CollectionUtil.isEmpty(parts)).throwMessage("未获取到部件信息");
|
||||
vo.setStandardParts(parts.stream()
|
||||
.filter(part -> part.getParentId() == 0L && part.getType() == 1)
|
||||
|
|
|
|||
|
|
@ -23,5 +23,5 @@ public interface QuotationModelConfigMapper extends BaseMapper<QuotationModelCon
|
|||
|
||||
IPage<ModelConfigVO> search(ModelConfigSearchRequest request, Page<?> objectPage);
|
||||
|
||||
List<ModelConfigEffectiveDTO> getEffectives(Long priceId, Long categoryId, String language);
|
||||
List<ModelConfigEffectiveDTO> getEffectives(Long configId,Long priceId, Long categoryId, String language);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,5 +22,5 @@ public interface IQuotationModelConfigService extends IService<QuotationModelCon
|
|||
|
||||
IPage<ModelConfigVO> search(ModelConfigSearchRequest request);
|
||||
|
||||
List<ModelConfigEffectiveDTO> getEffectives(Long priceId, Long categoryId, String language);
|
||||
List<ModelConfigEffectiveDTO> getEffectives(Long configId,Long priceId, Long categoryId, String language);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class QuotationModelConfigServiceImpl extends ServiceImpl<QuotationModelC
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ModelConfigEffectiveDTO> getEffectives(Long priceId, Long categoryId, String language) {
|
||||
return baseMapper.getEffectives(priceId,categoryId,language);
|
||||
public List<ModelConfigEffectiveDTO> getEffectives(Long configId,Long priceId, Long categoryId, String language) {
|
||||
return baseMapper.getEffectives(configId,priceId,categoryId,language);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,13 +28,17 @@
|
|||
</select>
|
||||
|
||||
<select id="getEffectives" resultType="com.nflg.mobilebroken.common.pojo.dto.ModelConfigEffectiveDTO">
|
||||
SELECT qmci.id,qmci.parent_id,qmcil.part_name,qmcil.part_remark,qmci.image_url,qmpia.amount,qmci.type,qmci.optional_type
|
||||
FROM quotation_model_price qmp
|
||||
INNER JOIN quotation_model_price_item qmpi ON qmpi.price_id=qmp.id
|
||||
INNER JOIN quotation_model_config_item qmci ON qmci.unique_id=qmpi.config_item_unique_id
|
||||
INNER JOIN quotation_model_config_item_language qmcil ON qmcil.config_item_id=qmci.id
|
||||
INNER JOIN `language` l ON l.id=qmcil.language_id
|
||||
INNER JOIN quotation_model_price_item_area qmpia ON qmpia.price_item_id=qmpi.id
|
||||
WHERE qmp.id=#{priceId} AND l.`code`=#{language} AND qmpia.area_id=#{categoryId}
|
||||
SELECT qmci.id,qmci.parent_id,qmcil.part_name,qmcil.part_remark,qmci.image_url,pp.amount,qmci.type,qmci.optional_type
|
||||
FROM quotation_model_config_item qmci
|
||||
LEFT JOIN quotation_model_config_item_language qmcil ON qmcil.config_item_id=qmci.id
|
||||
LEFT JOIN `language` l ON l.id=qmcil.language_id
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT qmpi.config_item_unique_id,qmpia.amount
|
||||
FROM quotation_model_price_item qmpi
|
||||
LEFT JOIN quotation_model_price_item_area qmpia ON qmpia.price_item_id=qmpi.id
|
||||
WHERE qmpia.price_id=#{priceId} AND qmpia.area_id=#{categoryId}
|
||||
) pp ON qmci.unique_id=pp.config_item_unique_id
|
||||
WHERE qmci.`enable` AND qmci.config_id=#{configId} AND l.`code`=#{language}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue