Merge branch 'master' of https://codeup.aliyun.com/bsdtec/biz-api-cloud
This commit is contained in:
commit
53b7b63da7
27 files changed
+395
-80
No files matched your search
+1
-1
@@ -34,7 +34,7 @@ public class InventoryRecordItemVo {
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 进价
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class SmCgDDEditItemDTO {
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 进价
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public class SmCgDDSaveItemDTO {
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 进价
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class SmCgPlanEditItemDTO {
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 进价
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class SmCgPlanSaveItemDTO {
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 进价
|
||||
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package com.bsd.pjcloud.supermarket.dto.erpspu;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpAuxiliaryCodeEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpUnitEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品spu
|
||||
*
|
||||
* @author zjf
|
||||
* @date 2024-12-23 10:42:43
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("sm_erp_spu")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "商品spu")
|
||||
public class SmErpSpuPageDto extends Model<SmErpSpuPageDto> {
|
||||
|
||||
|
||||
/**
|
||||
* 商品 SPU 编号,自增
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="商品 SPU 编号,自增")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 货号
|
||||
*/
|
||||
@Schema(description="货号")
|
||||
private String productCode;
|
||||
|
||||
/**
|
||||
* 自编码/条码
|
||||
*/
|
||||
@Schema(description="自编码/条码")
|
||||
private String barCode;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@Schema(description="商品名称")
|
||||
private String productName;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 商品详情
|
||||
*/
|
||||
@Schema(description="商品详情")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 商品分类编号
|
||||
*/
|
||||
@Schema(description="商品分类编号")
|
||||
private Long categoryId;
|
||||
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
@Schema(description="排序字段")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 商品状态: 1 上架(开启) 0 下架(禁用) -1 回收
|
||||
*/
|
||||
@Schema(description="商品状态: 1 上架(开启) 0 下架(禁用) -1 回收")
|
||||
private String status;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 商品性质(字典)
|
||||
*/
|
||||
@Schema(description="商品性质(字典)")
|
||||
private String productNature;
|
||||
|
||||
|
||||
/**
|
||||
* 货商id
|
||||
*/
|
||||
@Schema(description="货商id")
|
||||
private Long supplierId;
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -25,7 +25,7 @@ public class InventoryRecordSaveItemDTO {
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 进价
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public class SmErpSupplierImportDto {
|
||||
@ExcelProperty("开户行及帐号")
|
||||
private String bankAccount;
|
||||
|
||||
@ExcelProperty("货商类")
|
||||
@ExcelProperty("货商类别")
|
||||
private String supplierCategory;
|
||||
|
||||
@ExcelProperty("货商地区")
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ public class SmErpCgDdEntity extends Model<SmErpCgDdEntity> {
|
||||
* 出入库数量
|
||||
*/
|
||||
@Schema(description="出入库数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 累计进货数量
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public class SmErpCgDdItemEntity extends Model<SmErpCgDdItemEntity> {
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 进价
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ public class SmErpCgPlanEntity extends Model<SmErpCgPlanEntity> {
|
||||
* 出入库数量
|
||||
*/
|
||||
@Schema(description="出入库数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ public class SmErpCgPlanItemEntity extends Model<SmErpCgPlanItemEntity> {
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 进价
|
||||
|
||||
+4
-3
@@ -1,6 +1,7 @@
|
||||
package com.bsd.pjcloud.supermarket.validarot;
|
||||
|
||||
|
||||
import com.alibaba.excel.util.StringUtils;
|
||||
import com.bsd.pjcloud.supermarket.dto.supplier.SmErpSupplierImportDto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -14,9 +15,9 @@ public class SupplierValidator {
|
||||
if (entity.getSupplierName() == null || entity.getSupplierName().isEmpty()) {
|
||||
errors.add("第" + (rowIndex + 1) + "行: 货商名称不能为空");
|
||||
}
|
||||
// if (entity.getPhone()== null || entity.getPhone().isEmpty()) {
|
||||
// errors.add("第" + (rowIndex + 1) + "行: 电话不能为空");
|
||||
// }
|
||||
if (StringUtils.isBlank(entity.getSupplierCategory())) {
|
||||
errors.add("第" + (rowIndex + 1) + "行: 货商类别不能为空");
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class SmeErpCgDdItemVo {
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 进价
|
||||
|
||||
+4
@@ -85,6 +85,10 @@ public class ErpSpuWithUnitPageVo {
|
||||
private Long supplierId;
|
||||
|
||||
|
||||
@Schema(description="商品性质,1普通商品 2称重商品")
|
||||
private String productNature;
|
||||
|
||||
|
||||
@Schema(description = "包装对象集合对象")
|
||||
private List<ErpUnitVo> erpUnitVos;
|
||||
}
|
||||
+1
-1
@@ -37,7 +37,7 @@ public class SmErpCgPlanItemVo {
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 进价
|
||||
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
package com.bsd.pjcloud.supermarket.vo.erpspu;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpAuxiliaryCodeEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpUnitEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品spu
|
||||
*
|
||||
* @author zjf
|
||||
* @date 2024-12-23 10:42:43
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "商品spu")
|
||||
public class SmErpSpuPageVo {
|
||||
|
||||
|
||||
/**
|
||||
* 商品 SPU 编号,自增
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="商品 SPU 编号,自增")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 货号
|
||||
*/
|
||||
@Schema(description="货号")
|
||||
private String productCode;
|
||||
|
||||
/**
|
||||
* 自编码/条码
|
||||
*/
|
||||
@Schema(description="自编码/条码")
|
||||
private String barCode;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@Schema(description="商品名称")
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@Schema(description="单位")
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 商品分类编号
|
||||
*/
|
||||
@Schema(description="商品分类编号")
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 商品封面图
|
||||
*/
|
||||
@Schema(description="商品封面图")
|
||||
private String picUrl;
|
||||
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
@Schema(description="排序字段")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 商品状态: 1 上架(开启) 0 下架(禁用) -1 回收
|
||||
*/
|
||||
@Schema(description="商品状态: 1 上架(开启) 0 下架(禁用) -1 回收")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 成本单价,单位: 分
|
||||
*/
|
||||
@Schema(description="成本单价,单位: 分")
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Double costPrice;
|
||||
|
||||
/**
|
||||
* 库存
|
||||
*/
|
||||
@Schema(description="库存")
|
||||
private Double stock;
|
||||
|
||||
|
||||
/**
|
||||
* 进价(分为单位)
|
||||
*/
|
||||
@Schema(description="进价(分为单位)")
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer purchasePrice;
|
||||
|
||||
/**
|
||||
* 零售价(分为单位)
|
||||
*/
|
||||
@Schema(description="零售价(分为单位)")
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer retailPrice;
|
||||
|
||||
/**
|
||||
* 商品性质(字典)
|
||||
*/
|
||||
@Schema(description="商品性质(字典)")
|
||||
private String productNature;
|
||||
|
||||
|
||||
/**
|
||||
* 辅助条码id
|
||||
*/
|
||||
@Schema(description="辅助条码id")
|
||||
private String auxiliaryBarcodeId;
|
||||
|
||||
/**
|
||||
* 品牌id
|
||||
*/
|
||||
@Schema(description="品牌id")
|
||||
private Long brandId;
|
||||
|
||||
/**
|
||||
* 货商id
|
||||
*/
|
||||
@Schema(description="货商id")
|
||||
private Long supplierId;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class InventoryRecordItemVo {
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 进价
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public class InventoryRecordPageVo {
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="入库数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 进价
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ public class PDItemVo {
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
|
||||
@Schema(description="盘后总数")
|
||||
|
||||
+1
@@ -91,6 +91,7 @@ public class SmErpCgPlanController {
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @return
|
||||
* todo 迁移到公共接口
|
||||
*/
|
||||
@Operation(summary = "选择商品分页数据" , description = "选择商品分页数据" )
|
||||
@GetMapping("/erpSpuPage" )
|
||||
|
||||
+3
-7
@@ -17,6 +17,7 @@ import com.bsd.pjcloud.supermarket.dto.SupermarketSpuQueryDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockByCodeReqDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.erpspu.SmErpSpuImportDto;
|
||||
import com.bsd.pjcloud.supermarket.dto.erpspu.SmErpSpuPageDto;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpAuxiliaryCodeEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpSpuEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpStockEntity;
|
||||
@@ -82,13 +83,8 @@ public class SmErpSpuController {
|
||||
@Operation(summary = "分页查询" , description = "分页查询" )
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')" )
|
||||
public R getSupermarketSpuPage(@ParameterObject Page page, @ParameterObject SmErpSpuEntity supermarketSpu) {
|
||||
LambdaQueryWrapper<SmErpSpuEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(StringUtils.isNotBlank(supermarketSpu.getProductCode()), SmErpSpuEntity::getProductCode,supermarketSpu.getProductCode());
|
||||
wrapper.eq(StringUtils.isNotBlank(supermarketSpu.getBarCode()), SmErpSpuEntity::getBarCode,supermarketSpu.getBarCode());
|
||||
wrapper.like(StringUtils.isNotBlank(supermarketSpu.getProductName()), SmErpSpuEntity::getProductName,supermarketSpu.getProductName());
|
||||
wrapper.orderByDesc(SmErpSpuEntity::getCreateTime).orderByDesc(SmErpSpuEntity::getId);
|
||||
return R.ok(smErpSpuService.pageScope(page, wrapper));
|
||||
public R getSupermarketSpuPage(@ParameterObject Page page, @ParameterObject SmErpSpuPageDto supermarketSpu) {
|
||||
return R.ok(smErpSpuService.pageScope(page, supermarketSpu));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuQueryDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.erpspu.SmErpSpuPageDto;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpSpuEntity;
|
||||
import com.bsd.pjcloud.supermarket.vo.ad.SpuVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.erpspu.SmErpSpuPageVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.erpspu.SmErpSpuStockExcel;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -47,4 +49,7 @@ public interface SmErpSpuMapper extends PjcloudBaseMapper<SmErpSpuEntity> {
|
||||
|
||||
|
||||
List<SmErpSpuStockExcel> exportSupermarketSpuStockExcel(@Param("supermarketSpu") SmErpSpuEntity supermarketSpu, @Param("ids") Long[] ids,DataScope dataScope);
|
||||
|
||||
|
||||
Page<SmErpSpuPageVo> selectPageXmlByScope(@Param("page") Page page, @Param("supermarketSpuPageDto") SmErpSpuPageDto smErpSpuPageDto,DataScope of);
|
||||
}
|
||||
+3
-2
@@ -10,6 +10,7 @@ import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockByCodeReqDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.cgplan.ErpCgPlanDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.erpspu.SmErpSpuImportDto;
|
||||
import com.bsd.pjcloud.supermarket.dto.erpspu.SmErpSpuPageDto;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpSpuEntity;
|
||||
import com.bsd.pjcloud.supermarket.vo.ad.SmErpSpuDetailsVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.ad.SpuVo;
|
||||
@@ -53,10 +54,10 @@ public interface SmErpSpuService extends IService<SmErpSpuEntity> {
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param wrapper
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
Object pageScope(Page page, LambdaQueryWrapper<SmErpSpuEntity> wrapper);
|
||||
Object pageScope(Page page, SmErpSpuPageDto smErpSpuPageDto);
|
||||
|
||||
/**
|
||||
* 根据条件查询所有数据,app/收银机接口
|
||||
|
||||
+13
-1
@@ -210,12 +210,24 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
.collect(Collectors.toSet());
|
||||
//请求得到所有的userIds
|
||||
Map<Long, SysUser> userMap = remoteUserService.getUserMap(userIds).getData();
|
||||
List<String> processInstanceIds= records.stream().map(SmErpInventoryRecordsEntity::getProcessInstanceId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
// List<String> processInstanceIds= records.stream().map(SmErpInventoryRecordsEntity::getProcessInstanceId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
|
||||
LambdaQueryWrapper<SmErpInventoryRecordsItemEntity> smErpCgPlanItemEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
smErpCgPlanItemEntityLambdaQueryWrapper.in(SmErpInventoryRecordsItemEntity::getInventoryId,planIds);
|
||||
List<SmErpInventoryRecordsItemEntity> cgPlanItemEntities = smErpInventoryRecordsItemMapper.selectList(smErpCgPlanItemEntityLambdaQueryWrapper);
|
||||
|
||||
// 按 inventoryId 分组并计算每个分组的 totalAmount 总和
|
||||
Map<Long, Integer> inventoryTotalAmountMap = cgPlanItemEntities.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
SmErpInventoryRecordsItemEntity::getInventoryId,
|
||||
Collectors.summingInt(SmErpInventoryRecordsItemEntity::getTotalAmount)
|
||||
));
|
||||
// 将计算出的 totalAmount 总和设置回 pageData 的 records 中
|
||||
records.forEach(record -> {
|
||||
Integer totalAmount = inventoryTotalAmountMap.getOrDefault(record.getId(), 0);
|
||||
record.setTotalAmount(totalAmount);
|
||||
});
|
||||
|
||||
Set<Long> erpSpuIds = cgPlanItemEntities.stream().map(SmErpInventoryRecordsItemEntity::getErpSpuId).collect(Collectors.toSet());
|
||||
List<SmErpSpuEntity> smErpSpuEntities = smErpSpuMapper.selectList(new LambdaQueryWrapper<SmErpSpuEntity>().in(SmErpSpuEntity::getId, erpSpuIds));
|
||||
Map<Long,SmErpSpuEntity> spuMap = smErpSpuEntities.stream().collect(Collectors.toMap(SmErpSpuEntity::getId, spu -> spu));
|
||||
|
||||
+34
-21
@@ -3,6 +3,7 @@ package com.bsd.pjcloud.supermarket.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
@@ -18,6 +19,7 @@ import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockByCodeReqDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.cgplan.ErpCgPlanDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.erpspu.SmErpSpuImportDto;
|
||||
import com.bsd.pjcloud.supermarket.dto.erpspu.SmErpSpuPageDto;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.UpdateStockDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.*;
|
||||
import com.bsd.pjcloud.supermarket.mapper.*;
|
||||
@@ -32,6 +34,7 @@ import com.bsd.pjcloud.supermarket.vo.ad.SmErpSpuDetailsVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.ad.SmErpUnitVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.cgplan.ErpSpuWithUnitPageVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.cgplan.ErpUnitVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.erpspu.SmErpSpuPageVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.erpspu.SmErpSpuStockExcel;
|
||||
import com.bsd.pjcloud.supermarket.vo.sm.smspu.SmErpPageScopeVo;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
@@ -495,28 +498,38 @@ public class SmErpSpuServiceImpl extends ServiceImpl<SmErpSpuMapper, SmErpSpuEnt
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object pageScope(Page page, LambdaQueryWrapper<SmErpSpuEntity> wrapper) {
|
||||
Page pageData = baseMapper.selectPageByScope(page, wrapper, DataScope.of());
|
||||
public Object pageScope(Page page, SmErpSpuPageDto smErpSpuPageDto) {
|
||||
// LambdaQueryWrapper<SmErpSpuEntity> wrapper = Wrappers.lambdaQuery();
|
||||
// wrapper.eq(StringUtils.isNotBlank(supermarketSpu.getProductCode()), SmErpSpuEntity::getProductCode,supermarketSpu.getProductCode());
|
||||
// wrapper.eq(StringUtils.isNotBlank(supermarketSpu.getBarCode()), SmErpSpuEntity::getBarCode,supermarketSpu.getBarCode());
|
||||
// wrapper.like(StringUtils.isNotBlank(supermarketSpu.getProductName()), SmErpSpuEntity::getProductName,supermarketSpu.getProductName());
|
||||
// wrapper.eq(null!=supermarketSpu.getCategoryId(), SmErpSpuEntity::getCategoryId,supermarketSpu.getCategoryId());
|
||||
// wrapper.orderByDesc(SmErpSpuEntity::getCreateTime).orderByDesc(SmErpSpuEntity::getId);
|
||||
|
||||
//重构分页
|
||||
Page<SmErpSpuPageVo> pageData=baseMapper.selectPageXmlByScope(page,smErpSpuPageDto , DataScope.of());
|
||||
|
||||
// Page pageData = baseMapper.selectPageByScope(page, wrapper, DataScope.of());
|
||||
//计算库存回显
|
||||
List<SmErpSpuEntity> records = pageData.getRecords();
|
||||
if (CollectionUtils.isNotEmpty(records)) {
|
||||
Set<Long> erpSpuIds = records.stream().map(smErpSpuEntity -> smErpSpuEntity.getId()).collect(Collectors.toSet());
|
||||
|
||||
// 批量查询库存信息
|
||||
List<SmErpStockEntity> stocks = smErpStockMapper.selectList(
|
||||
new LambdaQueryWrapper<SmErpStockEntity>()
|
||||
.in(SmErpStockEntity::getErpSpuId, erpSpuIds));
|
||||
|
||||
// 建立SPU ID与库存的映射关系
|
||||
Map<Long, SmErpStockEntity> stockMap = stocks.stream()
|
||||
.collect(Collectors.toMap(SmErpStockEntity::getErpSpuId, smErpStockEntity -> smErpStockEntity));
|
||||
|
||||
records.forEach(spu ->
|
||||
{
|
||||
SmErpStockEntity smErpStockEntity = stockMap.get(spu.getId());
|
||||
spu.setStock(smErpStockEntity != null ? smErpStockEntity.getCurrentStock() : 0);
|
||||
});
|
||||
}
|
||||
// List<SmErpSpuPageVo> records = pageData.getRecords();
|
||||
// if (CollectionUtils.isNotEmpty(records)) {
|
||||
// Set<Long> erpSpuIds = records.stream().map(smErpSpuEntity -> smErpSpuEntity.getId()).collect(Collectors.toSet());
|
||||
//
|
||||
// // 批量查询库存信息
|
||||
// List<SmErpStockEntity> stocks = smErpStockMapper.selectList(
|
||||
// new LambdaQueryWrapper<SmErpStockEntity>()
|
||||
// .in(SmErpStockEntity::getErpSpuId, erpSpuIds));
|
||||
//
|
||||
// // 建立SPU ID与库存的映射关系
|
||||
// Map<Long, SmErpStockEntity> stockMap = stocks.stream()
|
||||
// .collect(Collectors.toMap(SmErpStockEntity::getErpSpuId, smErpStockEntity -> smErpStockEntity));
|
||||
//
|
||||
// records.forEach(spu ->
|
||||
// {
|
||||
// SmErpStockEntity smErpStockEntity = stockMap.get(spu.getId());
|
||||
// spu.setStock(smErpStockEntity != null ? smErpStockEntity.getCurrentStock() : 0);
|
||||
// });
|
||||
// }
|
||||
|
||||
return pageData;
|
||||
}
|
||||
|
||||
+55
-30
@@ -3,54 +3,27 @@
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.supermarket.mapper.SmErpSpuMapper">
|
||||
|
||||
<resultMap id="supermarketSpuMap" type="com.bsd.pjcloud.supermarket.entity.SmErpSpuEntity">
|
||||
<resultMap id="supermarketSpuMap" type="com.bsd.pjcloud.supermarket.vo.erpspu.SmErpSpuPageVo">
|
||||
<id property="id" column="id"/>
|
||||
<result property="productCode" column="product_code"/>
|
||||
<result property="barcode" column="barcode"/>
|
||||
<result property="barCode" column="bar_code"/>
|
||||
<result property="productName" column="product_name"/>
|
||||
<result property="unit" column="unit"/>
|
||||
<result property="introduction" column="introduction"/>
|
||||
<result property="description" column="description"/>
|
||||
<result property="categoryId" column="category_id"/>
|
||||
<result property="picUrl" column="pic_url"/>
|
||||
<result property="sliderPicUrls" column="slider_pic_urls"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="costPrice" column="cost_price"/>
|
||||
<result property="stock" column="stock"/>
|
||||
<result property="giveIntegral" column="give_integral"/>
|
||||
<result property="merchantId" column="merchant_id"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="spec" column="spec"/>
|
||||
<result property="origin" column="origin"/>
|
||||
<result property="packageNum" column="package_num"/>
|
||||
<result property="purchasePrice" column="purchase_price"/>
|
||||
<result property="retailPrice" column="retail_price"/>
|
||||
<result property="memberPrice1" column="member_price1"/>
|
||||
<result property="memberPrice2" column="member_price2"/>
|
||||
<result property="memberPrice3" column="member_price3"/>
|
||||
<result property="wholesalePrice1" column="wholesale_price1"/>
|
||||
<result property="wholesalePrice2" column="wholesale_price2"/>
|
||||
<result property="wholesalePrice3" column="wholesale_price3"/>
|
||||
<result property="promotionPrice" column="promotion_price"/>
|
||||
<result property="productNature" column="product_nature"/>
|
||||
<result property="archiverSignature" column="archiver_signature"/>
|
||||
<result property="inventoryArea" column="inventory_area"/>
|
||||
<result property="commissionRate" column="commission_rate"/>
|
||||
<result property="jointDeductionRate" column="joint_deduction_rate"/>
|
||||
<result property="inventoryUpperLimit" column="inventory_upper_limit"/>
|
||||
<result property="inventoryLowerLimit" column="inventory_lower_limit"/>
|
||||
<result property="grossMargin" column="gross_margin"/>
|
||||
<result property="auxiliaryBarcodeId" column="auxiliary_barcode_id"/>
|
||||
<result property="brandId" column="brand_id"/>
|
||||
<result property="supplierId" column="supplier_id"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result property="salesCount" column="sales_count"/>
|
||||
<result property="stock" column="stock"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectListAllScope" parameterType="com.bsd.pjcloud.supermarket.dto.SupermarketSpuQueryDTO" resultType="com.bsd.pjcloud.supermarket.vo.ad.SpuVo">
|
||||
@@ -132,4 +105,56 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectPageXmlByScope" resultMap="supermarketSpuMap">
|
||||
SELECT
|
||||
spu.id,
|
||||
spu.product_code,
|
||||
spu.product_name,
|
||||
spu.category_id,
|
||||
spu.pic_url,
|
||||
spu.product_nature,
|
||||
spu.create_time,
|
||||
spu.sales_count,
|
||||
spu.dept_id,
|
||||
spu.create_by,
|
||||
spu.unit,
|
||||
spu.spec,
|
||||
unit.retail_price,
|
||||
unit.cost_price,
|
||||
st.current_stock as stock,
|
||||
supplier.supplier_id
|
||||
FROM
|
||||
sm_erp_spu spu
|
||||
JOIN sm_erp_unit unit
|
||||
ON spu.id = unit.spu_id
|
||||
LEFT JOIN sm_erp_stock st
|
||||
ON spu.id = st.erp_spu_id
|
||||
LEFT JOIN sm_erp_supplier supplier
|
||||
ON spu.supplier_id = supplier.supplier_id
|
||||
<where>
|
||||
spu.del_flag = '0' and unit.del_flag = '0'
|
||||
<if test="supermarketSpuPageDto.productCode != null">
|
||||
AND spu.product_code = #{supermarketSpuPageDto.productCode}
|
||||
</if>
|
||||
<if test="supermarketSpuPageDto.barCode != null">
|
||||
AND unit.bar_code = #{supermarketSpuPageDto.barCode}
|
||||
</if>
|
||||
<if test="supermarketSpuPageDto.productName != null">
|
||||
AND spu.product_name LIKE CONCAT('%', #{supermarketSpuPageDto.productName}, '%')
|
||||
</if>
|
||||
<if test="supermarketSpuPageDto.categoryId != null">
|
||||
AND spu.category_id = #{supermarketSpuPageDto.categoryId}
|
||||
</if>
|
||||
<if test="supermarketSpuPageDto.productNature != null">
|
||||
AND spu.product_nature = #{supermarketSpuPageDto.productNature}
|
||||
</if>
|
||||
<if test="supermarketSpuPageDto.status != null">
|
||||
AND spu.status = #{supermarketSpuPageDto.status}
|
||||
</if>
|
||||
<if test="supermarketSpuPageDto.supplierId != null">
|
||||
AND spu.supplier_id = #{supermarketSpuPageDto.supplierId}
|
||||
</if>
|
||||
</where>
|
||||
order by spu.create_time desc,spu.id desc
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user