Compare commits

...

2 Commits

Author SHA1 Message Date
曹鹏飞 6d87095160 fix(shopping): 修复查看密码验证逻辑
- 当用户未设置查看密码时直接返回验证结果
- 避免未设置密码情况下的空指针异常
- 简化密码验证流程提高代码可读性
2026-03-26 11:13:35 +08:00
曹鹏飞 9eb62258b6 fix(shopping): 修复查看密码验证逻辑
- 当用户未设置查看密码时直接返回验证结果
- 避免未设置密码情况下的空指针异常
- 简化密码验证流程提高代码可读性
2026-03-26 10:31:10 +08:00
2 changed files with 15 additions and 3 deletions

View File

@ -340,6 +340,13 @@ public class ShoppingController extends ControllerBase {
QuotationShoppingCart cart = shoppingCartService.getById(id); QuotationShoppingCart cart = shoppingCartService.getById(id);
VUtils.trueThrowBusinessError(Objects.isNull(cart)).throwMessage("未找到购物车信息"); VUtils.trueThrowBusinessError(Objects.isNull(cart)).throwMessage("未找到购物车信息");
ShoppingCartVO vo = Convert.convert(ShoppingCartVO.class, cart); ShoppingCartVO vo = Convert.convert(ShoppingCartVO.class, cart);
ProductModel model=productModelService.lambdaQuery()
.eq(ProductModel::getState, 1)
.eq(ProductModel::getBatchNumber, cart.getModelId())
.one();
if (Objects.nonNull(model)){
vo.setModelKeyId(model.getId());
}
//获取部件配置 //获取部件配置
// Long categoryId = getCategoryId(); // Long categoryId = getCategoryId();
// List<ModelConfigEffectiveDTO> parts = modelConfigService.getEffectives(cart.getConfigId(), cart.getPriceId(), categoryId, MultilingualUtil.getLanguage()); // List<ModelConfigEffectiveDTO> parts = modelConfigService.getEffectives(cart.getConfigId(), cart.getPriceId(), categoryId, MultilingualUtil.getLanguage());
@ -429,7 +436,7 @@ public class ShoppingController extends ControllerBase {
*/ */
@Transactional @Transactional
@PostMapping("/quotation/generate") @PostMapping("/quotation/generate")
public ApiResult<Void> generateQuotation(@RequestBody @NotEmpty List<Long> cartIds) { public ApiResult<Long> generateQuotation(@RequestBody @NotEmpty List<Long> cartIds) {
List<QuotationShoppingCart> carts = shoppingCartService.lambdaQuery() List<QuotationShoppingCart> carts = shoppingCartService.lambdaQuery()
.eq(QuotationShoppingCart::getStatus, 0) .eq(QuotationShoppingCart::getStatus, 0)
.eq(QuotationShoppingCart::getCreateByType, AppUserUtil.isAgent() ? 1 : 0) .eq(QuotationShoppingCart::getCreateByType, AppUserUtil.isAgent() ? 1 : 0)
@ -484,7 +491,7 @@ public class ShoppingController extends ControllerBase {
.eq(QuotationShoppingCart::getStatus, 0) .eq(QuotationShoppingCart::getStatus, 0)
.in(QuotationShoppingCart::getId, cartIds) .in(QuotationShoppingCart::getId, cartIds)
.update(); .update();
return ApiResult.success(); return ApiResult.success(order.getId());
} }
/** /**
@ -881,7 +888,7 @@ public class ShoppingController extends ControllerBase {
Object pwd = stringRedisTemplate.opsForHash().get("quotation:password", String.valueOf(AppUserUtil.getUserId())); Object pwd = stringRedisTemplate.opsForHash().get("quotation:password", String.valueOf(AppUserUtil.getUserId()));
// VUtils.trueThrowBusinessError(Objects.isNull(pwd)).throwMessage("还未设置过查看密码"); // VUtils.trueThrowBusinessError(Objects.isNull(pwd)).throwMessage("还未设置过查看密码");
if (Objects.isNull(pwd)) { if (Objects.isNull(pwd)) {
pwd = PASSWORDENCODER.encode("000000"); return ApiResult.success(StrUtil.equals(password, "000000"));
} }
if (!PASSWORDENCODER.matches(password, pwd.toString())) { if (!PASSWORDENCODER.matches(password, pwd.toString())) {
return ApiResult.error("查看密码不正确"); return ApiResult.error("查看密码不正确");

View File

@ -25,6 +25,11 @@ public class ShoppingCartVO {
*/ */
private Long modelId; private Long modelId;
/**
* 机型自增id
*/
private Integer modelKeyId;
/** /**
* 价格id * 价格id
*/ */