feat(admin): 更新购物控制器以支持调价功能
- 添加ShoppingOrderAdjustModelPartVO、ShoppingOrderAdjustModelVO和ShoppingOrderAdjustVO转换对象 - 添加QuotationPriceUpdateItemPartRequest、QuotationPriceUpdateItemRequest和QuotationPriceUpdateRequest请求对象 - 在AdminShoppingController中注入新的服务依赖项 - 修改getAdjusts方法以返回完整的调价记录数据 - 添加调价记录查询的数据关联逻辑 - 修改多个控制器添加@folder注解用于API分类 - 添加ModelConfigEffectiveDTO的hasSelect属性 - 更新QuotationOrderInfoVO添加报价代码和汇率价格字段 - 添加QuotationShoppingOrder的exchangeFee、quotationCode和address字段 - 添加QuotationShoppingOrderAdjust的reason字段 - 删除不再使用的QuotationShoppingOrderItem相关实体和服务 - 修改QuotationShoppingCartItemService接口方法名称和参数 - 修改QuotationShoppingCartService搜索方法添加用户类型和ID参数 - 更新MyBatis映射文件以支持调价数据查询 - 在AppShoppingController中添加购物车详情查询接口 - 修改购物车初始化逻辑添加机型验证和报价代码检查 - 重构部分价格计算逻辑并修复标准比例默认值问题 - 添加.apifox-helper.properties配置文件 - 更新代码生成器测试配置以生成调整项相关代码
This commit is contained in:
parent
5ee255a1be
commit
70d2c2f606
|
|
@ -0,0 +1 @@
|
|||
folder.name=#folder
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.nflg.mobilebroken.common.pojo.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -40,4 +41,10 @@ public class ModelConfigEffectiveDTO {
|
|||
* 选配类别,0:新增可选;1:替换可选
|
||||
*/
|
||||
private Integer optionalType;
|
||||
|
||||
/**
|
||||
* 是否已选
|
||||
*/
|
||||
@JsonProperty("hasSelect")
|
||||
private Boolean hasSelect;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class QuotationSearchVO {
|
|||
private BigDecimal actualFee;
|
||||
|
||||
/**
|
||||
* 报价总价,汇率计算后的价格,可能为空
|
||||
* 报价总价,汇率计算后的价格
|
||||
*/
|
||||
private BigDecimal exchangeFee;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nflg.mobilebroken.quotation.controller.admin;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.itextpdf.text.pdf.BaseFont;
|
||||
|
|
@ -13,14 +14,11 @@ 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.QuotationShoppingOrderAdjust;
|
||||
import com.nflg.mobilebroken.repository.entity.TBaseCustomer;
|
||||
import com.nflg.mobilebroken.repository.service.IAdminUserService;
|
||||
import com.nflg.mobilebroken.repository.service.IQuotationShoppingOrderAdjustService;
|
||||
import com.nflg.mobilebroken.repository.service.IQuotationShoppingOrderService;
|
||||
import com.nflg.mobilebroken.repository.service.ITBaseCustomerService;
|
||||
import com.nflg.mobilebroken.quotation.pojo.vo.ShoppingOrderAdjustModelPartVO;
|
||||
import com.nflg.mobilebroken.quotation.pojo.vo.ShoppingOrderAdjustModelVO;
|
||||
import com.nflg.mobilebroken.quotation.pojo.vo.ShoppingOrderAdjustVO;
|
||||
import com.nflg.mobilebroken.repository.entity.*;
|
||||
import com.nflg.mobilebroken.repository.service.*;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.http.ContentDisposition;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
|
|
@ -36,10 +34,13 @@ import java.io.OutputStream;
|
|||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* (管理端)客户报价单
|
||||
* @folder 管理端/(管理端)客户报价单
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/shopping")
|
||||
|
|
@ -51,6 +52,18 @@ public class AdminShoppingController extends ControllerBase {
|
|||
@Resource
|
||||
private IQuotationShoppingOrderAdjustService shoppingOrderAdjustService;
|
||||
|
||||
@Resource
|
||||
private IQuotationShoppingOrderAdjustItemService shoppingOrderAdjustItemService;
|
||||
|
||||
@Resource
|
||||
private IQuotationModelConfigItemService modelConfigItemService;
|
||||
|
||||
@Resource
|
||||
private IQuotationShoppingCartService shoppingCartService;
|
||||
|
||||
@Resource
|
||||
private IProductModelService productModelService;
|
||||
|
||||
/**
|
||||
* 查询报价单
|
||||
*/
|
||||
|
|
@ -70,11 +83,69 @@ public class AdminShoppingController extends ControllerBase {
|
|||
* 获取调价记录
|
||||
*/
|
||||
@GetMapping("/adjusts")
|
||||
public ApiResult<List<QuotationShoppingOrderAdjust>> getAdjusts(@RequestParam Long orderId) {
|
||||
return ApiResult.success(shoppingOrderAdjustService.lambdaQuery()
|
||||
public ApiResult<List<ShoppingOrderAdjustVO>> getAdjusts(@RequestParam Long orderId) {
|
||||
List<QuotationShoppingOrderAdjust> datas = shoppingOrderAdjustService.lambdaQuery()
|
||||
.eq(QuotationShoppingOrderAdjust::getOrderId, orderId)
|
||||
.list()
|
||||
);
|
||||
.orderByAsc(QuotationShoppingOrderAdjust::getId)
|
||||
.list();
|
||||
List<QuotationShoppingOrderAdjustItem> adjustItems = shoppingOrderAdjustItemService.lambdaQuery()
|
||||
.eq(QuotationShoppingOrderAdjustItem::getOrderId, orderId)
|
||||
.list();
|
||||
List<QuotationShoppingCart> carts = shoppingCartService.listByIds(adjustItems.stream().map(QuotationShoppingOrderAdjustItem::getCartId).collect(Collectors.toSet()));
|
||||
List<ProductModel> models = productModelService.listByIds(carts.stream().map(QuotationShoppingCart::getModelId).collect(Collectors.toSet()));
|
||||
Map<Long, List<QuotationShoppingOrderAdjustItem>> adjustGroup = adjustItems.stream()
|
||||
.collect(Collectors.groupingBy(QuotationShoppingOrderAdjustItem::getAdjustId));
|
||||
List<QuotationModelConfigItem> items = modelConfigItemService.lambdaQuery()
|
||||
.in(QuotationModelConfigItem::getId, adjustItems.stream()
|
||||
.map(QuotationShoppingOrderAdjustItem::getConfigItemId)
|
||||
.collect(Collectors.toList())
|
||||
)
|
||||
.list();
|
||||
List<ShoppingOrderAdjustVO> adjusts = datas.stream()
|
||||
.map(data -> {
|
||||
ShoppingOrderAdjustVO vo = Convert.convert(ShoppingOrderAdjustVO.class, data);
|
||||
adjustGroup.get(data.getId()).stream()
|
||||
.collect(Collectors.groupingBy(QuotationShoppingOrderAdjustItem::getCartId))
|
||||
.forEach((key, value) -> {
|
||||
QuotationShoppingOrderAdjustItem as = value.stream()
|
||||
.filter(item -> item.getConfigItemId() == 0L)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
ShoppingOrderAdjustModelVO mv = new ShoppingOrderAdjustModelVO()
|
||||
.setModelNo(models.stream()
|
||||
.filter(m -> m.getBatchNumber().equals(carts.stream()
|
||||
.filter(c -> c.getId().equals(key))
|
||||
.findFirst()
|
||||
.map(QuotationShoppingCart::getModelId)
|
||||
.get()
|
||||
)
|
||||
)
|
||||
.findFirst()
|
||||
.map(ProductModel::getNo)
|
||||
.orElse("")
|
||||
)
|
||||
.setOldFee(Objects.isNull(as) ? null : as.getOldFee())
|
||||
.setNewFee(Objects.isNull(as) ? null : as.getNewFee())
|
||||
.setParts(
|
||||
value.stream()
|
||||
.filter(item -> item.getConfigItemId() > 0L)
|
||||
.map(item -> new ShoppingOrderAdjustModelPartVO()
|
||||
.setPartName(items.stream()
|
||||
.filter(i -> i.getId().equals(item.getConfigItemId()))
|
||||
.findFirst()
|
||||
.map(QuotationModelConfigItem::getPartName)
|
||||
.orElse("")
|
||||
)
|
||||
.setOldFee(item.getOldFee())
|
||||
.setNewFee(item.getNewFee()))
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
vo.getModels().add(mv);
|
||||
});
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
return ApiResult.success(adjusts);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
/**
|
||||
* (管理端)机型折扣管理
|
||||
* @folder 管理端/(管理端)机型折扣管理
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
/**
|
||||
* (管理端)机型禁售管理
|
||||
* @folder 管理端/(管理端)机型禁售管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/forbid/config")
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
/**
|
||||
* (管理端)机型配置管理
|
||||
* @folder 管理端/(管理端)机型配置管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/model/config")
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
/**
|
||||
* (管理端)机型价格管理
|
||||
* @folder 管理端/(管理端)机型价格管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/price/config")
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
/**
|
||||
* (管理端)代理商系数设置
|
||||
* @folder 管理端/(管理端)代理商系数设置
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ratio/agent/config")
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
/**
|
||||
* (管理端)机型配置系数
|
||||
* @folder 管理端/(管理端)机型配置系数
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ratio/config")
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
/**
|
||||
* (管理端)直销系数设置
|
||||
* @folder 管理端/(管理端)直销系数设置
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ratio/direct/config")
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
/**
|
||||
* (用户端)定价系数
|
||||
* @folder 用户端/(用户端)定价系数
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/ratio/agent")
|
||||
|
|
@ -259,7 +260,7 @@ public class AppRatioAgentConfigController extends ControllerBase {
|
|||
pdatas.getRecords().forEach(data -> {
|
||||
RatioConfigSearchVO vo = new RatioConfigSearchVO().setModelNo(data.getModelNo());
|
||||
vos.add(vo);
|
||||
List<QuotationModelRatioAgentItemDTO> modelItems= items.stream()
|
||||
List<QuotationModelRatioAgentItemDTO> modelItems = items.stream()
|
||||
.filter(it -> it.getModelId().equals(data.getModelId()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(modelItems)) {
|
||||
|
|
@ -267,11 +268,12 @@ public class AppRatioAgentConfigController extends ControllerBase {
|
|||
.filter(it -> it.getModelId().equals(data.getModelId()) && it.getAreaId().equals(category.getId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
// vo.setStandardPrice(Objects.isNull(modelPrice) ? null : modelPrice.getAmount());
|
||||
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))
|
||||
.orElse(BigDecimal.ONE))
|
||||
: null;
|
||||
modelItems.forEach(item -> {
|
||||
RatioConfigSearchVO vou = new RatioConfigSearchVO()
|
||||
|
|
@ -328,11 +330,12 @@ public class AppRatioAgentConfigController extends ControllerBase {
|
|||
.filter(it -> it.getModelId().equals(entry.getKey()) && it.getAreaId().equals(category.getId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
// vo.setStandardPrice(Objects.isNull(modelPrice) ? null : modelPrice.getAmount());
|
||||
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))
|
||||
.orElse(BigDecimal.ONE))
|
||||
: null;
|
||||
entry.getValue().forEach(item -> {
|
||||
RatioConfigSearchVO vou = new RatioConfigSearchVO()
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
/**
|
||||
* (用户端)报价项目管理
|
||||
* @folder 用户端/(用户端)报价项目管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/plan")
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* (用户端)产品机型
|
||||
* @folder 用户端/(用户端)产品机型
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/product/model")
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* (用户端)产品类型
|
||||
* @folder 用户端/(用户端)产品类型
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/product/type")
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ import cn.hutool.core.convert.Convert;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.itextpdf.text.pdf.BaseFont;
|
||||
import com.nflg.mobilebroken.common.constant.STATE;
|
||||
import com.nflg.mobilebroken.common.exception.NflgException;
|
||||
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||
import com.nflg.mobilebroken.common.pojo.PageData;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.ModelConfigEffectiveDTO;
|
||||
|
|
@ -38,21 +35,13 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.thymeleaf.TemplateEngine;
|
||||
import org.thymeleaf.context.Context;
|
||||
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
|
||||
import org.xhtmlrenderer.pdf.ITextRenderer;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
|
@ -60,6 +49,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
/**
|
||||
* (用户端)购物
|
||||
* @folder 用户端/(用户端)购物
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
|
|
@ -113,6 +103,9 @@ public class ShoppingController extends ControllerBase {
|
|||
@Resource
|
||||
private IQuotationShoppingOrderAdjustService shoppingOrderAdjustService;
|
||||
|
||||
@Resource
|
||||
private IQuotationShoppingOrderAdjustItemService shoppingOrderAdjustItemService;
|
||||
|
||||
@Resource
|
||||
private IQuotationShoppingOrderItemService shoppingOrderItemService;
|
||||
|
||||
|
|
@ -160,7 +153,12 @@ public class ShoppingController extends ControllerBase {
|
|||
*/
|
||||
@PostMapping("/cart/init")
|
||||
public ApiResult<ShoppingCartVO> init(@Valid @RequestBody ShoppingInitRequest request) {
|
||||
String qc = getQuotationCode();
|
||||
VUtils.trueThrowBusinessError(StrUtil.isBlank(qc)).throwMessage("请联系管理员为你设置报价代码");
|
||||
Long categoryId = getCategoryId();
|
||||
ProductModel model = productModelService.lambdaQuery().eq(ProductModel::getState, 1).eq(ProductModel::getNo, request.getModelNo()).one();
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(model)).throwMessage("未找到该机型");
|
||||
request.setModelId(model.getBatchNumber());
|
||||
VUtils.trueThrowBusinessError(forbidService.isForbid(request.getModelId(), 1, request.getTargetId()))
|
||||
.throwMessage("该机型已禁售");
|
||||
ModelPrice1VO modelPrice = priceService.getModelPrice(request.getModelId(), categoryId);
|
||||
|
|
@ -213,7 +211,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.getConfigId(),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)
|
||||
|
|
@ -222,9 +220,14 @@ public class ShoppingController extends ControllerBase {
|
|||
vi.setChildren(
|
||||
parts.stream()
|
||||
.filter(pi -> pi.getParentId().equals(part.getId()))
|
||||
.map(pi -> convert(pi, optionalRatio))
|
||||
.map(pi -> {
|
||||
ShoppingCartPartVO vc = convert(pi, optionalRatio);
|
||||
vc.setHasSelect(vc.getType() == 1);
|
||||
return vc;
|
||||
})
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
vi.setHasSelect(true);
|
||||
return vi;
|
||||
}
|
||||
).collect(Collectors.toList())
|
||||
|
|
@ -236,9 +239,14 @@ public class ShoppingController extends ControllerBase {
|
|||
vi.setChildren(
|
||||
parts.stream()
|
||||
.filter(pi -> pi.getParentId().equals(part.getId()))
|
||||
.map(pi -> convert(pi, optionalRatio))
|
||||
.map(pi -> {
|
||||
ShoppingCartPartVO vc = convert(pi, optionalRatio);
|
||||
vc.setHasSelect(vc.getType() == 1);
|
||||
return vc;
|
||||
})
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
vi.setHasSelect(false);
|
||||
return vi;
|
||||
}
|
||||
).collect(Collectors.toList())
|
||||
|
|
@ -320,7 +328,65 @@ public class ShoppingController extends ControllerBase {
|
|||
*/
|
||||
@PostMapping("/cart/search")
|
||||
public ApiResult<PageData<ShoppingSearchVO>> search(@Valid @RequestBody ShoppingSearchRequest request) {
|
||||
return ApiResult.success(shoppingCartService.search(request, MultilingualUtil.getLanguage()));
|
||||
return ApiResult.success(shoppingCartService.search(request, AppUserUtil.isAgent() ? 1 : 0, AppUserUtil.getUserId(), MultilingualUtil.getLanguage()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 购物车-获取购物车详情
|
||||
* @param id 购物车id
|
||||
*/
|
||||
@GetMapping("/cart/getInfo")
|
||||
public ApiResult<ShoppingCartVO> getInfo(@RequestParam Long id) {
|
||||
QuotationShoppingCart cart = shoppingCartService.getById(id);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(cart)).throwMessage("未找到购物车信息");
|
||||
ShoppingCartVO vo = Convert.convert(ShoppingCartVO.class, cart);
|
||||
//获取部件配置
|
||||
// Long categoryId = getCategoryId();
|
||||
// List<ModelConfigEffectiveDTO> parts = modelConfigService.getEffectives(cart.getConfigId(), cart.getPriceId(), categoryId, MultilingualUtil.getLanguage());
|
||||
List<ModelConfigEffectiveDTO> parts = shoppingCartItemService.getParts(cart.getId(), MultilingualUtil.getLanguage());
|
||||
vo.setStandardParts(parts.stream()
|
||||
.filter(part -> part.getParentId() == 0L && part.getType() == 1)
|
||||
.map(part -> {
|
||||
ShoppingCartPartVO vi = Convert.convert(ShoppingCartPartVO.class, part);
|
||||
vi.setAmount(
|
||||
vi.getAmount().add(
|
||||
parts.stream()
|
||||
.filter(pi -> pi.getParentId().equals(part.getId()) && pi.getType() == 0)
|
||||
.map(ModelConfigEffectiveDTO::getAmount)
|
||||
.reduce(BigDecimal::add)
|
||||
.orElse(BigDecimal.ZERO)
|
||||
)
|
||||
);
|
||||
return vi;
|
||||
}
|
||||
).collect(Collectors.toList())
|
||||
);
|
||||
vo.setOptionalParts(parts.stream()
|
||||
.filter(part -> part.getParentId() == 0L && part.getType() == 0)
|
||||
.map(part -> {
|
||||
ShoppingCartPartVO vi = Convert.convert(ShoppingCartPartVO.class, part);
|
||||
vi.setAmount(
|
||||
vi.getAmount().add(
|
||||
parts.stream()
|
||||
.filter(pi -> pi.getParentId().equals(part.getId()) && pi.getType() == 0)
|
||||
.map(ModelConfigEffectiveDTO::getAmount)
|
||||
.reduce(BigDecimal::add)
|
||||
.orElse(BigDecimal.ZERO)
|
||||
)
|
||||
);
|
||||
return vi;
|
||||
}
|
||||
).collect(Collectors.toList())
|
||||
);
|
||||
vo.setAccessories(shoppingCartAccessoryService.lambdaQuery()
|
||||
.eq(QuotationShoppingCartAccessory::getCartId, cart.getId())
|
||||
.list()
|
||||
);
|
||||
vo.setServices(shoppingCartServiceService.lambdaQuery()
|
||||
.eq(QuotationShoppingCartService::getCartId, cart.getId())
|
||||
.list()
|
||||
);
|
||||
return ApiResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -371,6 +437,7 @@ public class ShoppingController extends ControllerBase {
|
|||
.in(QuotationShoppingCart::getId, cartIds)
|
||||
.list();
|
||||
VUtils.trueThrowBusinessError(CollectionUtil.isEmpty(carts)).throwMessage("未找到购物车信息");
|
||||
VUtils.trueThrowBusinessError(cartIds.size() != carts.size()).throwMessage("数据无效");
|
||||
VUtils.trueThrowBusinessError(carts.stream().map(QuotationShoppingCart::getCustomerName).collect(Collectors.toSet()).size() > 1)
|
||||
.throwMessage("客户名称不一致");
|
||||
VUtils.trueThrowBusinessError(carts.stream().map(QuotationShoppingCart::getTargetId).collect(Collectors.toSet()).size() > 1)
|
||||
|
|
@ -386,9 +453,13 @@ public class ShoppingController extends ControllerBase {
|
|||
.setCreateTime(LocalDateTime.now())
|
||||
.setId(IdUtil.getId())
|
||||
.setCustomerName(carts.get(0).getCustomerName())
|
||||
.setEffectiveStartTime(DateTimeUtil.format(LocalDate.now(), "yyyy-MM-dd"))
|
||||
.setEffectiveEndTime(DateTimeUtil.format(LocalDate.now().plusMonths(1), "yyyy-MM-dd"))
|
||||
.setQuotationCode(getQuotationCode())
|
||||
.setTargetId(carts.get(0).getTargetId())
|
||||
.setTotalFee(carts.stream().map(QuotationShoppingCart::getActualFee).reduce(BigDecimal::add).get());
|
||||
order.setActualFee(order.getTotalFee());
|
||||
order.setExchangeFee(NumberUtil.multiply(order.getActualFee(), carts.get(0).getExchangeRate()));
|
||||
shoppingOrderItemService.saveBatch(
|
||||
carts.stream()
|
||||
.map(cart -> new QuotationShoppingOrderItem()
|
||||
|
|
@ -408,6 +479,11 @@ public class ShoppingController extends ControllerBase {
|
|||
}
|
||||
}
|
||||
shoppingOrderService.save(order);
|
||||
shoppingCartService.lambdaUpdate()
|
||||
.set(QuotationShoppingCart::getStatus, 1)
|
||||
.eq(QuotationShoppingCart::getStatus, 0)
|
||||
.in(QuotationShoppingCart::getId, cartIds)
|
||||
.update();
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
|
|
@ -479,17 +555,19 @@ public class ShoppingController extends ControllerBase {
|
|||
List<QuotationShoppingCart> carts = shoppingCartService.lambdaQuery()
|
||||
.in(QuotationShoppingCart::getId, orderItems.stream().map(QuotationShoppingOrderItem::getCartId).collect(Collectors.toList()))
|
||||
.list();
|
||||
List<QuotationShoppingOrderAdjustItem> adjustItems = shoppingOrderAdjustItemService.getParts(id);
|
||||
carts.forEach(cart -> {
|
||||
ShoppingCartVO cartVO = Convert.convert(ShoppingCartVO.class, cart);
|
||||
QuotationShoppingOrderItem orderItem = orderItems.stream()
|
||||
.filter(item -> item.getCartId().equals(cart.getId()))
|
||||
QuotationShoppingOrderAdjustItem adjustItem = adjustItems.stream()
|
||||
.filter(item -> item.getCartId().equals(cart.getId()) && item.getConfigItemId().equals(0L))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(orderItem)) {
|
||||
cartVO.setStandardFee(orderItem.getStandardFee());
|
||||
if (Objects.nonNull(adjustItem)) {
|
||||
cartVO.setStandardFee(adjustItem.getNewFee());
|
||||
}
|
||||
//获取部件配置
|
||||
List<ModelConfigEffectiveDTO> parts = shoppingCartItemService.getSelectedParts(cart.getId(), MultilingualUtil.getLanguage());
|
||||
List<ModelConfigEffectiveDTO> parts = shoppingCartItemService.getParts(cart.getId(), MultilingualUtil.getLanguage());
|
||||
parts.removeIf(p -> !p.getHasSelect());
|
||||
cartVO.setStandardParts(parts.stream()
|
||||
.filter(part -> part.getParentId() == 0L && part.getType() == 1)
|
||||
.map(part -> {
|
||||
|
|
@ -529,21 +607,21 @@ public class ShoppingController extends ControllerBase {
|
|||
return ApiResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报价单-设置报价有效期
|
||||
*/
|
||||
@PostMapping("/quotation/update")
|
||||
public ApiResult<Void> updateQuotationInfo(@Valid @RequestBody QuotationInfoUpdateRequest request) {
|
||||
QuotationShoppingOrder order = shoppingOrderService.getById(request.getId());
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(order)).throwMessage("未找到报价单");
|
||||
shoppingOrderService.lambdaUpdate()
|
||||
.set(QuotationShoppingOrder::getEffectiveStartTime, request.getEffectiveStartTime())
|
||||
.set(QuotationShoppingOrder::getEffectiveEndTime, request.getEffectiveEndTime())
|
||||
.set(QuotationShoppingOrder::getUpdateTime, LocalDateTime.now())
|
||||
.eq(QuotationShoppingOrder::getId, request.getId())
|
||||
.update();
|
||||
return ApiResult.success();
|
||||
}
|
||||
// /**
|
||||
// * 报价单-设置报价有效期
|
||||
// */
|
||||
// @PostMapping("/quotation/update")
|
||||
// public ApiResult<Void> updateQuotationInfo(@Valid @RequestBody QuotationInfoUpdateRequest request) {
|
||||
// QuotationShoppingOrder order = shoppingOrderService.getById(request.getId());
|
||||
// VUtils.trueThrowBusinessError(Objects.isNull(order)).throwMessage("未找到报价单");
|
||||
// shoppingOrderService.lambdaUpdate()
|
||||
// .set(QuotationShoppingOrder::getEffectiveStartTime, request.getEffectiveStartTime())
|
||||
// .set(QuotationShoppingOrder::getEffectiveEndTime, request.getEffectiveEndTime())
|
||||
// .set(QuotationShoppingOrder::getUpdateTime, LocalDateTime.now())
|
||||
// .eq(QuotationShoppingOrder::getId, request.getId())
|
||||
// .update();
|
||||
// return ApiResult.success();
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 报价单-复制报价单
|
||||
|
|
@ -681,34 +759,59 @@ public class ShoppingController extends ControllerBase {
|
|||
// }
|
||||
|
||||
/**
|
||||
* 报价单-调价
|
||||
* 报价单-调价或者调整有效期
|
||||
*/
|
||||
@Transactional
|
||||
@PostMapping("/quotation/updatePrice")
|
||||
public ApiResult<Void> updateQuotationPrice(@Valid @RequestBody QuotationPriceUpdateRequest request) {
|
||||
QuotationShoppingOrder order = shoppingOrderService.getById(request.getId());
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(order)).throwMessage("未找到报价单");
|
||||
request.getItems().forEach(item -> {
|
||||
shoppingOrderItemService.lambdaUpdate()
|
||||
.set(QuotationShoppingOrderItem::getStandardFee, item.getNewStandardFee())
|
||||
.eq(QuotationShoppingOrderItem::getCartId, item.getCartId())
|
||||
.eq(QuotationShoppingOrderItem::getOrderId, request.getId())
|
||||
.update();
|
||||
});
|
||||
shoppingOrderAdjustService.save(new QuotationShoppingOrderAdjust()
|
||||
.setOrderId(request.getId())
|
||||
.setDiscount(request.getItems()
|
||||
.stream()
|
||||
.map(it -> it.getOldStandardFee().subtract(it.getNewStandardFee()))
|
||||
.reduce(BigDecimal::add)
|
||||
.get()
|
||||
)
|
||||
.setActualFee(request.getActualFee())
|
||||
.setCreateTime(LocalDateTime.now())
|
||||
);
|
||||
if (Objects.nonNull(request.getActualFee())) {
|
||||
VUtils.trueThrowBusinessError(StrUtil.isBlank(request.getReason())).throwMessage("请填写调价原因");
|
||||
VUtils.trueThrowBusinessError(CollectionUtil.isEmpty(request.getItems())).throwMessage("缺少调价详情");
|
||||
QuotationShoppingOrderAdjust adjust = new QuotationShoppingOrderAdjust()
|
||||
.setId(IdUtil.getId())
|
||||
.setOrderId(order.getId())
|
||||
.setDiscount(order.getActualFee().subtract(request.getActualFee()))
|
||||
.setActualFee(request.getActualFee())
|
||||
.setReason(request.getReason())
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
order.setActualFee(request.getActualFee());
|
||||
List<QuotationShoppingOrderAdjustItem> adjustItems = new ArrayList<>();
|
||||
request.getItems().forEach(item -> {
|
||||
if (Objects.nonNull(item.getNewStandardFee())) {
|
||||
adjustItems.add(
|
||||
new QuotationShoppingOrderAdjustItem()
|
||||
.setAdjustId(adjust.getId())
|
||||
.setOrderId(order.getId())
|
||||
.setCartId(item.getCartId())
|
||||
.setConfigItemId(0L)
|
||||
.setOldFee(item.getOldStandardFee())
|
||||
.setNewFee(item.getNewStandardFee())
|
||||
);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(item.getParts())) {
|
||||
item.getParts().forEach(part -> {
|
||||
adjustItems.add(
|
||||
new QuotationShoppingOrderAdjustItem()
|
||||
.setAdjustId(adjust.getId())
|
||||
.setOrderId(order.getId())
|
||||
.setCartId(item.getCartId())
|
||||
.setConfigItemId(part.getConfigItemId())
|
||||
.setOldFee(part.getOldStandardFee())
|
||||
.setNewFee(part.getNewStandardFee())
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
shoppingOrderAdjustItemService.saveBatch(adjustItems);
|
||||
shoppingOrderAdjustService.save(adjust);
|
||||
}
|
||||
shoppingOrderService.lambdaUpdate()
|
||||
.set(QuotationShoppingOrder::getActualFee, request.getActualFee())
|
||||
.set(QuotationShoppingOrder::getDiscount, order.getTotalFee().subtract(request.getActualFee()))
|
||||
.set(Objects.nonNull(request.getActualFee()), QuotationShoppingOrder::getActualFee, request.getActualFee())
|
||||
.set(Objects.nonNull(request.getActualFee()), QuotationShoppingOrder::getDiscount, order.getTotalFee().subtract(request.getActualFee()))
|
||||
.set(QuotationShoppingOrder::getEffectiveEndTime, DateTimeUtil.format(request.getEffectiveEndTime(), "yyyy-MM-dd"))
|
||||
.set(StrUtil.isNotBlank(request.getAddress()), QuotationShoppingOrder::getAddress, request.getAddress())
|
||||
.set(QuotationShoppingOrder::getUpdateTime, LocalDateTime.now())
|
||||
.eq(QuotationShoppingOrder::getId, request.getId())
|
||||
.update();
|
||||
|
|
@ -719,41 +822,46 @@ public class ShoppingController extends ControllerBase {
|
|||
* 报价单-导出PDF
|
||||
*/
|
||||
@GetMapping("/quotation/exportToPdf")
|
||||
public void exportToPdf(HttpServletResponse response, @RequestParam @NotNull(message = "报价单id不能为空") Long id) {
|
||||
public ResponseEntity<org.springframework.core.io.Resource> exportToPdf(HttpServletResponse response, @RequestParam @NotNull(message = "报价单id不能为空") Long id) {
|
||||
// QuotationShoppingOrder order = shoppingOrderService.getById(id);
|
||||
// VUtils.trueThrowBusinessError(Objects.isNull(order)).throwMessage("未找到报价单");
|
||||
Map<String, Object> order = new HashMap<>();
|
||||
order.put("no", "DFENNIKFWE562D");
|
||||
Map<String, Object> variables = new HashMap<>();
|
||||
variables.put("info", order);
|
||||
// 渲染HTML
|
||||
TemplateEngine templateEngine = new TemplateEngine();
|
||||
ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
|
||||
resolver.setPrefix("/templates/");
|
||||
resolver.setSuffix(".html");
|
||||
templateEngine.setTemplateResolver(resolver);
|
||||
|
||||
Context context = new Context();
|
||||
context.setVariables(variables);
|
||||
String html = templateEngine.process("pdf.html", context);
|
||||
|
||||
response.setContentType(MediaType.APPLICATION_PDF_VALUE);
|
||||
String encode = URLEncoder.encode("aaaa" + ".pdf", StandardCharsets.UTF_8);
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "inline;filename=" + encode);
|
||||
// 生成PDF
|
||||
try {
|
||||
ITextRenderer renderer = new ITextRenderer();
|
||||
renderer.getFontResolver().addFont("fonts/simsun.ttc", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
|
||||
URL baseUrl = new ClassPathResource("templates/").getURL();
|
||||
renderer.setDocumentFromString(html, baseUrl.toString());
|
||||
renderer.layout();
|
||||
try (OutputStream outputStream = response.getOutputStream()) {
|
||||
renderer.createPDF(outputStream);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("生成pdf出错", e);
|
||||
throw new NflgException(STATE.BusinessError, "生成pdf出错");
|
||||
}
|
||||
// Map<String, Object> order = new HashMap<>();
|
||||
// order.put("no", "DFENNIKFWE562D");
|
||||
// Map<String, Object> variables = new HashMap<>();
|
||||
// variables.put("info", order);
|
||||
// // 渲染HTML
|
||||
// TemplateEngine templateEngine = new TemplateEngine();
|
||||
// ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
|
||||
// resolver.setPrefix("/templates/");
|
||||
// resolver.setSuffix(".html");
|
||||
// templateEngine.setTemplateResolver(resolver);
|
||||
//
|
||||
// Context context = new Context();
|
||||
// context.setVariables(variables);
|
||||
// String html = templateEngine.process("pdf.html", context);
|
||||
//
|
||||
// response.setContentType(MediaType.APPLICATION_PDF_VALUE);
|
||||
// String encode = URLEncoder.encode("aaaa" + ".pdf", StandardCharsets.UTF_8);
|
||||
// response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "inline;filename=" + encode);
|
||||
// // 生成PDF
|
||||
// try {
|
||||
// ITextRenderer renderer = new ITextRenderer();
|
||||
// renderer.getFontResolver().addFont("fonts/simsun.ttc", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
|
||||
// URL baseUrl = new ClassPathResource("templates/").getURL();
|
||||
// renderer.setDocumentFromString(html, baseUrl.toString());
|
||||
// renderer.layout();
|
||||
// try (OutputStream outputStream = response.getOutputStream()) {
|
||||
// renderer.createPDF(outputStream);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("生成pdf出错", e);
|
||||
// throw new NflgException(STATE.BusinessError, "生成pdf出错");
|
||||
// }
|
||||
org.springframework.core.io.Resource resource = new ClassPathResource("templates/demo.pdf");
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_PDF)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, "inline; filename=\"demo.pdf\"")
|
||||
.body(resource);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -771,7 +879,10 @@ public class ShoppingController extends ControllerBase {
|
|||
@PostMapping("/validatePassword")
|
||||
public ApiResult<Boolean> validatePassword(@RequestBody String password) {
|
||||
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)) {
|
||||
pwd = "000000";
|
||||
}
|
||||
if (!PASSWORDENCODER.matches(password, pwd.toString())) {
|
||||
return ApiResult.error("查看密码不正确");
|
||||
}
|
||||
|
|
@ -880,4 +991,12 @@ public class ShoppingController extends ControllerBase {
|
|||
.header(HttpHeaders.CONTENT_DISPOSITION, "inline; filename=\"demo.pdf\"")
|
||||
.body(resource);
|
||||
}
|
||||
|
||||
private String getQuotationCode() {
|
||||
if (AppUserUtil.isAgent()) {
|
||||
return appUserService.getById(AppUserUtil.getUserId()).getQuotationCode();
|
||||
} else {
|
||||
return adminUserService.getById(AppUserUtil.getUserId()).getQuotationCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.nflg.mobilebroken.quotation.pojo.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class QuotationPriceUpdateItemPartRequest {
|
||||
|
||||
/**
|
||||
* 配置项id
|
||||
*/
|
||||
@NotNull
|
||||
private Long configItemId;
|
||||
|
||||
/**
|
||||
* 标准配置调价前价格
|
||||
*/
|
||||
@NotNull
|
||||
private BigDecimal oldStandardFee;
|
||||
|
||||
/**
|
||||
* 标准配置调价后价格
|
||||
*/
|
||||
@NotNull
|
||||
private BigDecimal newStandardFee;
|
||||
}
|
||||
|
|
@ -2,8 +2,10 @@ package com.nflg.mobilebroken.quotation.pojo.request;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class QuotationPriceUpdateItemRequest {
|
||||
|
|
@ -15,14 +17,18 @@ public class QuotationPriceUpdateItemRequest {
|
|||
private Long cartId;
|
||||
|
||||
/**
|
||||
* 调价前价格
|
||||
* 标准配置调价前价格
|
||||
*/
|
||||
@NotNull
|
||||
private BigDecimal oldStandardFee;
|
||||
|
||||
/**
|
||||
* 调价后价格
|
||||
* 标准配置调价后价格
|
||||
*/
|
||||
@NotNull
|
||||
private BigDecimal newStandardFee;
|
||||
|
||||
/**
|
||||
* 选配调价
|
||||
*/
|
||||
@Valid
|
||||
List<QuotationPriceUpdateItemPartRequest> parts;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,12 @@ package com.nflg.mobilebroken.quotation.pojo.request;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
|
@ -18,6 +21,25 @@ public class QuotationPriceUpdateRequest {
|
|||
*/
|
||||
private BigDecimal actualFee;
|
||||
|
||||
@NotEmpty
|
||||
/**
|
||||
* 调价原因
|
||||
*/
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 报价失效时间
|
||||
*/
|
||||
@NotNull
|
||||
private LocalDate effectiveEndTime;
|
||||
|
||||
/**
|
||||
* 报价公司地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 调价详情
|
||||
*/
|
||||
@Valid
|
||||
private List<QuotationPriceUpdateItemRequest> items;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.nflg.mobilebroken.quotation.pojo.request;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
|
@ -11,7 +12,7 @@ public class ShoppingInitRequest {
|
|||
/**
|
||||
* 机型ID
|
||||
*/
|
||||
@NotNull
|
||||
@JsonIgnore
|
||||
private Long modelId;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.nflg.mobilebroken.quotation.pojo.request;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
|
|
@ -10,11 +11,13 @@ public class ShoppingSavePartRequest {
|
|||
/**
|
||||
* 配置项id
|
||||
*/
|
||||
@NotNull
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否选择
|
||||
*/
|
||||
@NotNull
|
||||
private Boolean hasSelect;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ public class ShoppingSaveRequest {
|
|||
/**
|
||||
* 部件列表
|
||||
*/
|
||||
@Valid
|
||||
@NotEmpty
|
||||
private List<ShoppingSavePartRequest> parts;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,16 @@ public class QuotationOrderInfoVO {
|
|||
*/
|
||||
private Integer targetId;
|
||||
|
||||
/**
|
||||
* 报价人代码
|
||||
*/
|
||||
private String quotationCode;
|
||||
|
||||
/**
|
||||
* 报价总价,汇率计算后的价格
|
||||
*/
|
||||
private BigDecimal exchangeFee;
|
||||
|
||||
/**
|
||||
* 优惠金额
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nflg.mobilebroken.quotation.pojo.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.nflg.mobilebroken.common.util.IdUtil;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
|
@ -13,6 +14,11 @@ import java.util.Objects;
|
|||
@Accessors(chain = true)
|
||||
public class RatioConfigSearchVO {
|
||||
|
||||
/**
|
||||
* 唯一标识
|
||||
*/
|
||||
private String key = IdUtil.getIdStr();
|
||||
|
||||
/**
|
||||
* 机型编号
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,15 @@
|
|||
package com.nflg.mobilebroken.quotation.pojo.vo;
|
||||
|
||||
import com.nflg.mobilebroken.quotation.pojo.request.ShoppingSaveAccessoryRequest;
|
||||
import com.nflg.mobilebroken.quotation.pojo.request.ShoppingSavePartRequest;
|
||||
import com.nflg.mobilebroken.quotation.pojo.request.ShoppingSaveServiceRequest;
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationShoppingCartAccessory;
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationShoppingCartService;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
|
@ -182,4 +189,14 @@ public class ShoppingCartVO {
|
|||
* 可选配置
|
||||
*/
|
||||
private List<ShoppingCartPartVO> optionalParts;
|
||||
|
||||
/**
|
||||
* 随机配件
|
||||
*/
|
||||
private List<QuotationShoppingCartAccessory> accessories;
|
||||
|
||||
/**
|
||||
* 交机服务
|
||||
*/
|
||||
private List<QuotationShoppingCartService> services;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.nflg.mobilebroken.quotation.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ShoppingOrderAdjustModelPartVO {
|
||||
|
||||
/**
|
||||
* 配置名称
|
||||
*/
|
||||
private String partName;
|
||||
|
||||
/**
|
||||
* 调价前价格
|
||||
*/
|
||||
private BigDecimal oldFee;
|
||||
|
||||
/**
|
||||
* 调价后价格
|
||||
*/
|
||||
private BigDecimal newFee;
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.nflg.mobilebroken.quotation.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ShoppingOrderAdjustModelVO {
|
||||
|
||||
/**
|
||||
* 机型
|
||||
*/
|
||||
private String modelNo;
|
||||
|
||||
/**
|
||||
* 调价前标准价格
|
||||
*/
|
||||
private BigDecimal oldFee;
|
||||
|
||||
/**
|
||||
* 调价后标准价格
|
||||
*/
|
||||
private BigDecimal newFee;
|
||||
|
||||
/**
|
||||
* 可选配置列表
|
||||
*/
|
||||
private List<ShoppingOrderAdjustModelPartVO> parts;
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.nflg.mobilebroken.quotation.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ShoppingOrderAdjustVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 优惠金额
|
||||
*/
|
||||
private BigDecimal discount;
|
||||
|
||||
/**
|
||||
* 实际总价
|
||||
*/
|
||||
private BigDecimal actualFee;
|
||||
|
||||
/**
|
||||
* 调价原因
|
||||
*/
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 机型列表
|
||||
*/
|
||||
private List<ShoppingOrderAdjustModelVO> models=new ArrayList<>();
|
||||
}
|
||||
|
|
@ -56,6 +56,11 @@ public class QuotationShoppingOrder implements Serializable {
|
|||
*/
|
||||
private BigDecimal actualFee;
|
||||
|
||||
/**
|
||||
* 报价总价,汇率计算后的价格
|
||||
*/
|
||||
private BigDecimal exchangeFee;
|
||||
|
||||
/**
|
||||
* 报价生效时间
|
||||
*/
|
||||
|
|
@ -66,6 +71,16 @@ public class QuotationShoppingOrder implements Serializable {
|
|||
*/
|
||||
private String effectiveEndTime;
|
||||
|
||||
/**
|
||||
* 报价人代码
|
||||
*/
|
||||
private String quotationCode;
|
||||
|
||||
/**
|
||||
* 报价公司地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 创建人类型,0:内部人员;1:代理商
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -41,6 +41,11 @@ public class QuotationShoppingOrderAdjust implements Serializable {
|
|||
*/
|
||||
private BigDecimal actualFee;
|
||||
|
||||
/**
|
||||
* 调价原因
|
||||
*/
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
package com.nflg.mobilebroken.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报价-报价单-子项
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
@TableName("quotation_shopping_order_item")
|
||||
public class QuotationShoppingOrderItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 报价单id
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 购物车id
|
||||
*/
|
||||
private Long cartId;
|
||||
|
||||
/**
|
||||
* 标配价格,调价后价格
|
||||
*/
|
||||
private BigDecimal standardFee;
|
||||
}
|
||||
|
|
@ -16,5 +16,5 @@ import java.util.List;
|
|||
*/
|
||||
public interface QuotationShoppingCartItemMapper extends BaseMapper<QuotationShoppingCartItem> {
|
||||
|
||||
List<ModelConfigEffectiveDTO> getSelectedParts(Long id,String language);
|
||||
List<ModelConfigEffectiveDTO> getParts(Long id, String language);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,5 +17,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
*/
|
||||
public interface QuotationShoppingCartMapper extends BaseMapper<QuotationShoppingCart> {
|
||||
|
||||
IPage<ShoppingSearchVO> search(ShoppingSearchRequest request, String language, Page<?> page);
|
||||
IPage<ShoppingSearchVO> search(ShoppingSearchRequest request,Integer userType, Integer userId, String language, Page<?> page);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
package com.nflg.mobilebroken.repository.mapper;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationShoppingOrderItem;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报价-报价单-子项 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
public interface QuotationShoppingOrderItemMapper extends BaseMapper<QuotationShoppingOrderItem> {
|
||||
|
||||
}
|
||||
|
|
@ -16,5 +16,5 @@ import java.util.List;
|
|||
*/
|
||||
public interface IQuotationShoppingCartItemService extends IService<QuotationShoppingCartItem> {
|
||||
|
||||
List<ModelConfigEffectiveDTO> getSelectedParts(Long id,String language);
|
||||
List<ModelConfigEffectiveDTO> getParts(Long id, String language);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,5 +19,5 @@ import javax.validation.Valid;
|
|||
*/
|
||||
public interface IQuotationShoppingCartService extends IService<QuotationShoppingCart> {
|
||||
|
||||
IPage<ShoppingSearchVO> search(ShoppingSearchRequest request, String language);
|
||||
IPage<ShoppingSearchVO> search(ShoppingSearchRequest request,Integer userType, Integer userId, String language);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
package com.nflg.mobilebroken.repository.service;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationShoppingOrderItem;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报价-报价单-子项 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
public interface IQuotationShoppingOrderItemService extends IService<QuotationShoppingOrderItem> {
|
||||
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ import java.util.List;
|
|||
public class QuotationShoppingCartItemServiceImpl extends ServiceImpl<QuotationShoppingCartItemMapper, QuotationShoppingCartItem> implements IQuotationShoppingCartItemService {
|
||||
|
||||
@Override
|
||||
public List<ModelConfigEffectiveDTO> getSelectedParts(Long id,String language) {
|
||||
return baseMapper.getSelectedParts(id,language);
|
||||
public List<ModelConfigEffectiveDTO> getParts(Long id, String language) {
|
||||
return baseMapper.getParts(id,language);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import org.springframework.stereotype.Service;
|
|||
public class QuotationShoppingCartServiceImpl extends ServiceImpl<QuotationShoppingCartMapper, QuotationShoppingCart> implements IQuotationShoppingCartService {
|
||||
|
||||
@Override
|
||||
public IPage<ShoppingSearchVO> search(ShoppingSearchRequest request, String language) {
|
||||
return baseMapper.search(request, language,new Page<>(request.getPage(), request.getPageSize()));
|
||||
public IPage<ShoppingSearchVO> search(ShoppingSearchRequest request,Integer userType, Integer userId, String language) {
|
||||
return baseMapper.search(request, userType, userId, language,new Page<>(request.getPage(), request.getPageSize()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
package com.nflg.mobilebroken.repository.service.impl;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationShoppingOrderItem;
|
||||
import com.nflg.mobilebroken.repository.mapper.QuotationShoppingOrderItemMapper;
|
||||
import com.nflg.mobilebroken.repository.service.IQuotationShoppingOrderItemService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报价-报价单-子项 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
@Service
|
||||
public class QuotationShoppingOrderItemServiceImpl extends ServiceImpl<QuotationShoppingOrderItemMapper, QuotationShoppingOrderItem> implements IQuotationShoppingOrderItemService {
|
||||
|
||||
}
|
||||
|
|
@ -2,12 +2,14 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nflg.mobilebroken.repository.mapper.QuotationShoppingCartItemMapper">
|
||||
|
||||
<select id="getSelectedParts" resultType="com.nflg.mobilebroken.common.pojo.dto.ModelConfigEffectiveDTO">
|
||||
SELECT qmci.id,qmci.parent_id,qmcil.part_name,qmcil.part_remark,qmci.image_url,qsci.amount,qmci.type,qmci.optional_type
|
||||
<select id="getParts" resultType="com.nflg.mobilebroken.common.pojo.dto.ModelConfigEffectiveDTO">
|
||||
SELECT qmci.id,qmci.parent_id,qmcil.part_name,qmcil.part_remark,qmci.image_url,IFNULL(vqsoai.new_fee,qsci.amount) as amount
|
||||
,qmci.type,qmci.optional_type,qsci.has_select
|
||||
FROM quotation_shopping_cart_item qsci
|
||||
INNER JOIN quotation_model_config_item qmci ON qmci.id=qsci.config_item_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
|
||||
WHERE qsci.cart_id=#{id} AND qsci.has_select=1 AND l.`code`=#{language}
|
||||
LEFT JOIN v_quotation_shopping_order_adjust_item vqsoai ON qsci.cart_id=vqsoai.cart_id AND vqsoai.config_item_id=qsci.config_item_id
|
||||
WHERE qsci.cart_id=#{id} AND l.`code`=#{language}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
LEFT JOIN product_series_info psi ON psi.series_id=ps.id AND psi.language_code=#{language}
|
||||
LEFT JOIN product_type pt on pm.type_number=pt.batch_number AND pt.state=1 and pt.enable=1
|
||||
LEFT JOIN product_type_info pti ON pti.type_id=pt.id AND pti.language_code=#{language}
|
||||
WHERE qsc.`status`=0
|
||||
WHERE qsc.`status`=0 and qsc.create_by_type=#{userType} and qsc.create_by_id=#{userId}
|
||||
<if test="request.moduleId!=null">
|
||||
AND pm.module_id=#{request.moduleId}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nflg.mobilebroken.repository.mapper.QuotationShoppingOrderItemMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -33,7 +33,7 @@ public class CodeGeneratorTest {
|
|||
, Paths.get(System.getProperty("user.dir")) + "/src/main/resources/mapper"))
|
||||
)
|
||||
.strategyConfig(builder -> {
|
||||
builder.addInclude("quotation_shopping_order_adjust") //只生成指定表
|
||||
builder.addInclude("quotation_shopping_order_adjust_item") //只生成指定表
|
||||
.entityBuilder()
|
||||
.enableLombok()
|
||||
.enableChainModel()
|
||||
|
|
|
|||
Loading…
Reference in New Issue