diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/PriceConfigController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/PriceConfigController.java index f15adc9c..9a2be51a 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/PriceConfigController.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/PriceConfigController.java @@ -110,6 +110,8 @@ public class PriceConfigController extends ControllerBase { map.put(area.getCode(), NumberUtil.format(area.getAmount())); }); } + //是否可以配置价格 + map.put("enable", true); map.put("children", new ArrayList<>()); data.getChildren().forEach(item -> convert(map, item)); return map; diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/RatioAgentConfigController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/RatioAgentConfigController.java index d0ae5108..ba515b04 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/RatioAgentConfigController.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/RatioAgentConfigController.java @@ -235,7 +235,7 @@ public class RatioAgentConfigController extends ControllerBase { data.remove("modelId"); data.remove("modelNo"); data.forEach((key, value) -> { - if (Objects.nonNull(value)) { + if (Objects.nonNull(value) && StrUtil.isNotBlank(value.toString())) { Integer userId = Integer.parseInt(key.split("-")[0]); String type = key.split("-")[1]; if ("standardRatio".equals(type) || "optionalRatio".equals(type)) { diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/PlanController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/PlanController.java index d298da88..c1e1c80f 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/PlanController.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/PlanController.java @@ -338,13 +338,12 @@ public class PlanController extends ControllerBase { .eq(QuotationUserPlanModel::getCreateByType, AppUserUtil.isAgent() ? 1 : 0) .eq(QuotationUserPlanModel::getCreateById, AppUserUtil.getUserId()) .one(); - List items = Objects.isNull(plan) - ? new ArrayList<>() - : planModelItemService.lambdaQuery() - .eq(QuotationUserPlanModelItem::getPlanId, plan.getId()) - .list(); + List items = new ArrayList<>(); if (Objects.nonNull(plan)) { - QuotationUserPlanModel oldPlan = planModelService.getById(plan.getId()); + String version = plan.getVersion().substring(2); + String day = version.split("-")[0]; + int index = Integer.parseInt(version.split("-")[1]); + String today = DateTimeUtil.format(LocalDate.now(), "yyMMdd"); planModelService.lambdaUpdate() .set(QuotationUserPlanModel::getStatus, 2) .eq(QuotationUserPlanModel::getId, plan.getId()) @@ -356,10 +355,6 @@ public class PlanController extends ControllerBase { .setCreateById(AppUserUtil.getUserId()) .setCreateBy(AppUserUtil.getUserName()) .setCreateTime(LocalDateTime.now()); - String version = oldPlan.getVersion().substring(2); - String day = version.split("-")[0]; - int index = Integer.parseInt(version.split("-")[1]); - String today = DateTimeUtil.format(LocalDate.now(), "yyMMdd"); if (today.equals(day)) { plan.setVersion("BP" + day + "-" + StrUtil.padPre(String.valueOf(index + 1), 2, '0')); } else { @@ -377,34 +372,19 @@ public class PlanController extends ControllerBase { .setCreateTime(LocalDateTime.now()); planModelService.save(plan); } - QuotationUserPlanModel finalPlan = plan; - datas.forEach(data -> { - if (Objects.isNull(data.getId())) { - items.add(new QuotationUserPlanModelItem() - .setPlanId(finalPlan.getId()) - .setModelId(data.getModelId()) - .setName(data.getName()) - .setRatio(data.getRatio()) - .setAreaId(data.getAreaId()) - .setIsDefault(data.getIsDefault()) - .setCreateTime(LocalDateTime.now()) - ); - } else { - QuotationUserPlanModelItem item = items.stream() - .filter(item1 -> item1.getId().equals(data.getId())) - .findFirst() - .orElse(null); - VUtils.trueThrowBusinessError(Objects.isNull(item)).throwMessage("数据不存在:" + data.getId()); - item.setPlanId(finalPlan.getId()); - item.setName(data.getName()); - item.setRatio(data.getRatio()); - item.setAreaId(data.getAreaId()); - item.setIsDefault(data.getIsDefault()); - item.setCreateTime(LocalDateTime.now()); - } - }); - items.forEach(item -> item.setId(IdUtil.getId())); - planModelItemService.saveBatch(items); + Long planId = plan.getId(); + planModelItemService.saveBatch( + datas.stream() + .map(data -> new QuotationUserPlanModelItem() + .setPlanId(planId) + .setName(data.getName()) + .setRatio(data.getRatio()) + .setModelId(data.getModelId()) + .setIsDefault(data.getIsDefault()) + .setCreateTime(LocalDateTime.now()) + .setUpdateTime(LocalDateTime.now())) + .collect(Collectors.toList()) + ); return ApiResult.success(); }