From 6a7b51ce73f2c46a484b032d9518846d8c7d3535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Fri, 13 Mar 2026 18:31:25 +0800 Subject: [PATCH] =?UTF-8?q?refactor(quotation):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=8A=A5=E4=BB=B7=E7=B3=BB=E7=BB=9F=E4=B8=AD=E7=9A=84=E7=B3=BB?= =?UTF-8?q?=E6=95=B0=E9=85=8D=E7=BD=AE=E5=92=8C=E6=9F=A5=E8=AF=A2=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改 AdminShoppingController 中的搜索方法,移除客户服务依赖并优化空记录处理 - 更新 AppRatioAgentConfigController 中的系数配置检查逻辑,添加模型ID参数支持 - 在 DiscountConfigController 中增强导入功能,添加区域验证和折扣时间处理 - 调整 PlanController 中的价格计算逻辑,统一使用模型ID进行系数查询 - 修改多个服务接口和实现类,将用户系数查询方法改为基于模型ID的精确匹配 - 优化数据库查询映射,添加必要的表连接以支持目标名称显示 - 在 ShoppingController 中添加空记录检查以提高性能 --- .../request/ModelConfigSearchRequest.java | 2 + .../common/pojo/request/PageRequest.java | 2 + .../QuotationProductModelSearchRequest.java | 1 - .../common/pojo/vo/ProductTypeSimpleVO.java | 2 +- .../admin/AdminShoppingController.java | 27 ++--------- .../admin/DiscountConfigController.java | 47 ++++++++++++++----- .../admin/RatioDirectConfigController.java | 1 + .../app/AppRatioAgentConfigController.java | 25 +++++++--- .../controller/app/PlanController.java | 13 ++--- .../controller/app/ShoppingController.java | 9 ++-- .../pojo/dto/DiscountForbidImportDTO.java | 4 +- .../QuotationModelRatioAgentItemMapper.java | 4 +- .../QuotationUserPlanModelItemMapper.java | 2 +- .../IQuotationModelRatioAgentItemService.java | 4 +- .../IQuotationUserPlanModelItemService.java | 2 +- ...otationModelRatioAgentItemServiceImpl.java | 9 +++- ...QuotationUserPlanModelItemServiceImpl.java | 4 +- .../QuotationModelRatioAgentItemMapper.xml | 8 +++- .../mapper/QuotationShoppingOrderMapper.xml | 4 +- .../QuotationUserPlanModelItemMapper.xml | 3 +- 20 files changed, 108 insertions(+), 65 deletions(-) diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/ModelConfigSearchRequest.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/ModelConfigSearchRequest.java index 0ca4e270..7cd2b28f 100644 --- a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/ModelConfigSearchRequest.java +++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/ModelConfigSearchRequest.java @@ -1,8 +1,10 @@ package com.nflg.mobilebroken.common.pojo.request; import lombok.Data; +import lombok.experimental.Accessors; @Data +@Accessors(chain = true) public class ModelConfigSearchRequest extends PageRequest { /** diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/PageRequest.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/PageRequest.java index 7a78353b..cfaa5530 100644 --- a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/PageRequest.java +++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/PageRequest.java @@ -1,8 +1,10 @@ package com.nflg.mobilebroken.common.pojo.request; import lombok.Data; +import lombok.experimental.Accessors; @Data +@Accessors public class PageRequest { //页码 diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/QuotationProductModelSearchRequest.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/QuotationProductModelSearchRequest.java index f1dd62ea..d7db0a84 100644 --- a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/QuotationProductModelSearchRequest.java +++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/QuotationProductModelSearchRequest.java @@ -21,7 +21,6 @@ public class QuotationProductModelSearchRequest { /** * 类型批次号 */ - @NotBlank private String typeNumber; /** diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductTypeSimpleVO.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductTypeSimpleVO.java index 3b2360eb..3c4b7e20 100644 --- a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductTypeSimpleVO.java +++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductTypeSimpleVO.java @@ -8,7 +8,7 @@ public class ProductTypeSimpleVO { /** * 模块名称 */ - private Integer moduleName; + private String moduleName; /** * 系列名称 diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/AdminShoppingController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/AdminShoppingController.java index 19599ad1..817df415 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/AdminShoppingController.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/AdminShoppingController.java @@ -1,5 +1,6 @@ package com.nflg.mobilebroken.quotation.controller.admin; +import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.nflg.mobilebroken.common.pojo.ApiResult; @@ -9,8 +10,10 @@ import com.nflg.mobilebroken.common.pojo.request.QuotationSearchRequest; import com.nflg.mobilebroken.common.pojo.vo.QuotationSearchVO; import com.nflg.mobilebroken.common.util.AppUserUtil; import com.nflg.mobilebroken.quotation.controller.ControllerBase; +import com.nflg.mobilebroken.repository.entity.AdminUser; import com.nflg.mobilebroken.repository.entity.ProductModel; import com.nflg.mobilebroken.repository.entity.TBaseCustomer; +import com.nflg.mobilebroken.repository.service.IAdminUserService; import com.nflg.mobilebroken.repository.service.IQuotationShoppingOrderService; import com.nflg.mobilebroken.repository.service.ITBaseCustomerService; import org.springframework.web.bind.annotation.PostMapping; @@ -33,36 +36,16 @@ public class AdminShoppingController extends ControllerBase { @Resource private IQuotationShoppingOrderService shoppingOrderService; - @Resource - private ITBaseCustomerService customerService; - /** * 查询报价单 */ @PostMapping("/search") public ApiResult> searchQuotation(@Valid @RequestBody QuotationAdminSearchRequest request) { IPage datas = shoppingOrderService.searchFromAdmin(request); - boolean isAgent = AppUserUtil.isAgent(); - List customers; - if (isAgent) { - customers = customerService.lambdaQuery() - .in(TBaseCustomer::getId, datas.getRecords().stream().map(QuotationSearchVO::getTargetId).collect(Collectors.toList())) - .list(); - } else { - customers = null; + if (CollectionUtil.isEmpty(datas.getRecords())){ + return ApiResult.success(PageData.empty()); } return ApiResult.success(datas, data -> { - if (isAgent) { - data.setTargetName( - customers.stream() - .filter(item -> item.getId().equals(data.getTargetId())) - .map(TBaseCustomer::getAgencyCompanyName) - .findFirst() - .orElse("") - ); - } else { - data.setTargetName(AppUserUtil.getUserName()); - } //TODO 设置汇率价格 return data; }); diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/DiscountConfigController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/DiscountConfigController.java index f16ef9b2..a73d7167 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/DiscountConfigController.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/DiscountConfigController.java @@ -40,6 +40,8 @@ import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.ZoneOffset; import java.util.*; import java.util.stream.Collectors; @@ -451,6 +453,7 @@ public class DiscountConfigController extends ControllerBase { break; } } + VUtils.trueThrowBusinessError(areaCount == 0).throwMessage("未找到区域信息"); for (int index = 2, count = sheet.getLastRowNum(); index <= count; index++) { log.info("处理第{}行", index); Row row = sheet.getRow(index); @@ -473,25 +476,47 @@ public class DiscountConfigController extends ControllerBase { .setModelNo(modelNo) .setSeriesName(modelVO.getSeriesName()) .setTypeName(modelVO.getTypeName()); - for (int i = 1; i <= areaCount; i++) { + for (int i = 0; i < areaCount; i++) { int colIndex = 4 + i * 6; - String areaName = row.getCell(colIndex).getStringCellValue(); - DictionaryItem area=areas.stream() + String areaName = sheet.getRow(0).getCell(colIndex).getStringCellValue(); + DictionaryItem area = areas.stream() .filter(di -> StrUtil.equals(di.getName(), areaName)) .findFirst() .get(); - String startDate=dataFormatter.formatCellValue(row.getCell(colIndex + 3)); -// VUtils.trueThrowBusinessError(StrUtil.isNotBlank(startDate) && !DateUtil.(startDate)) -// .throwMessage("折扣开始时间不能为空"); -// DiscountForbidImportAreaDTO areaDTO=new DiscountForbidImportAreaDTO() -// .setAreaId(area.getId()) -// .setRatio(new BigDecimal(dataFormatter.formatCellValue(row.getCell(colIndex + 1)))) -// .setDiscountStartDate(); + DiscountForbidImportAreaDTO areaDTO = new DiscountForbidImportAreaDTO() + .setAreaId(area.getId()); + Cell ct = row.getCell(colIndex + 1); + VUtils.trueThrowBusinessError(Objects.isNull(ct)).throwMessage("机型" + modelNo + "未填写" + areaName + "折扣系数"); + areaDTO.setRatio(new BigDecimal(dataFormatter.formatCellValue(ct))); + ct = row.getCell(colIndex + 3); + VUtils.trueThrowBusinessError(Objects.isNull(ct)).throwMessage("机型" + modelNo + "未填写" + areaName + "折扣开始时间"); + Date startDate = ct.getDateCellValue(); + areaDTO.setDiscountStartDate(Objects.isNull(startDate) ? null : startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); + ct = row.getCell(colIndex + 4); + VUtils.trueThrowBusinessError(Objects.isNull(ct)).throwMessage("机型" + modelNo + "未填写" + areaName + "折扣结束时间"); + Date endDate = ct.getDateCellValue(); + areaDTO.setDiscountEndDate(Objects.isNull(endDate) ? null : endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); + dto.getAreas().add(areaDTO); } - + Cell ct = row.getCell(4 + areaCount * 6); + VUtils.trueThrowBusinessError(Objects.isNull(ct)).throwMessage("机型" + modelNo + "未填写折扣对象"); + List customerNames = StrUtil.split(dataFormatter.formatCellValue(ct), ","); + List customers = customerService.lambdaQuery() + .eq(TBaseCustomer::getDelIs, 0) + .eq(TBaseCustomer::getEnableState, 1) + .in(TBaseCustomer::getAgencyCompanyName, customerNames) + .list(); + customerNames.removeAll(customers.stream().map(TBaseCustomer::getAgencyCompanyName).collect(Collectors.toSet())); + VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(customerNames)) + .throwMessage("机型" + modelNo + "的以下折扣对象无效:" + StrUtil.join(",", customerNames)); + dto.setTargetIds(customers.stream().map(TBaseCustomer::getId).collect(Collectors.toList())); datas.add(dto); } } + ModelConfigSearchRequest request = new ModelConfigSearchRequest(); + request.setPageSize(Integer.MAX_VALUE); + IPage pdata = discountService.search(request); + //TODO 合并数据 return ApiResult.success(); } diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/RatioDirectConfigController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/RatioDirectConfigController.java index 717e8c43..fea7b7d7 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/RatioDirectConfigController.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/RatioDirectConfigController.java @@ -287,6 +287,7 @@ public class RatioDirectConfigController extends ControllerBase { IPage pdatas = productModelService.searchForQuotation(request); pdatas.getRecords().forEach(model -> { Map data = new HashMap<>(); + data.put("modelId", model.getBatchNumber()); users.forEach(user -> { data.put(user.getId() + "-standardPrice", getUserStandardPrice(model.getBatchNumber(), user, users, ratioDirects, prices, userPrices)); data.put(user.getId() + "-standardRatio", null); diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/AppRatioAgentConfigController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/AppRatioAgentConfigController.java index 48d299f0..11697597 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/AppRatioAgentConfigController.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/AppRatioAgentConfigController.java @@ -93,8 +93,7 @@ public class AppRatioAgentConfigController extends ControllerBase { */ @PostMapping("config/search") public ApiResult>> search(@Valid @RequestBody ModelConfigSearchRequest request) { - QuotationModelRatioAgentItem mitem = ratioAgentItemService.getEffectiveForUser(AppUserUtil.getUserId()); - VUtils.trueThrowBusinessError(Objects.isNull(mitem)).throwMessage("请联系管理员为你设置系数"); + VUtils.trueThrowBusinessError(!ratioAgentItemService.hasConfig(AppUserUtil.getUserId())).throwMessage("请联系管理员为你设置系数"); QuotationModelRatioAgent ratioAgent = ratioAgentService.lambdaQuery() .eq(QuotationModelRatioAgent::getStatus, 1) .eq(QuotationModelRatioAgent::getCreateByType, 1) @@ -132,7 +131,10 @@ public class AppRatioAgentConfigController extends ControllerBase { && it.getUserId().equals(user.getId())) .findFirst() .orElse(null); - BigDecimal basePrice = Objects.nonNull(modelPrice) ? NumberUtil.multiply(modelPrice.getAmount(), mitem.getStandardRatio()) : null; + QuotationModelRatioAgentItem mitem = ratioAgentItemService.getEffectiveForUser(data.getBatchNumber(), AppUserUtil.getUserId()); + BigDecimal basePrice = Objects.nonNull(modelPrice) ? NumberUtil.multiply(modelPrice.getAmount(), Optional.ofNullable(mitem) + .map(QuotationModelRatioAgentItem::getStandardRatio) + .orElse(null)) : null; BigDecimal standardRatio = Objects.nonNull(item) ? item.getStandardRatio() : null; map.put(user.getId().toString() + "-standardPrice", NumberUtil.format(basePrice)); map.put(user.getId().toString() + "-standardRatio", NumberUtil.format(standardRatio)); @@ -241,8 +243,7 @@ public class AppRatioAgentConfigController extends ControllerBase { */ @PostMapping("list/search") public ApiResult> search(@Valid @RequestBody ModelRatioUserSearchRequest request) { - QuotationModelRatioAgentItem mitem = ratioAgentItemService.getEffectiveForUser(AppUserUtil.getUserId()); - VUtils.trueThrowBusinessError(Objects.isNull(mitem)).throwMessage("请联系管理员为你设置系数"); + VUtils.trueThrowBusinessError(!ratioAgentItemService.hasConfig(AppUserUtil.getUserId())).throwMessage("请联系管理员为你设置系数"); AppUser cuser = appUserService.getById(AppUserUtil.getUserId()); DictionaryItem category = appUserService.getCategory(cuser); VUtils.trueThrowBusinessError(Objects.isNull(category)).throwMessage("请联系管理员为你设置区域类型"); @@ -260,7 +261,12 @@ public class AppRatioAgentConfigController extends ControllerBase { .filter(it -> it.getModelId().equals(data.getModelId()) && it.getAreaId().equals(category.getId())) .findFirst() .orElse(null); - BigDecimal basePrice = Objects.nonNull(modelPrice) ? NumberUtil.multiply(modelPrice.getAmount(), mitem.getStandardRatio()) : null; + QuotationModelRatioAgentItem mitem = ratioAgentItemService.getEffectiveForUser(data.getModelId(), AppUserUtil.getUserId()); + BigDecimal basePrice = Objects.nonNull(modelPrice) + ? NumberUtil.multiply(modelPrice.getAmount(), Optional.ofNullable(mitem) + .map(QuotationModelRatioAgentItem::getStandardRatio) + .orElse(null)) + : null; items.forEach(item -> { RatioConfigSearchVO vou = new RatioConfigSearchVO() .setName(item.getUserName()) @@ -317,7 +323,12 @@ public class AppRatioAgentConfigController extends ControllerBase { .filter(it -> it.getModelId().equals(entry.getKey()) && it.getAreaId().equals(category.getId())) .findFirst() .orElse(null); - BigDecimal basePrice = Objects.nonNull(modelPrice) ? NumberUtil.multiply(modelPrice.getAmount(), mitem.getStandardRatio()) : null; + QuotationModelRatioAgentItem mitem = ratioAgentItemService.getEffectiveForUser(entry.getKey(), AppUserUtil.getUserId()); + BigDecimal basePrice = Objects.nonNull(modelPrice) + ? NumberUtil.multiply(modelPrice.getAmount(), Optional.ofNullable(mitem) + .map(QuotationModelRatioAgentItem::getStandardRatio) + .orElse(null)) + : null; entry.getValue().forEach(item -> { RatioConfigSearchVO vou = new RatioConfigSearchVO() .setName(item.getUserName()) 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 ea179238..9e3132cb 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 @@ -109,10 +109,7 @@ public class PlanController extends ControllerBase { .eq(QuotationUserPlanModel::getCreateById, AppUserUtil.getUserId()) .one(); vo.setInfo(Convert.convert(QuotationModelRatioVO.class, plan)); - if (Objects.isNull(plan)) { - return ApiResult.success(vo); - } - List items = planModelItemService.search(plan.getId(), request); + List items = planModelItemService.search(request, AppUserUtil.isAgent() ? 1 : 0, AppUserUtil.getUserId()); int index = 0, startIndex = (request.getPage() - 1) * request.getPageSize(), endIndex = request.getPage() * request.getPageSize(); PageData pageData = new PageData<>(); pageData.setPage(request.getPage()); @@ -152,7 +149,7 @@ public class PlanController extends ControllerBase { //代理商 if (AppUserUtil.isPrimary()) { //主账号 - QuotationModelRatioAgentItem pRatioAgentItem = ratioAgentItemService.getEffectiveForUser(AppUserUtil.getUserId()); + QuotationModelRatioAgentItem pRatioAgentItem = ratioAgentItemService.getEffectiveForUser(modelId, AppUserUtil.getUserId()); BigDecimal price = prices.stream() .filter(item -> item.getModelId().equals(modelId) && item.getAreaId().equals(categoryId)) .map(ModelPriceVO::getAmount) @@ -160,13 +157,13 @@ public class PlanController extends ControllerBase { .orElse(null); if (Objects.nonNull(pRatioAgentItem)) { return NumberUtil.multiply(price, pRatioAgentItem.getStandardRatio()); - }else { + } else { return price; } } else { //子账号 Integer parentUserId = appUserService.getPrimaryByChild(AppUserUtil.getUserId()); - QuotationModelRatioAgentItem pRatioAgentItem = ratioAgentItemService.getEffectiveForUser(parentUserId); + QuotationModelRatioAgentItem pRatioAgentItem = ratioAgentItemService.getEffectiveForUser(modelId, parentUserId); BigDecimal price = prices.stream() .filter(item -> item.getModelId().equals(modelId) && item.getAreaId().equals(categoryId)) .map(ModelPriceVO::getAmount) @@ -175,7 +172,7 @@ public class PlanController extends ControllerBase { if (Objects.nonNull(pRatioAgentItem)) { price = NumberUtil.multiply(price, pRatioAgentItem.getStandardRatio()); } - QuotationModelRatioAgentItem cRatioAgentItem = ratioAgentItemService.getEffectiveForUser(AppUserUtil.getUserId()); + QuotationModelRatioAgentItem cRatioAgentItem = ratioAgentItemService.getEffectiveForUser(modelId, AppUserUtil.getUserId()); if (Objects.nonNull(cRatioAgentItem)) { price = NumberUtil.multiply(price, cRatioAgentItem.getStandardRatio()); } diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java index d0496db7..f37766c4 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java @@ -378,6 +378,9 @@ public class ShoppingController extends ControllerBase { request.setPage(page); request.setPageSize(pageSize); IPage datas = shoppingOrderService.search(request); + if(CollectionUtil.isEmpty(datas.getRecords())){ + return ApiResult.success(PageData.empty()); + } boolean isAgent = AppUserUtil.isAgent(); List customers; if (isAgent) { @@ -525,19 +528,19 @@ public class ShoppingController extends ControllerBase { //代理商 if (AppUserUtil.isPrimary()) { //主账号 - QuotationModelRatioAgentItem pRatioAgentItem = ratioAgentItemService.getEffectiveForUser(AppUserUtil.getUserId()); + QuotationModelRatioAgentItem pRatioAgentItem = ratioAgentItemService.getEffectiveForUser(modelId,AppUserUtil.getUserId()); if (Objects.nonNull(pRatioAgentItem)) { pair = Pair.of(pRatioAgentItem.getStandardRatio(), pRatioAgentItem.getOptionalRatio()); } } else { //子账号 Integer parentUserId = appUserService.getPrimaryByChild(AppUserUtil.getUserId()); - QuotationModelRatioAgentItem pRatioAgentItem = ratioAgentItemService.getEffectiveForUser(parentUserId); + QuotationModelRatioAgentItem pRatioAgentItem = ratioAgentItemService.getEffectiveForUser(modelId,parentUserId); if (Objects.nonNull(pRatioAgentItem)) { pair = Pair.of(NumberUtil.multiply(pair.getLeft(), pRatioAgentItem.getStandardRatio()) , NumberUtil.multiply(pair.getRight(), pRatioAgentItem.getOptionalRatio())); } - QuotationModelRatioAgentItem cRatioAgentItem = ratioAgentItemService.getEffectiveForUser(AppUserUtil.getUserId()); + QuotationModelRatioAgentItem cRatioAgentItem = ratioAgentItemService.getEffectiveForUser(modelId,AppUserUtil.getUserId()); if (Objects.nonNull(cRatioAgentItem)) { pair = Pair.of(NumberUtil.multiply(pair.getLeft(), cRatioAgentItem.getStandardRatio()) , NumberUtil.multiply(pair.getRight(), cRatioAgentItem.getOptionalRatio())); diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/dto/DiscountForbidImportDTO.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/dto/DiscountForbidImportDTO.java index c767f91f..9326710c 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/dto/DiscountForbidImportDTO.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/dto/DiscountForbidImportDTO.java @@ -30,5 +30,7 @@ public class DiscountForbidImportDTO { */ private String modelNo; - private List areas=new ArrayList<>(); + private List targetIds = new ArrayList<>(); + + private List areas = new ArrayList<>(); } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/QuotationModelRatioAgentItemMapper.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/QuotationModelRatioAgentItemMapper.java index 8cc44710..c74bd6a5 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/QuotationModelRatioAgentItemMapper.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/QuotationModelRatioAgentItemMapper.java @@ -20,9 +20,11 @@ public interface QuotationModelRatioAgentItemMapper extends BaseMapper getEffectives(); - QuotationModelRatioAgentItem getEffectiveForUser(Integer userId); + QuotationModelRatioAgentItem getEffectiveForUser(Long modelId,Integer userId); List getAgentUsers(Integer userId); List getEffectiveByCreate(Integer userId); + + boolean hasConfig(Integer userId); } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/QuotationUserPlanModelItemMapper.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/QuotationUserPlanModelItemMapper.java index 2c2c857f..6e8f72a4 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/QuotationUserPlanModelItemMapper.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/QuotationUserPlanModelItemMapper.java @@ -20,7 +20,7 @@ public interface QuotationUserPlanModelItemMapper extends BaseMapper getEffectivesForAgent(); - List search(Long id, ModelConfigSearchRequest request); + List search(ModelConfigSearchRequest request,Integer userType, Integer userId); QuotationUserPlanModelItem getEffectiveForUser(Long modelId,Integer userType, Integer userId); } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IQuotationModelRatioAgentItemService.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IQuotationModelRatioAgentItemService.java index b15c2d2a..b05025ac 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IQuotationModelRatioAgentItemService.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IQuotationModelRatioAgentItemService.java @@ -20,9 +20,11 @@ public interface IQuotationModelRatioAgentItemService extends IService getEffectives(); - QuotationModelRatioAgentItem getEffectiveForUser(Integer userId); + QuotationModelRatioAgentItem getEffectiveForUser(Long modelId,Integer userId); List getAgentUsers(Integer userId); List getEffectiveByCreate(Integer userId); + + boolean hasConfig(Integer userId); } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IQuotationUserPlanModelItemService.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IQuotationUserPlanModelItemService.java index eef20d6a..2a6dd71e 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IQuotationUserPlanModelItemService.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IQuotationUserPlanModelItemService.java @@ -21,7 +21,7 @@ public interface IQuotationUserPlanModelItemService extends IService getEffectivesForAgent(); - List search(Long id,ModelConfigSearchRequest request); + List search(ModelConfigSearchRequest request,Integer userType, Integer userId); QuotationUserPlanModelItem getEffectiveForUser(Long modelId,Integer userType, Integer userId); } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/QuotationModelRatioAgentItemServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/QuotationModelRatioAgentItemServiceImpl.java index 6f736737..0b070b32 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/QuotationModelRatioAgentItemServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/QuotationModelRatioAgentItemServiceImpl.java @@ -28,8 +28,8 @@ public class QuotationModelRatioAgentItemServiceImpl extends ServiceImpl getEffectiveByCreate(Integer userId) { return baseMapper.getEffectiveByCreate(userId); } + + @Override + public boolean hasConfig(Integer userId) { + return baseMapper.hasConfig(userId); + } } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/QuotationUserPlanModelItemServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/QuotationUserPlanModelItemServiceImpl.java index 41e4ae61..f237408b 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/QuotationUserPlanModelItemServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/QuotationUserPlanModelItemServiceImpl.java @@ -28,8 +28,8 @@ public class QuotationUserPlanModelItemServiceImpl extends ServiceImpl search(Long id, ModelConfigSearchRequest request) { - return baseMapper.search(id, request); + public List search(ModelConfigSearchRequest request,Integer userType, Integer userId) { + return baseMapper.search(request,userType, userId); } @Override diff --git a/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationModelRatioAgentItemMapper.xml b/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationModelRatioAgentItemMapper.xml index b4a6a914..a6765c10 100644 --- a/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationModelRatioAgentItemMapper.xml +++ b/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationModelRatioAgentItemMapper.xml @@ -13,7 +13,7 @@ SELECT qmtai.* FROM quotation_model_ratio_agent qmta INNER JOIN quotation_model_ratio_agent_item qmtai ON qmtai.ratio_id=qmta.id - WHERE qmta.`status`=1 AND qmtai.user_id=#{userId} + WHERE qmta.`status`=1 and qmtai.model_id=#{modelId} AND qmtai.user_id=#{userId} + + diff --git a/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationShoppingOrderMapper.xml b/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationShoppingOrderMapper.xml index e97f6545..24aa8ade 100644 --- a/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationShoppingOrderMapper.xml +++ b/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationShoppingOrderMapper.xml @@ -24,7 +24,7 @@ SELECT qupmi.id,qupmi.plan_id,pm.batch_number as 'modelId',pm.`no` as 'modelNo',qupmi.`name`,qupmi.ratio,qupmi.is_default FROM product_model pm - LEFT JOIN quotation_user_plan_model_item qupmi ON qupmi.model_id=pm.batch_number AND qupmi.plan_id=#{id} + LEFT JOIN quotation_user_plan_model_item qupmi ON qupmi.model_id=pm.batch_number + left join quotation_user_plan_model qupm on qupmi.plan_id=qupm.id and qupm.`status`=1 and qupm.create_by_type=#{userType} and qupm.create_by_id=#{userId} WHERE pm.state=1 and pm.no like CONCAT('%', #{request.no}, '%')