优化 下单显示产品类型
This commit is contained in:
parent
eb1748ff79
commit
1b6949baf8
|
|
@ -43,6 +43,12 @@ public class SaleOrderEntryItemDTO implements Serializable {
|
|||
* 产品名称
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 产品类型名称
|
||||
*/
|
||||
private String productTypeName;
|
||||
|
||||
/**
|
||||
* 产品封面
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import cn.hangtag.module.oms.dal.mysql.productprocess.ProductProcessMapper;
|
|||
import cn.hangtag.module.oms.serialnumber.CodingRulesUtils;
|
||||
import cn.hangtag.module.oms.service.brand.BrandService;
|
||||
import cn.hangtag.module.oms.service.draftdesigndata.DraftDesignDataService;
|
||||
import cn.hangtag.module.oms.service.productprocess.ProductProcessService;
|
||||
import cn.hutool.cache.CacheUtil;
|
||||
import cn.hutool.cache.impl.LFUCache;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
|
|
@ -69,6 +70,8 @@ public class ProductInfoServiceImpl implements ProductInfoService {
|
|||
private final BrandService brandService;
|
||||
private final DraftDesignDataService draftDesignDataService;
|
||||
private final DraftDesignDataMapper draftDesignDataMapper;
|
||||
|
||||
private static final int TMP_CACHE_TIME = 1000 * 60 * 10;
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createProductInfo(ProductInfoSaveReqVO createReqVO) {
|
||||
|
|
@ -173,7 +176,12 @@ public class ProductInfoServiceImpl implements ProductInfoService {
|
|||
|
||||
@Override
|
||||
public ProductInfoDO getProductInfo(Long id) {
|
||||
return productInfoMapper.selectById(id);
|
||||
ProductInfoDO productInfoDO = productInfoMapper.selectById(id);
|
||||
if(FuncUtil.isNotEmpty(productInfoDO)){
|
||||
productInfoDO.setProductTypeName(togProductTypeName(productInfoDO.getProductTypeId()));
|
||||
}
|
||||
|
||||
return productInfoDO;
|
||||
}
|
||||
@Override
|
||||
public ProductInfoRespVO getFrontProductInfo(Long id) {
|
||||
|
|
@ -507,7 +515,7 @@ public class ProductInfoServiceImpl implements ProductInfoService {
|
|||
}
|
||||
return vo;
|
||||
}
|
||||
private static LFUCache<String, String> CustomerGroupNameCache = CacheUtil.newLFUCache(10000, 1000 * 60 * 60);
|
||||
private static LFUCache<String, String> CustomerGroupNameCache = CacheUtil.newLFUCache(10000, TMP_CACHE_TIME);
|
||||
|
||||
private ProductInfoRespVO wrapperCustomerGroupName(ProductInfoRespVO vo){
|
||||
if(FuncUtil.isNotEmpty(vo)){
|
||||
|
|
@ -564,26 +572,29 @@ public class ProductInfoServiceImpl implements ProductInfoService {
|
|||
|
||||
}
|
||||
|
||||
private static LFUCache<Long, String> ProductTypeNameCache = CacheUtil.newLFUCache(10000, 1000 * 60 * 60);
|
||||
private static LFUCache<Long, String> ProductTypeNameCache = CacheUtil.newLFUCache(10000, TMP_CACHE_TIME);
|
||||
private ProductInfoRespVO wrapperProductTypeName(ProductInfoRespVO vo){
|
||||
if(FuncUtil.isNotEmpty(vo)){
|
||||
if(FuncUtil.isNotEmpty(vo.getProductTypeId())){
|
||||
String s = ProductTypeNameCache.get(vo.getProductTypeId());
|
||||
if (FuncUtil.isNotEmpty(s)){
|
||||
vo.setProductTypeName(s);
|
||||
}else {
|
||||
ProductTypeDO productTypeDO = productTypeMapper.selectById(vo.getProductTypeId());
|
||||
if(FuncUtil.isNotEmpty(productTypeDO)){
|
||||
vo.setProductTypeName(productTypeDO.getLabel());
|
||||
ProductTypeNameCache.put(vo.getProductTypeId(), vo.getProductTypeName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
vo.setProductTypeName(togProductTypeName(vo.getProductTypeId()));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
private static LFUCache<String,Long> ProductTypeIdCache = CacheUtil.newLFUCache(10000, 1000 * 60 * 60);
|
||||
private String togProductTypeName(Long productTypeId){
|
||||
if(FuncUtil.isNotEmpty(productTypeId)){
|
||||
String s = ProductTypeNameCache.get(productTypeId);
|
||||
if (FuncUtil.isNotEmpty(s)){
|
||||
return s;
|
||||
}else {
|
||||
ProductTypeDO productTypeDO = productTypeMapper.selectById(productTypeId);
|
||||
if(FuncUtil.isNotEmpty(productTypeDO)){
|
||||
ProductTypeNameCache.put(productTypeId, productTypeDO.getLabel());
|
||||
return productTypeDO.getLabel();
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
private static LFUCache<String,Long> ProductTypeIdCache = CacheUtil.newLFUCache(10000, TMP_CACHE_TIME);
|
||||
|
||||
private Long toProductTypeId(String name){
|
||||
if(FuncUtil.isEmpty(name)){
|
||||
|
|
@ -612,7 +623,7 @@ public class ProductInfoServiceImpl implements ProductInfoService {
|
|||
}
|
||||
|
||||
|
||||
private static LFUCache<Long, String> brandNameCache = CacheUtil.newLFUCache(10000, 1000 * 60 * 60);
|
||||
private static LFUCache<Long, String> brandNameCache = CacheUtil.newLFUCache(10000, TMP_CACHE_TIME);
|
||||
private ProductInfoRespVO wrapperBrandName(ProductInfoRespVO vo){
|
||||
if(FuncUtil.isNotEmpty(vo)){
|
||||
if(FuncUtil.isNotEmpty(vo.getBrandId())){
|
||||
|
|
|
|||
|
|
@ -1199,6 +1199,8 @@ public class SaleOrderServiceImpl implements SaleOrderService {
|
|||
SaleOrderSkuDTO toSaleOrderSkuDTO = new SaleOrderSkuDTO(saleOrderSkuDO);
|
||||
skus.add(toSaleOrderSkuDTO);
|
||||
}
|
||||
|
||||
dto.setProductTypeName( productInfo.getProductTypeName());
|
||||
dto.setProductSkuList(skus);
|
||||
saleOrderEntry.add(dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -674,6 +674,7 @@ export default {
|
|||
"btnDel": "Delete",
|
||||
"labelColProductCode": "Product Code",
|
||||
"labelColProductName": "Product Name",
|
||||
"labelColProductTypeName": 'Product Type',
|
||||
"labelColProducer": "Producer",
|
||||
"labelColProductDetails": "Product Description",
|
||||
"labelColProductPicture": "Product Picture",
|
||||
|
|
|
|||
|
|
@ -670,6 +670,7 @@ export default {
|
|||
btnDel: '删除',
|
||||
labelColProductCode: '产品编码',
|
||||
labelColProductName: '产品名称',
|
||||
labelColProductTypeName: '产品类型',
|
||||
labelColProducer: '生产者',
|
||||
labelColProductDetails: '产品描述',
|
||||
labelColProductPicture: '产品图片',
|
||||
|
|
|
|||
|
|
@ -688,7 +688,7 @@ const submitPreHandler = (showMsg = true) => {
|
|||
item.productSkuList.forEach((item2, i2) => {
|
||||
console.log("item2",item2)
|
||||
if (item2.productTemplateType === '1' && !item2.previewImage) {
|
||||
const t = `${("createOrder.tipsSkuError3")} ${index + 1} ‘${item.productName}’SKU ${i2 + 1}`;
|
||||
const t = `${t("createOrder.tipsSkuError3")} ${index + 1} ‘${item.productName}’SKU ${i2 + 1}`;
|
||||
if (showMsg) {
|
||||
useMessage().warning(t)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue