Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -5,11 +5,14 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
||||
import com.alibaba.excel.write.merge.OnceAbsoluteMergeStrategy;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
import com.czg.constant.CacheConstant;
|
||||
import com.czg.constants.SystemConstants;
|
||||
import com.czg.excel.ExcelExportUtil;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.product.dto.*;
|
||||
import com.czg.product.entity.*;
|
||||
@@ -30,6 +33,7 @@ import com.mybatisflex.core.update.UpdateChain;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
@@ -65,7 +69,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
private final ProdSkuMapper prodSkuMapper;
|
||||
private final ProdConsRelationMapper prodConsRelationMapper;
|
||||
private final ConsInfoMapper consInfoMapper;
|
||||
private final ConsStockFlowMapper consStockFlowMapper;
|
||||
private final ProductStockFlowMapper productStockFlowMapper;
|
||||
private final ProductStockFlowService productStockFlowService;
|
||||
private final ConsStockFlowService consStockFlowService;
|
||||
@@ -175,6 +178,57 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
return records;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportProductList(ProductDTO param, HttpServletResponse response) {
|
||||
QueryWrapper queryWrapper = buildFullQueryWrapper(param);
|
||||
List<ProductDTO> records = super.listAs(queryWrapper, ProductDTO.class);
|
||||
buildProductExtInfo(records);
|
||||
|
||||
List<SheetWriteHandler> handlers = new ArrayList<>();
|
||||
|
||||
List<ProductExportDTO> dataList = new ArrayList<>();
|
||||
records.forEach(exportDTO -> {
|
||||
int first = dataList.size() + 1;
|
||||
if (exportDTO.getSkuList() != null && !exportDTO.getSkuList().isEmpty()) {
|
||||
exportDTO.getSkuList().forEach(sku -> {
|
||||
ProductExportDTO dto = new ProductExportDTO();
|
||||
BeanUtil.copyProperties(exportDTO, dto);
|
||||
dto.setSpecFullName(sku.getSpecInfo());
|
||||
dto.setPrice(sku.getSalePrice());
|
||||
dto.setMemberPrice(sku.getMemberPrice());
|
||||
dto.setIsSale(sku.getIsGrounding());
|
||||
dto.setBarCode(sku.getBarCode());
|
||||
dataList.add(dto);
|
||||
});
|
||||
|
||||
if (exportDTO.getSkuList().size() > 1) {
|
||||
OnceAbsoluteMergeStrategy name = new OnceAbsoluteMergeStrategy(first, first + exportDTO.getSkuList().size() - 1, 0, 0);
|
||||
handlers.add(name);
|
||||
OnceAbsoluteMergeStrategy category = new OnceAbsoluteMergeStrategy(first, first + exportDTO.getSkuList().size() - 1, 1, 1);
|
||||
handlers.add(category);
|
||||
OnceAbsoluteMergeStrategy unit = new OnceAbsoluteMergeStrategy(first, first + exportDTO.getSkuList().size() - 1, 6, 6);
|
||||
handlers.add(unit);
|
||||
OnceAbsoluteMergeStrategy type = new OnceAbsoluteMergeStrategy(first, first + exportDTO.getSkuList().size() - 1, 7, 7);
|
||||
handlers.add(type);
|
||||
OnceAbsoluteMergeStrategy groupType = new OnceAbsoluteMergeStrategy(first, first + exportDTO.getSkuList().size() - 1, 8, 8);
|
||||
handlers.add(groupType);
|
||||
OnceAbsoluteMergeStrategy startTime = new OnceAbsoluteMergeStrategy(first, first + exportDTO.getSkuList().size() - 1, 9, 9);
|
||||
handlers.add(startTime);
|
||||
OnceAbsoluteMergeStrategy endTime = new OnceAbsoluteMergeStrategy(first, first + exportDTO.getSkuList().size() - 1, 10, 10);
|
||||
handlers.add(endTime);
|
||||
OnceAbsoluteMergeStrategy stockNumber = new OnceAbsoluteMergeStrategy(first, first + exportDTO.getSkuList().size() - 1, 11, 11);
|
||||
handlers.add(stockNumber);
|
||||
OnceAbsoluteMergeStrategy createTime = new OnceAbsoluteMergeStrategy(first, first + exportDTO.getSkuList().size() - 1, 12, 12);
|
||||
handlers.add(createTime);
|
||||
}
|
||||
} else {
|
||||
dataList.add(BeanUtil.copyProperties(exportDTO, ProductExportDTO.class));
|
||||
}
|
||||
});
|
||||
|
||||
ExcelExportUtil.exportProductWithMergeToResponse(dataList, ProductExportDTO.class, "商品列表", response, handlers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductDTO> getProductCacheList(ProductDTO param) {
|
||||
Long shopId = param.getShopId();
|
||||
@@ -555,7 +609,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
String type = param.getType();
|
||||
Long id = param.getId();
|
||||
Integer isSale = param.getIsSale();
|
||||
String sensitiveOperation = "";
|
||||
String sensitiveOperation;
|
||||
if (isSale == 1) {
|
||||
sensitiveOperation = "上架";
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user