deptIds;
+}
\ No newline at end of file
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/Repository.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/Repository.java
index e5d3654..63d3866 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/Repository.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/Repository.java
@@ -11,6 +11,7 @@ import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
+import java.util.List;
/**
*
@@ -63,7 +64,6 @@ public class Repository implements Serializable {
/**
* 是否是默认仓库:0 否 1 是
*/
- @NotNull(message = "是否是默认仓库不能为空")
@TableField("default_repo")
private String defaultRepo;
@@ -85,5 +85,17 @@ public class Repository implements Serializable {
@TableField("oper_id")
private Long operId;
+ @TableField
+ @NotNull(message = "仓库管理员不能为空")
+ private Long manager;
+ @TableField
+ @NotNull(message = "仓库编号不能为空")
+ private String repoNum;
+
+ @TableField
+ @NotNull(message = "排序号不能为空")
+ private Integer orderNum;
+ @TableField(exist = false)
+ private List deptIds;
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/SchoolOrder.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/SchoolOrder.java
index 9cf6745..9fc751a 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/SchoolOrder.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/SchoolOrder.java
@@ -110,4 +110,10 @@ public class SchoolOrder implements Serializable {
* 订单是否可参与结算:0 不可结算;1 可结算
*/
private Integer orderSettleStatus;
+
+ private String signPerson;
+
+ private Date signTime;
+
+ private String signImage;
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/SchoolOrderItem.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/SchoolOrderItem.java
index b5a355b..fc890d2 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/SchoolOrderItem.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/SchoolOrderItem.java
@@ -57,7 +57,7 @@ public class SchoolOrderItem implements Serializable {
/**
* 商品id
*/
- private Long foodProductId;
+ private Integer foodProductId;
/**
* 食材名称
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/SpecTypes.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/SpecTypes.java
deleted file mode 100644
index b6836d9..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/SpecTypes.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.zf.foodpurchase.fdsafe.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-import java.util.Date;
-import java.util.List;
-
-/**
- *
- * 商品规格类型表
- *
- *
- * @author lilj
- * @since 2024-11-16
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@TableName("spec_types")
-public class SpecTypes implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 规格类型
- */
- @TableId(value = "spec_type", type = IdType.AUTO)
- private Integer specType;
-
- /**
- * 所属商户id
- */
- @TableField("merchant_id")
- private Long merchantId;
-
- /**
- * 规格名称
- */
- @TableField("spec_name")
- @NotNull(message = "规格名称不能为空")
- private String specName;
-
- @TableField(exist = false)
- List specValuesList;
-
- /**
- * 创建时间
- */
- @TableField("create_time")
- private Date createTime;
-
- /**
- * 更新时间
- */
- @TableField("update_time")
- private Date updateTime;
-
- /**
- * 操作人id
- */
- @TableField("oper_id")
- private Long operId;
-
- @TableField(exist = false)
- private boolean hasChildren;
-
-}
-
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/SpecValues.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/SpecValues.java
deleted file mode 100644
index d362d72..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/entity/SpecValues.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.zf.foodpurchase.fdsafe.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- *
- * 规格值表
- *
- *
- * @author lilj
- * @since 2024-11-16
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-public class SpecValues implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @TableId(value = "id", type = IdType.AUTO)
- private Integer id;
-
- /**
- * 规格类型id
- */
- @TableField("spec_type")
- @NotNull(message = "规格类型不能为空")
- private Integer specType;
-
- @TableField(exist = false)
- private String specName;
-
- /**
- * 所属商户id
- */
- @TableField("merchant_id")
- private Long merchantId;
-
- /**
- * 规格值
- */
- @TableField("spec_value")
- @NotBlank(message = "规格值不能为空")
- private String specValue;
-
- /**
- * 规格单位
- */
- @TableField("spec_unit")
- private String specUnit;
-
- /**
- * 创建时间
- */
- @TableField("create_time")
- private Date createTime;
-
- /**
- * 更新时间
- */
- @TableField("update_time")
- private Date updateTime;
-
- /**
- * 操作人
- */
- @TableField("oper_id")
- private Long operId;
-
-
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/FoodProductMapper.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/FoodProductMapper.java
index 5428ca4..caad40d 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/FoodProductMapper.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/FoodProductMapper.java
@@ -2,6 +2,7 @@ package com.zf.foodpurchase.fdsafe.mapper;
import com.zf.foodpurchase.fdsafe.entity.FoodProduct;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zf.foodpurchase.fdsafe.vo.FoodProductCKVO;
import com.zf.foodpurchase.fdsafe.vo.FoodProductVO;
import java.util.List;
@@ -17,4 +18,6 @@ import java.util.List;
public interface FoodProductMapper extends BaseMapper {
List queryFoodProductVO(FoodProductVO foodProductVO);
+ List pageCKList(Integer repoId);
+
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/FoodRepoMapper.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/FoodRepoMapper.java
new file mode 100644
index 0000000..0616570
--- /dev/null
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/FoodRepoMapper.java
@@ -0,0 +1,11 @@
+package com.zf.foodpurchase.fdsafe.mapper;
+
+import com.zf.foodpurchase.fdsafe.entity.FoodRepo;
+import org.apache.ibatis.annotations.Param;
+
+public interface FoodRepoMapper {
+
+ int insert(FoodRepo foodRepo);
+ int update(FoodRepo foodRepo);
+ FoodRepo selectByProductIdAndRepoId(@Param("productId") Long productId, @Param("repoId") Long repoId);
+}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/FoodSpecMapper.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/FoodSpecMapper.java
new file mode 100644
index 0000000..771f3c4
--- /dev/null
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/FoodSpecMapper.java
@@ -0,0 +1,20 @@
+package com.zf.foodpurchase.fdsafe.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zf.foodpurchase.fdsafe.entity.FoodSpec;
+import com.zf.foodpurchase.fdsafe.vo.FoodSpecVO;
+
+import java.util.List;
+
+/**
+ *
+ * Mapper 接口
+ *
+ *
+ * @author lilj
+ * @since 2025-04-17
+ */
+public interface FoodSpecMapper extends BaseMapper {
+
+ List queryFoodSpecVO(FoodSpecVO foodSpecVO);
+}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/ProductsMapper.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/ProductsMapper.java
deleted file mode 100644
index aa402c1..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/ProductsMapper.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package com.zf.foodpurchase.fdsafe.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.zf.foodpurchase.fdsafe.entity.Products;
-
-import java.util.List;
-
-/**
- * 商品Mapper接口
- *
- * @author ruoyi
- * @date 2024-11-16
- */
-public interface ProductsMapper extends BaseMapper
-{
- /**
- * 查询商品
- *
- * @param productId 商品主键
- * @return 商品
- */
- public Products selectProductsByProductId(Integer productId);
-
- /**
- * 查询商品列表
- *
- * @param products 商品
- * @return 商品集合
- */
- public List selectProductsList(Products products);
-
- /**
- * 热销商品查询
- *
- * @param products 商品
- * @return 商品集合
- */
- public List selectHotProducts(Products products);
-
- /**
- * 推荐商品
- *
- * @param products 商品
- * @return 商品集合
- */
- public List selectRecommendProducts(Products products);
-
- /**
- * 新品上架
- *
- * @param products 商品
- * @return 商品集合
- */
- public List selectNewProductsList(Products products);
-
- /**
- * 查询商品列表,按销量查询
- *
- * @param products 商品
- * @return 商品集合
- */
- public List selectSailCountProducts(Products products);
-
- /**
- * 新增商品
- *
- * @param products 商品
- * @return 结果
- */
- public int insertProducts(Products products);
-
- /**
- * 修改商品
- *
- * @param products 商品
- * @return 结果
- */
- public int updateProducts(Products products);
-
- /**
- * 删除商品
- *
- * @param productId 商品主键
- * @return 结果
- */
- public int deleteProductsByProductId(Integer productId);
-
- /**
- * 批量删除商品
- *
- * @param productIds 需要删除的数据主键集合
- * @return 结果
- */
- public int deleteProductsByProductIds(Integer[] productIds);
-
- int deleteProductsLogicByProductIds(Integer[] productIds);
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/ProductsSpecMapper.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/ProductsSpecMapper.java
deleted file mode 100644
index 80b5a73..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/ProductsSpecMapper.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.zf.foodpurchase.fdsafe.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.zf.foodpurchase.fdsafe.entity.ProductsSpec;
-
-import java.util.Map;
-
-/**
- *
- * 商品价格表 Mapper 接口
- *
- *
- * @author lilj
- * @since 2024-11-18
- */
-public interface ProductsSpecMapper extends BaseMapper {
-
- int updateProductsSpec(ProductsSpec productsSpec);
-
- Map selectMinOne(Integer productId);
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/RepoRecordMapper.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/RepoRecordMapper.java
new file mode 100644
index 0000000..f69401c
--- /dev/null
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/RepoRecordMapper.java
@@ -0,0 +1,18 @@
+package com.zf.foodpurchase.fdsafe.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zf.foodpurchase.fdsafe.entity.RepoRecord;
+import com.zf.foodpurchase.fdsafe.vo.RepoRecordVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+
+public interface RepoRecordMapper extends BaseMapper {
+
+ public int insertRepoRecord(RepoRecord repoRecord);
+
+ public RepoRecordVO selectRepoRecordByRepoRecordId(@Param("repoRecordId") Long repoRecordId);
+
+ public List selectRepoRecordList(@Param("productName") String productName, @Param("categoryId") Integer categoryId, @Param("repoId") Integer repoId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
+}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/RepositoryMapper.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/RepositoryMapper.java
index a8691c2..f140b2d 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/RepositoryMapper.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/RepositoryMapper.java
@@ -15,5 +15,5 @@ import java.util.List;
*/
public interface RepositoryMapper extends BaseMapper {
- List joinQueryList(Repository quryRepository);
+ List queryRepoList(Repository queryRepository);
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/SchoolOrderItemMapper.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/SchoolOrderItemMapper.java
index 4ba0be3..4e7e903 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/SchoolOrderItemMapper.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/SchoolOrderItemMapper.java
@@ -2,7 +2,9 @@ package com.zf.foodpurchase.fdsafe.mapper;
import com.zf.foodpurchase.fdsafe.entity.SchoolOrderItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zf.foodpurchase.fdsafe.vo.ProductCountVO;
import com.zf.foodpurchase.fdsafe.vo.SchoolOrderItemVO;
+import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -17,4 +19,5 @@ import java.util.List;
public interface SchoolOrderItemMapper extends BaseMapper {
List querySchoolOrderItemVO(SchoolOrderItemVO schoolOrderItemVO);
+
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/SchoolOrderMapper.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/SchoolOrderMapper.java
index 6dd0e33..20b0bf4 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/SchoolOrderMapper.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/SchoolOrderMapper.java
@@ -16,5 +16,9 @@ import java.util.List;
*/
public interface SchoolOrderMapper extends BaseMapper {
+ List querySupplierOrderVO(SchoolOrderVO schoolOrderVO);
+
List querySchoolOrderVO(SchoolOrderVO schoolOrderVO);
+
+ int signOrder(SchoolOrderVO schoolOrderVO);
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/SpecTypesMapper.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/SpecTypesMapper.java
deleted file mode 100644
index 4087620..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/SpecTypesMapper.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.zf.foodpurchase.fdsafe.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.zf.foodpurchase.fdsafe.entity.SpecTypes;
-
-/**
- *
- * 商品规格类型表 Mapper 接口
- *
- *
- * @author lilj
- * @since 2024-11-16
- */
-public interface SpecTypesMapper extends BaseMapper {
-
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/SpecValuesMapper.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/SpecValuesMapper.java
deleted file mode 100644
index a39b31f..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/mapper/SpecValuesMapper.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.zf.foodpurchase.fdsafe.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.zf.foodpurchase.fdsafe.entity.SpecValues;
-
-import java.util.List;
-
-/**
- *
- * 规格值表 Mapper 接口
- *
- *
- * @author lilj
- * @since 2024-11-16
- */
-public interface SpecValuesMapper extends BaseMapper {
-
- List queryList(SpecValues specValues);
-
- List queryByIds(List specValuesIds);
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IFoodProductService.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IFoodProductService.java
index 74de14b..d64c41c 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IFoodProductService.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IFoodProductService.java
@@ -3,6 +3,7 @@ package com.zf.foodpurchase.fdsafe.service;
import com.zf.foodpurchase.common.core.domain.AjaxResult;
import com.zf.foodpurchase.fdsafe.entity.FoodProduct;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.zf.foodpurchase.fdsafe.vo.FoodProductCKVO;
import com.zf.foodpurchase.fdsafe.vo.FoodProductVO;
import java.util.List;
@@ -24,4 +25,6 @@ public interface IFoodProductService extends IService {
AjaxResult supplierUpdate(FoodProductVO foodProductVO);
AjaxResult eduCheck(FoodProductVO foodProductVO);
+
+ List pageCKList(Integer repoId);
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IFoodSpecService.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IFoodSpecService.java
new file mode 100644
index 0000000..f725de9
--- /dev/null
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IFoodSpecService.java
@@ -0,0 +1,25 @@
+package com.zf.foodpurchase.fdsafe.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zf.foodpurchase.common.core.domain.AjaxResult;
+import com.zf.foodpurchase.fdsafe.entity.FoodSpec;
+import com.zf.foodpurchase.fdsafe.vo.FoodSpecVO;
+
+import java.util.List;
+
+/**
+ *
+ * 服务类
+ *
+ *
+ * @author lilj
+ * @since 2025-04-17
+ */
+public interface IFoodSpecService extends IService {
+
+ List queryFoodSpecVO(FoodSpecVO foodSpecVO);
+
+ AjaxResult saveVO(FoodSpecVO foodSpecVO);
+
+ AjaxResult updateVO(FoodSpecVO foodSpecVO);
+}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IProductsService.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IProductsService.java
deleted file mode 100644
index 502f0ec..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IProductsService.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package com.zf.foodpurchase.fdsafe.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.zf.foodpurchase.common.core.domain.AjaxResult;
-import com.zf.foodpurchase.fdsafe.entity.Products;
-
-import java.util.List;
-
-/**
- * 商品Service接口
- *
- * @author ruoyi
- * @date 2024-11-16
- */
-public interface IProductsService extends IService
-{
- /**
- * 查询商品
- *
- * @param productId 商品主键
- * @return 商品
- */
- public Products selectProductsByProductId(Integer productId);
-
- /**
- * 查询商品列表
- *
- * @param products 商品
- * @return 商品集合
- */
- public List selectProductsList(Products products);
-
- /**
- * 新增商品
- *
- * @param products 商品
- * @return 结果
- */
- public int insertProducts(Products products);
-
- /**
- * 直接插入不做任何处理
- *
- * @param products 商品
- * @return 结果
- */
- public int insertProductsDirect(Products products);
-
- /**
- * 新增商品带单品
- *
- * @param products 商品
- * @return 结果
- */
- public int insertProductsAndSpec(Products products);
- /**
- * 修改商品
- *
- * @param products 商品
- * @return 结果
- */
- public int updateProducts(Products products);
-
- /**
- * 多规格变动更新商品
- * @param products
- * @return
- */
- public int updateProductsAndSpec(Products products);
-
- /**
- * 通用更新,多规格变单规格,单规格变多规格
- * @param products
- * @return
- */
- public int commonUpdateProducts(Products products);
-
-
- /**
- * 系统内部调用,不校验商品直接修改
- * @param products
- * @return
- */
- public int updateProductsDirect(Products products);
-
- /**
- * 批量删除商品
- *
- * @param productIds 需要删除的商品主键集合
- * @return 结果
- */
- public int deleteProductsByProductIds(Integer[] productIds ,boolean isAllowDeleteSpecs);
-
- /**
- * 删除商品信息
- *
- * @param productId 商品主键
- * @return 结果
- */
- public int deleteProductsByProductId(Integer productId,boolean isAllowDeleteSpecs);
-
- int deleteProductsLogicByProductIds(Integer[] productIds);
-
- List selectHotProducts(Products products);
-
- List selectRecommendProducts(Products products);
-
- List selectNewProductsList(Products products);
-
- List selectSailCountProducts(Products products);
-
- AjaxResult getDetails(Integer productId);
-
- public Products preDealProducts(Products products);
-
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IProductsSpecService.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IProductsSpecService.java
deleted file mode 100644
index 21053aa..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IProductsSpecService.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.zf.foodpurchase.fdsafe.service;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.zf.foodpurchase.common.core.domain.AjaxResult;
-import com.zf.foodpurchase.common.core.page.TableDataInfo;
-import com.zf.foodpurchase.fdsafe.entity.Products;
-import com.zf.foodpurchase.fdsafe.entity.ProductsSpec;
-
-import java.util.List;
-
-/**
- *
- * 商品价格表 服务类
- *
- *
- * @author lilj
- * @since 2024-11-18
- */
-public interface IProductsSpecService extends IService {
-
- TableDataInfo queryList(ProductsSpec productsSpec);
-
-
- Integer queryExists(ProductsSpec productsSpec);
-
-
- AjaxResult removeProductsByIds(List list);
-
- List listWithProductSpecValues(LambdaQueryWrapper queryWrapper);
-
-
- ProductsSpec preDealSpecValues(ProductsSpec spec);
-
- public ProductsSpec preDealProductsSpec(Products products, ProductsSpec productsSpec);
-
- boolean addWithSpec(Products products);
-
- public Products preDealMultisSpecProducts(Products products);
-
- boolean modifyProductsSepcList(List productsSpecList);
-
- int commonUpdateProducts(Products products);
-
- boolean updateSingleProducts(Products products);
-
- boolean updateMulSpecProducts(Products products);
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IRepoRecordService.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IRepoRecordService.java
new file mode 100644
index 0000000..2aad0dc
--- /dev/null
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IRepoRecordService.java
@@ -0,0 +1,22 @@
+package com.zf.foodpurchase.fdsafe.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zf.foodpurchase.common.core.domain.AjaxResult;
+import com.zf.foodpurchase.fdsafe.entity.InRepoVO;
+import com.zf.foodpurchase.fdsafe.entity.RepoRecord;
+import com.zf.foodpurchase.fdsafe.entity.SchoolOrderItem;
+import com.zf.foodpurchase.fdsafe.vo.FoodProductCKVO;
+import com.zf.foodpurchase.fdsafe.vo.RepoRecordVO;
+
+import java.util.List;
+
+public interface IRepoRecordService extends IService {
+
+ AjaxResult inRepo(List inRepoVOs);
+
+ AjaxResult outRepo(List foodProductCKVOs);
+
+ RepoRecordVO selectRepoRecordByRepoRecordId(Long repoRecordId);
+
+ List selectRepoRecordList(RepoRecord repoRecord);
+}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IRepositoryService.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IRepositoryService.java
index 3212b35..3e6938b 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IRepositoryService.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/IRepositoryService.java
@@ -3,6 +3,7 @@ package com.zf.foodpurchase.fdsafe.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zf.foodpurchase.common.core.domain.AjaxResult;
import com.zf.foodpurchase.fdsafe.entity.Repository;
+import com.zf.foodpurchase.fdsafe.vo.ProductCountVO;
import java.util.List;
@@ -16,7 +17,7 @@ import java.util.List;
*/
public interface IRepositoryService extends IService {
- List joinQueryList(Repository quryRepository);
+ List queryRepoList(Repository quryRepository);
AjaxResult saveRepo(Repository repository);
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/ISchoolOrderItemService.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/ISchoolOrderItemService.java
index b1d3ebb..b025606 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/ISchoolOrderItemService.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/ISchoolOrderItemService.java
@@ -3,6 +3,7 @@ package com.zf.foodpurchase.fdsafe.service;
import com.zf.foodpurchase.fdsafe.entity.SchoolOrder;
import com.zf.foodpurchase.fdsafe.entity.SchoolOrderItem;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.zf.foodpurchase.fdsafe.vo.ProductCountVO;
import com.zf.foodpurchase.fdsafe.vo.SchoolOrderItemVO;
import java.util.List;
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/ISchoolOrderService.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/ISchoolOrderService.java
index 4d72a1d..5f04e5d 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/ISchoolOrderService.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/ISchoolOrderService.java
@@ -18,6 +18,8 @@ import java.util.List;
*/
public interface ISchoolOrderService extends IService {
+ List querySupplierOrderVO(SchoolOrderVO schoolOrderVO);
+
List querySchoolOrderVO(SchoolOrderVO schoolOrderVO);
AjaxResult submitOrder(@Valid SchoolSubmitOrderVO submitOrderVO);
@@ -31,4 +33,6 @@ public interface ISchoolOrderService extends IService {
boolean updateOrderStatus(SchoolOrder schoolOrder);
public boolean updateOrderSettleStatus(List orderNos, Integer orderSettleStatus);
+
+ AjaxResult signOrder(SchoolOrderVO schoolOrderVO);
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/ISpecTypesService.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/ISpecTypesService.java
deleted file mode 100644
index 3398cad..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/ISpecTypesService.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.zf.foodpurchase.fdsafe.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.zf.foodpurchase.common.core.domain.AjaxResult;
-import com.zf.foodpurchase.fdsafe.entity.SpecTypes;
-
-import java.util.List;
-
-/**
- *
- * 商品规格类型表 服务类
- *
- *
- * @author lilj
- * @since 2024-11-16
- */
-public interface ISpecTypesService extends IService {
-
-
- AjaxResult saveTypes(SpecTypes specTypes);
-
- AjaxResult removeSpecTypes(List list,Long merchantId);
-
- AjaxResult updateType(SpecTypes specTypes, boolean admin);
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/ISpecValuesService.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/ISpecValuesService.java
deleted file mode 100644
index 5497b37..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/ISpecValuesService.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.zf.foodpurchase.fdsafe.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.zf.foodpurchase.common.core.domain.AjaxResult;
-import com.zf.foodpurchase.fdsafe.entity.SpecValues;
-
-import java.util.List;
-
-/**
- *
- * 规格值表 服务类
- *
- *
- * @author lilj
- * @since 2024-11-16
- */
-public interface ISpecValuesService extends IService {
-
- List queryList(SpecValues specValues);
-
-
- List queryByIds(List specValuesIds);
-
- AjaxResult updateSpecValues(SpecValues specValues,boolean isAdmin);
-
- AjaxResult removeValues(List idList, Long merchantId);
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/FoodProductServiceImpl.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/FoodProductServiceImpl.java
index f5b80a6..a762069 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/FoodProductServiceImpl.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/FoodProductServiceImpl.java
@@ -3,6 +3,7 @@ package com.zf.foodpurchase.fdsafe.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zf.foodpurchase.common.constant.FoodStatusConstants;
import com.zf.foodpurchase.common.core.domain.AjaxResult;
+import com.zf.foodpurchase.common.core.domain.entity.SysUser;
import com.zf.foodpurchase.common.utils.bean.BeanUtils;
import com.zf.foodpurchase.fdsafe.entity.Food;
import com.zf.foodpurchase.fdsafe.entity.FoodProduct;
@@ -10,7 +11,9 @@ import com.zf.foodpurchase.fdsafe.mapper.FoodMapper;
import com.zf.foodpurchase.fdsafe.mapper.FoodProductMapper;
import com.zf.foodpurchase.fdsafe.service.IFoodProductService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zf.foodpurchase.fdsafe.vo.FoodProductCKVO;
import com.zf.foodpurchase.fdsafe.vo.FoodProductVO;
+import com.zf.foodpurchase.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@@ -31,7 +34,8 @@ import java.util.List;
public class FoodProductServiceImpl extends ServiceImpl implements IFoodProductService {
@Autowired
private FoodMapper foodMapper;
-
+ @Autowired
+ private ISysUserService sysUserService;
@Override
@@ -50,7 +54,7 @@ public class FoodProductServiceImpl extends ServiceImpl pageCKList(Integer repoId) {
+ List list = baseMapper.pageCKList(repoId);
+ return list;
+ }
+
private FoodProduct dealSupplierProductAdd(FoodProductVO foodProductVO) {
if (foodProductVO == null) {
return null;
@@ -102,8 +113,12 @@ public class FoodProductServiceImpl extends ServiceImpl
+ * 服务实现类
+ *
+ *
+ * @author lilj
+ * @since 2025-04-17
+ */
+@Service
+public class FoodSpecServiceImpl extends ServiceImpl implements IFoodSpecService {
+
+ @Override
+ public List queryFoodSpecVO(FoodSpecVO foodSpecVO) {
+ List list = baseMapper.queryFoodSpecVO(foodSpecVO);
+ return list;
+ }
+
+ @Override
+ public AjaxResult saveVO(FoodSpecVO foodSpecVO) {
+ FoodSpec foodSpec=new FoodSpec();
+ BeanUtils.copyProperties(foodSpecVO, foodSpec);
+ if(!uniqueSpecCheck(foodSpec)){
+ return AjaxResult.error("规格/单位已存在,不可重复添加");
+ }
+ boolean result = save(foodSpec);
+ return result ? AjaxResult.success("添加成功") : AjaxResult.error("添加失败");
+ }
+
+ @Override
+ public AjaxResult updateVO(FoodSpecVO foodSpecVO) {
+ FoodSpec foodSpec=new FoodSpec();
+ BeanUtils.copyProperties(foodSpecVO, foodSpec);
+ if(!uniqueSpecCheck(foodSpec)){
+ return AjaxResult.error("规格/单位已存在,不可修改为该规格/单位");
+ }
+ boolean result = updateById(foodSpec);
+ return result ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
+ }
+
+ private boolean uniqueSpecCheck(FoodSpec foodSpec){
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(FoodSpec::getSpecLabel, foodSpec.getSpecLabel());
+ if(foodSpec.getSpecId()!=null){
+ queryWrapper.ne(FoodSpec::getSpecId, foodSpec.getSpecId());
+ }
+ long count = count(queryWrapper);
+ return count == 0;
+ }
+}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/ProductsServiceImpl.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/ProductsServiceImpl.java
deleted file mode 100644
index ad7ac28..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/ProductsServiceImpl.java
+++ /dev/null
@@ -1,580 +0,0 @@
-package com.zf.foodpurchase.fdsafe.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.zf.foodpurchase.common.constant.Constants;
-import com.zf.foodpurchase.common.core.domain.AjaxResult;
-import com.zf.foodpurchase.common.exception.ServiceException;
-import com.zf.foodpurchase.common.utils.StringUtils;
-import com.zf.foodpurchase.fdsafe.entity.Products;
-import com.zf.foodpurchase.fdsafe.entity.ProductsSpec;
-import com.zf.foodpurchase.fdsafe.entity.SpecValues;
-import com.zf.foodpurchase.fdsafe.mapper.ProductsMapper;
-import com.zf.foodpurchase.fdsafe.mapper.ProductsSpecMapper;
-import com.zf.foodpurchase.fdsafe.service.IProductsService;
-import com.zf.foodpurchase.fdsafe.service.ISpecValuesService;
-import com.zf.foodpurchase.fdsafe.utils.ImagesPrefixUtil;
-import com.zf.foodpurchase.fdsafe.vo.ProductsSpecVO;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
-import java.util.*;
-
-/**
- * 商品Service业务层处理
- *
- * @author ruoyi
- * @date 2024-11-16
- */
-@Service
-public class ProductsServiceImpl extends ServiceImpl implements IProductsService {
- @Autowired
- private ProductsMapper productsMapper;
-
- @Autowired
- private ProductsSpecMapper productsSpecMapper;
-
- @Autowired
- private ISpecValuesService specValuesService;
-
-
- /**
- * 查询商品
- *
- * @param productId 商品主键
- * @return 商品
- */
- @Override
- public Products selectProductsByProductId(Integer productId) {
- return productsMapper.selectProductsByProductId(productId);
- }
-
- /**
- * 查询商品列表
- *
- * @param products 商品
- * @return 商品
- */
- @Override
- public List selectProductsList(Products products) {
- return productsMapper.selectProductsList(products);
- }
-
- /**
- * 新增商品
- *
- * @param products 商品
- * @return 结果
- */
- @Override
- public int insertProducts(Products products) {
- products = preDealProducts(products);
- return productsMapper.insertProducts(products);
- }
-
- /**
- * 新增商品-直接插入不做任何校验处理
- *
- * @param products 商品
- * @return 结果
- */
- @Override
- public int insertProductsDirect(Products products) {
- return productsMapper.insertProducts(products);
- }
-
- /**
- * 新增商品
- *
- * @param products 多规格带一个单规格
- * @return 结果
- */
- @Override
- public int insertProductsAndSpec(Products products) {
-
- products = preDealProductsAndSpec(products);
- return productsMapper.insertProducts(products);
- }
-
- /**
- * 修改商品:单品变规格商品库存清零,添加具体规格商品自动计算.
- * 多规格商品变单规格商品,自动清除规格信息
- *
- * @param products 商品
- * @return 结果
- */
- @Transactional
- @Override
- public int updateProducts(Products products) {
- String msg = null;
- // 需要校验是否修改商品的库存信息
- Products oldProducts = selectProductsByProductId(products.getProductId());
-
- // 不允许单规格变多规格,规格类型不发生变动,其实都可以的。规格类型变动了呢?
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs()) && Constants.SINGLE_SPEC.equals(oldProducts.getIsSpecs())) {
- // products.setTotalStock(0);
- throw new ServiceException("单品无法修改为多规格");
- }
- // 商品为多规格商品,且修改了库存数目
- if (oldProducts.getIsSpecs().equals(Constants.MULTI_SPEC) && !oldProducts.getTotalStock().equals(products.getTotalStock())) {
- throw new ServiceException("多规格商品不允许直接修改商品库存,请修改具体规格下的商品库存");
- }
-
-
-
- // 多规格商品变单规格商品,清除多规格商品
- if (Constants.SINGLE_SPEC.equals(products.getIsSpecs()) && Constants.MULTI_SPEC.equals(oldProducts.getIsSpecs())) {
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(ProductsSpec::getProductId, products.getProductId());
- productsSpecMapper.delete(queryWrapper);
- }
-
- // 商品的购买类型发生变动
- // 商品购买类型发生变动,多规格需要提示信息
- if (!oldProducts.getType().equals(products.getType())) {
- // 价格与积分不兼容
-
-
- // if(Constants.MULTI_SPEC.equals(products.getIsSpecs())){
- // // 规格变动默认进行下架处理,因为价格和积分不兼容
- // products.setStatus(Constants.GOODS_STATUS_DOWN);
- // msg = "多规格商品类型变更,默认下架,请检查商品的规格信息";
- // throw new ServiceException("多规格商品不允许修改购买类型");
- // }
- // LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- // queryWrapper.eq(ProductsSpec::getProductId, products.getProductId());
- // List productsSpecList = productsSpecMapper.selectList(queryWrapper);
- // for (ProductsSpec productsSpec : productsSpecList) {
- // productsSpec.setType(products.getType());
- // productsSpecMapper.updateProductsSpec(productsSpec);
- // }
-
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs())) {
- throw new ServiceException("多规格商品不允许修改购买类型");
- }
-
-
- }
- return productsMapper.updateProducts(products);
- }
-
- /**
- * 多规格信息变动更新信息
- * @param products
- * @return
- */
- @Transactional
- @Override
- public int updateProductsAndSpec(Products products) {
- String msg = null;
- // 需要校验是否修改商品的库存信息
- Products oldProducts = selectProductsByProductId(products.getProductId());
-
-
- // 暂时不允许单规格变为多规格
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs()) && Constants.SINGLE_SPEC.equals(oldProducts.getIsSpecs())) {
- // products.setTotalStock(0);
- throw new ServiceException("单品无法修改为多规格");
- // 单变多:
- // 更新products内容。
-
- // 插入productSpec数据
- }
-
- // 后面是多规格商品的处理。
- // 商品为多规格商品,且修改了库存数目
- if (oldProducts.getIsSpecs().equals(Constants.MULTI_SPEC) && !oldProducts.getTotalStock().equals(products.getTotalStock())) {
- throw new ServiceException("多规格商品不允许直接修改商品库存,请修改具体规格下的商品库存");
- }
-
- // 多规格商品变单规格商品,清除多规格商品
- if (Constants.SINGLE_SPEC.equals(products.getIsSpecs()) && Constants.MULTI_SPEC.equals(oldProducts.getIsSpecs())) {
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(ProductsSpec::getProductId, products.getProductId());
- productsSpecMapper.delete(queryWrapper);
- }
-
- // 商品的购买类型发生变动
- // 商品购买类型发生变动,多规格需要提示信息
- if (!oldProducts.getType().equals(products.getType())) {
- // 价格与积分不兼容
-
-
- // if(Constants.MULTI_SPEC.equals(products.getIsSpecs())){
- // // 规格变动默认进行下架处理,因为价格和积分不兼容
- // products.setStatus(Constants.GOODS_STATUS_DOWN);
- // msg = "多规格商品类型变更,默认下架,请检查商品的规格信息";
- // throw new ServiceException("多规格商品不允许修改购买类型");
- // }
- // LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- // queryWrapper.eq(ProductsSpec::getProductId, products.getProductId());
- // List productsSpecList = productsSpecMapper.selectList(queryWrapper);
- // for (ProductsSpec productsSpec : productsSpecList) {
- // productsSpec.setType(products.getType());
- // productsSpecMapper.updateProductsSpec(productsSpec);
- // }
-
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs())) {
- throw new ServiceException("多规格商品不允许修改购买类型");
- }
-
-
- }
- // 求出最小值,确保每次更新多规格商品都能都能取到正确值
- Map stringIntegerMap = selectMinPriceAndIntegralByProductId(products.getProductId());
- products.setBasePrice(stringIntegerMap.get("price") == null ? 0 :stringIntegerMap.get("price"));
- products.setBaseIntegral(stringIntegerMap.get("integral") == null ? 0 : stringIntegerMap.get("integral"));
-
- products = preDealProductsAndSpec(products);
- return productsMapper.updateProducts(products);
- }
-
-
- /**
- * 来源于ProductsController商品更新
- * 更新商品信息,保存规格信息
- * @param products
- * @return
- */
- @Override
- @Transactional
- public int commonUpdateProducts(Products products) {
- int count=0;
- int specSize =0;
- // 需要校验是否修改商品的库存信息
- Products oldProducts = selectProductsByProductId(products.getProductId());
- if(oldProducts==null){
- throw new ServiceException("商品不存在");
- }
-
- // 暂时不允许单规格变为多规格
- // 单独规格变多规格
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs()) && Constants.SINGLE_SPEC.equals(oldProducts.getIsSpecs())) {
- // products.setTotalStock(0);
- // throw new ServiceException("单品无法修改为多规格");
- // 单变多
- // 更新products信息,products的价格,积分,返还积分都要重新计算
- int stock = 0;
- int minPrice = -1;
- int minIntegral = -1;
- // 多规格商品的库存添加对应规格商品时,自动累加
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs())) {
- List productsSpecList = products.getProductsSpecList();
- if (productsSpecList == null || productsSpecList.size() == 0) {
- throw new ServiceException("多规格商品至少设置一种规格");
- }
- specSize = productsSpecList.size();
- for (ProductsSpec productsSpec : productsSpecList) {
- if (productsSpec.getStock() == null || productsSpec.getStock() < 0) {
- throw new ServiceException("商品库存不能为空且不能小于0");
- }
- minPrice = minPrice == -1 ? productsSpec.getPrice() : Math.min(minPrice, productsSpec.getPrice());
- minIntegral = minIntegral == -1 ? productsSpec.getIntegral() : Math.min(minIntegral, productsSpec.getIntegral());
- stock += productsSpec.getStock();
- }
-
- // 校验数量是否一致
- // if(products.getTotalStock() != stock){
- // throw new ServiceException("商品库存与各规格库存之和不一致");
- // }
- products.setTotalStock(stock);
- products.setBasePrice(minPrice);
- products.setBaseIntegral(minIntegral);
-
- }
- products = preDealProductsAndSpec(products);
- if (products != null) {
- List productsSpecList = products.getProductsSpecList();
-
- // 保存规格信息
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs()) && !CollectionUtils.isEmpty(productsSpecList)) {
- for(ProductsSpec productsSpec : productsSpecList){
- productsSpec.setProductId(products.getProductId());
- productsSpec.setType(products.getType());
- if(StringUtils.isBlank(productsSpec.getSpecImage())){
- productsSpec.setSpecImage(null);
- }
- count += productsSpecMapper.insert(productsSpec);
-
- }
- }
- }
-
- // 更新products
- products = preDealProductsAndSpec(products);
- count += productsMapper.updateProducts(products);
- if(count!=specSize+1){
- throw new ServiceException("商品信息更新失败");
- }
-
- return count;
- }
- // 商品为多规格商品,且修改了库存数目
- if (oldProducts.getIsSpecs().equals(Constants.MULTI_SPEC) && !oldProducts.getTotalStock().equals(products.getTotalStock())) {
- throw new ServiceException("多规格商品不允许直接修改商品库存,请修改具体规格下的商品库存");
- }
-
-
- // 多规格商品变单规格商品,清除多规格商品
- if (Constants.SINGLE_SPEC.equals(products.getIsSpecs()) && Constants.MULTI_SPEC.equals(oldProducts.getIsSpecs())) {
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(ProductsSpec::getProductId, products.getProductId());
- productsSpecMapper.delete(queryWrapper);
- }
-
- // 商品的购买类型发生变动
- // 商品购买类型发生变动,多规格需要提示信息
- if (!oldProducts.getType().equals(products.getType())) {
- // 价格与积分不兼容
-
-
- // if(Constants.MULTI_SPEC.equals(products.getIsSpecs())){
- // // 规格变动默认进行下架处理,因为价格和积分不兼容
- // products.setStatus(Constants.GOODS_STATUS_DOWN);
- // msg = "多规格商品类型变更,默认下架,请检查商品的规格信息";
- // throw new ServiceException("多规格商品不允许修改购买类型");
- // }
- // LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- // queryWrapper.eq(ProductsSpec::getProductId, products.getProductId());
- // List productsSpecList = productsSpecMapper.selectList(queryWrapper);
- // for (ProductsSpec productsSpec : productsSpecList) {
- // productsSpec.setType(products.getType());
- // productsSpecMapper.updateProductsSpec(productsSpec);
- // }
-
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs())) {
- throw new ServiceException("多规格商品不允许修改购买类型");
- }
-
-
- }
- // 求出最小值
- Map stringIntegerMap = selectMinPriceAndIntegralByProductId(products.getProductId());
- products.setBasePrice(stringIntegerMap.get("price") == null ? 0 :stringIntegerMap.get("price"));
- products.setBaseIntegral(stringIntegerMap.get("integral") == null ? 0 : stringIntegerMap.get("integral"));
-
- products = preDealProductsAndSpec(products);
- return productsMapper.updateProducts(products);
- }
-
- public Map selectMinPriceAndIntegralByProductId(Integer productId) {
- LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery();
- queryWrapper.eq(ProductsSpec::getProductId, productId);
-
- // 查询 price 的最小值
- Map map=productsSpecMapper.selectMinOne(productId);
- Map map1=new HashMap<>();
- map1.put("price",map.get("price")==null?0:map.get("price").intValue());
- map1.put("integral",map.get("integral")==null?0:map.get("integral").intValue());
- return map1;
- }
-
- @Transactional
- @Override
- public int updateProductsDirect(Products products) {
- return productsMapper.updateProducts(products);
- }
-
- /**
- * 批量删除商品
- *
- * @param productIds 需要删除的商品主键
- * @return 结果
- */
- @Transactional
- @Override
- public int deleteProductsByProductIds(Integer[] productIds, boolean isAllowDeleteSpecs) {
- if (!isAllowDeleteSpecs) {
- // 不允许删除商品规格信息
- for (Integer productId : productIds) {
- Products products = selectProductsByProductId(productId);
- List productsSpecList = productsSpecMapper.selectList(new LambdaQueryWrapper().eq(ProductsSpec::getProductId, products.getProductId()));
- if (products.getIsSpecs().equals(Constants.MULTI_SPEC) && !productsSpecList.isEmpty()) {
- // throw new ServiceException("待删除商品中存在多规格商品,需要先删除所有商品的规格商品");
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(ProductsSpec::getProductId, products.getProductId());
- productsSpecMapper.delete(queryWrapper);
- }
- }
- } else {
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- List idList = Arrays.asList(productIds);
- queryWrapper.in(ProductsSpec::getProductId, idList);
- productsSpecMapper.delete(queryWrapper);
- }
- return productsMapper.deleteProductsByProductIds(productIds);
- }
-
- /**
- * 删除商品信息
- *
- * @param productId 商品主键
- * @return 结果
- */
- @Transactional
- @Override
- public int deleteProductsByProductId(Integer productId, boolean isAllowDeleteSpecs) {
- if (!isAllowDeleteSpecs) {
- Products products = selectProductsByProductId(productId);
- if (products.getIsSpecs().equals(Constants.MULTI_SPEC)) {
- throw new ServiceException("该商品为多规格商品,请先删除所有规格的商品,再删除当前商品");
- }
- } else {
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(ProductsSpec::getProductId, productId);
- productsSpecMapper.delete(queryWrapper);
- }
- return productsMapper.deleteProductsByProductId(productId);
- }
-
- @Override
- public int deleteProductsLogicByProductIds(Integer[] productIds) {
- return productsMapper.deleteProductsLogicByProductIds(productIds);
- }
-
- @Override
- public List selectHotProducts(Products products) {
- return productsMapper.selectHotProducts(products);
- }
-
- @Override
- public List selectRecommendProducts(Products products) {
- return productsMapper.selectRecommendProducts(products);
- }
-
- @Override
- public List selectNewProductsList(Products products) {
- return productsMapper.selectNewProductsList(products);
- }
-
- @Override
- public List selectSailCountProducts(Products products) {
- return productsMapper.selectSailCountProducts(products);
- }
-
- @Override
- public AjaxResult getDetails(Integer productId) {
- Products products = this.selectProductsByProductId(productId);
- if (products == null || !Constants.GOODS_STATUS_SOLD.equals(products.getStatus())) {
- return AjaxResult.success("查询成功");
- }
- ImagesPrefixUtil.productImageDeals(products);
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs())) {
- // 获取商品规格关联信息
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(ProductsSpec::getProductId, productId);
- List list = productsSpecMapper.selectList(queryWrapper);
- Set specValueIds = new HashSet<>();
- if (list != null && list.size() > 0) {
- products.setProductsSpecList(list);
- // 构建 规格级联信息.specType小的为父节点,大的为子节点
- List> trees = new ArrayList<>();
- for (ProductsSpec productsSpec : list) {
- ImagesPrefixUtil.productSpecImageDeals(productsSpec);
- List specValuesIds = productsSpec.getSpecValuesIds();
- specValueIds.addAll(specValuesIds);
-
- // 设置specStr信息
- List specValues = specValuesService.queryByIds(specValuesIds);
- // 对specValues排序
-
-
- StringBuilder sb = new StringBuilder();
-
- // 级联末位节点是否可选
- boolean isDisabled = productsSpec.getStock() <= 0;
- List productsSpecVOS = ProductsSpecVO.buildVOS(specValues, isDisabled);
- trees.add(productsSpecVOS);
- for (SpecValues specValue : specValues) {
-
- sb.append(specValue.getSpecValue());
- if (specValue.getSpecUnit() != null) {
- sb.append(specValue.getSpecUnit());
- }
- sb.append(" ");
- }
- sb.deleteCharAt(sb.length() - 1);
- productsSpec.setSpecStr(sb.toString());
- }
-
- List productsSpecVOS = ProductsSpecVO.mergeSpec(trees);
- products.setSpecs(productsSpecVOS);
-
- }
-
- }
- return AjaxResult.success("查询成功", products);
- }
-
-
- /**
- * 插入/修改商品,对商品对象进行预处理
- *
- * @param products
- * @return
- */
- @Override
- public Products preDealProducts(Products products) {
- if (products == null) {
- return null;
- }
- // 购买类型校验
- switch (products.getType()) {
- // 自动设置所需积分为0
- case Constants.GOODS_MONEY_BUY:
- if (products.getBasePrice() == null || products.getBasePrice() < 0) {
- throw new ServiceException("商品购买类型为金额购买时,商品基础价格不能为空且不能小于0");
- }
- products.setBaseIntegral(0);
- break;
- // 自动设置价格为0
- case Constants.GOODS_INTEGRAL_BUY:
- if (products.getBaseIntegral() == null || products.getBaseIntegral() < 0) {
- throw new ServiceException("商品购买类型为积分购买时,商品所需积分不能为空且不能小于0");
- }
- products.setBasePrice(0);
- break;
- default:
- throw new ServiceException("商品购买类型错误");
- }
-
- // 目前只有单规格商品调用此方法,不考虑多规格情况
- // if (Constants.MULTI_SPEC.equals(products.getIsSpecs())) {
- // products.setBaseIntegral(0);
- // }
-
- return products;
- }
-
-
- public Products preDealProductsAndSpec(Products products) {
- if (products == null) {
- return null;
- }
- // 购买类型校验
- switch (products.getType()) {
- // 自动设置所需积分为0
- case Constants.GOODS_MONEY_BUY:
- if (products.getBasePrice() == null || products.getBasePrice() < 0) {
- throw new ServiceException("商品购买类型为金额购买时,商品基础价格不能为空且不能小于0");
- }
- products.setBaseIntegral(0);
- break;
- // 自动设置价格为0
- case Constants.GOODS_INTEGRAL_BUY:
- if (products.getBaseIntegral() == null || products.getBaseIntegral() < 0) {
- throw new ServiceException("商品购买类型为积分购买时,商品所需积分不能为空且不能小于0");
- }
- products.setBasePrice(0);
- break;
- default:
- throw new ServiceException("商品购买类型错误");
- }
-
- return products;
- }
-
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/ProductsSpecServiceImpl.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/ProductsSpecServiceImpl.java
deleted file mode 100644
index f6f4bb6..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/ProductsSpecServiceImpl.java
+++ /dev/null
@@ -1,753 +0,0 @@
-package com.zf.foodpurchase.fdsafe.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.zf.foodpurchase.common.constant.Constants;
-import com.zf.foodpurchase.common.core.domain.AjaxResult;
-import com.zf.foodpurchase.common.core.page.TableDataInfo;
-import com.zf.foodpurchase.common.exception.ServiceException;
-import com.zf.foodpurchase.common.utils.DateUtils;
-import com.zf.foodpurchase.common.utils.StringUtils;
-import com.zf.foodpurchase.fdsafe.entity.Products;
-import com.zf.foodpurchase.fdsafe.entity.ProductsSpec;
-import com.zf.foodpurchase.fdsafe.entity.SpecValues;
-import com.zf.foodpurchase.fdsafe.mapper.ProductsSpecMapper;
-import com.zf.foodpurchase.fdsafe.service.IProductsService;
-import com.zf.foodpurchase.fdsafe.service.IProductsSpecService;
-import com.zf.foodpurchase.fdsafe.utils.SpecUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-import static com.zf.foodpurchase.common.utils.SecurityUtils.getLoginUser;
-
-/**
- *
- * 商品价格表 服务实现类
- *
- *
- * @author lilj
- * @since 2024-11-18
- */
-@Service
-public class ProductsSpecServiceImpl extends ServiceImpl implements IProductsSpecService {
- @Autowired
- private IProductsService productsService;
-
- @Autowired
- private ProductsSpecMapper productsSpecMapper;
- @Autowired
- private SpecValuesServiceImpl specValuesServiceImpl;
-
- @Override
- public TableDataInfo queryList(ProductsSpec productsSpec) {
- return null;
- }
-
- private Integer maxSpecTypeCount = 3;
-
-
-
- @Override
- public Integer queryExists(ProductsSpec productsSpec) {
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(ProductsSpec::getProductId, productsSpec.getProductId());
- queryWrapper.eq(ProductsSpec::getSpecValues, productsSpec.getSpecValues());
- queryWrapper.eq(ProductsSpec::getType, productsSpec.getType());
- return (int) count(queryWrapper);
- }
-
-
- /**
- * 本来就是多规格商品变导致库存可能变更
- * @param productsSpecList
- * @return
- */
- @Transactional
- @Override
- public boolean modifyProductsSepcList(List productsSpecList) {
- ProductsSpec firstSpec = productsSpecList.get(0);
- Integer productId = firstSpec.getProductId();
- Products products = productsService.selectProductsByProductId(productId);
- if (products == null) {
- throw new ServiceException("商品不存在");
- }
- products.setProductsSpecList(productsSpecList);
- products.setUpdateTime(DateUtils.getNowDate());
- products.setOperId(firstSpec.getOperId());
- // 商品基础信息:总库存,基础价格,基础积分变动
- Integer minPrice = -1;
- Integer minIntegral = -1;
- Integer stock = 0;
- Set specValuesSet = new HashSet<>();
-
- List updateList = new ArrayList<>();
- List insertList = new ArrayList<>();
-
- for (ProductsSpec productsSpec : productsSpecList) {
- // 修改时不会修改规格类型
- productsSpec.setType(products.getType());
- // 购买类型校验
- switch (productsSpec.getType()) {
- // 自动设置所需积分为0
- case Constants.GOODS_MONEY_BUY:
- if (productsSpec.getPrice() == null || productsSpec.getPrice() <= 0) {
- throw new ServiceException("商品购买类型为金额购买时,商品价格不能为空且必须大于0");
- }
- productsSpec.setIntegral(0);
- break;
- // 自动设置价格为0
- case Constants.GOODS_INTEGRAL_BUY:
- if (productsSpec.getIntegral() == null || productsSpec.getIntegral() <= 0) {
- throw new ServiceException("商品购买类型为积分购买时,商品所需积分不能为空且不能小于0");
- }
- productsSpec.setPrice(0);
- break;
- default:
- throw new ServiceException("商品购买类型错误");
- }
-
- dealProductsSpecArrayToValues(productsSpec);
- preDealSpecValues(productsSpec);
- specValuesSet.add(productsSpec.getSpecValues());
- if(productsSpec.getStock()==null || productsSpec.getStock()<0){
- throw new ServiceException("商品库存不能为空且不能小于0");
- }
- stock+= productsSpec.getStock();
-
- //
- minPrice = minPrice==-1 ? productsSpec.getPrice() : Math.min(minPrice, productsSpec.getPrice());
- minIntegral = minIntegral == -1 ? productsSpec.getIntegral() : Math.min(minIntegral, productsSpec.getIntegral());
-
- if(productsSpec.getId()!=null){
- updateList.add(productsSpec);
- }else{
- insertList.add(productsSpec);
- }
- }
-
- if(specValuesSet.size()!=productsSpecList.size()){
- throw new ServiceException("规格商品不能有重复的规格");
- }
- if(minPrice!=-1){
- products.setBasePrice(minPrice);
- }
- if(minIntegral!=-1){
- products.setBaseIntegral(minIntegral);
-
- }
- products.setTotalStock(stock);
-
-
-
- // 更新规格信息
- int count = 0;
- for (ProductsSpec productsSpec : updateList) {
- if (productsSpecMapper.updateProductsSpec(productsSpec) > 0) {
- count++;
- }
- }
- for(ProductsSpec productsSpec:insertList){
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(ProductsSpec::getProductId, productsSpec.getProductId());
- queryWrapper.eq(ProductsSpec::getSpecValues, productsSpec.getSpecValues());
- if(this.count(queryWrapper)>0){
- throw new ServiceException("存在重复规格商品数据,保存失败");
- }
- if(this.save(productsSpec)){
- count++;
- }
- }
- if(count!=productsSpecList.size()){
- throw new ServiceException("保存失败");
- }
- // 更新商品信息
- // productsService.updateProducts(products);
-
- // 商品就更新了个库存,直接更新不做校验
- return productsService.updateProductsDirect(products)>0;
-
- }
-
- /**
- * 来源于ProductsController商品更新
- * 更新商品信息,保存规格信息
- * @param products
- * @return
- */
- @Override
- @Transactional
- public int commonUpdateProducts(Products products) {
- int count=0;
- int specSize =0;
- // 需要校验是否修改商品的库存信息
- Products oldProducts = productsService.selectProductsByProductId(products.getProductId());
- if(oldProducts==null){
- throw new ServiceException("商品不存在");
- }
-
- // 暂时不允许单规格变为多规格
- // 单独规格变多规格
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs()) && Constants.SINGLE_SPEC.equals(oldProducts.getIsSpecs())) {
- // products.setTotalStock(0);
- // throw new ServiceException("单品无法修改为多规格");
- // 单变多
- // 更新products信息,products的价格,积分,返还积分都要重新计算
- int stock = 0;
- int minPrice = -1;
- int minIntegral = -1;
- // 多规格商品的库存添加对应规格商品时,自动累加
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs())) {
- List productsSpecList = products.getProductsSpecList();
- if (productsSpecList == null || productsSpecList.size() == 0) {
- throw new ServiceException("多规格商品至少设置一种规格");
- }
- specSize = productsSpecList.size();
- for (ProductsSpec productsSpec : productsSpecList) {
- if (productsSpec.getStock() == null || productsSpec.getStock() < 0) {
- throw new ServiceException("商品库存不能为空且不能小于0");
- }
- minPrice = minPrice == -1 ? productsSpec.getPrice() : Math.min(minPrice, productsSpec.getPrice());
- minIntegral = minIntegral == -1 ? productsSpec.getIntegral() : Math.min(minIntegral, productsSpec.getIntegral());
- stock += productsSpec.getStock();
- }
-
- // 校验数量是否一致
- // if(products.getTotalStock() != stock){
- // throw new ServiceException("商品库存与各规格库存之和不一致");
- // }
- products.setTotalStock(stock);
- products.setBasePrice(minPrice);
- products.setBaseIntegral(minIntegral);
-
- }
- products = preDealProductsAndSpec(products);
- if (products != null) {
- List productsSpecList = products.getProductsSpecList();
- this.preDealMultisSpecProducts(products);
- // 保存规格信息
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs()) && !CollectionUtils.isEmpty(productsSpecList)) {
- for(ProductsSpec productsSpec : productsSpecList){
- productsSpec.setProductId(products.getProductId());
- productsSpec.setType(products.getType());
- if(StringUtils.isBlank(productsSpec.getSpecImage())){
- productsSpec.setSpecImage(null);
- }
- count += productsSpecMapper.insert(productsSpec);
-
- }
- }
- }
-
- // 更新products
- products = preDealProductsAndSpec(products);
- count += productsService.updateProductsDirect(products);
- if(count!=specSize+1){
- throw new ServiceException("商品信息更新失败");
- }
-
- return count;
- }
-
-
- // 商品为多规格商品,且修改了库存数目
- if (oldProducts.getIsSpecs().equals(Constants.MULTI_SPEC) && !oldProducts.getTotalStock().equals(products.getTotalStock())) {
- throw new ServiceException("多规格商品不允许直接修改商品库存,请修改具体规格下的商品库存");
- }
-
-
- // 多规格商品变单规格商品,清除多规格商品
- if (Constants.SINGLE_SPEC.equals(products.getIsSpecs()) && Constants.MULTI_SPEC.equals(oldProducts.getIsSpecs())) {
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(ProductsSpec::getProductId, products.getProductId());
- productsSpecMapper.delete(queryWrapper);
- }
-
- // 商品的购买类型发生变动
- // 商品购买类型发生变动,多规格需要提示信息
- if (!oldProducts.getType().equals(products.getType())) {
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs())) {
- throw new ServiceException("多规格商品不允许修改购买类型");
- }
-
-
- }
- // 求出最小值
- Map map=productsSpecMapper.selectMinOne(products.getProductId());
- products.setBasePrice(map.get("price") == null ? 0 :map.get("price").intValue());
- products.setBaseIntegral(map.get("integral") == null ? 0 : map.get("integral").intValue());
-
- products = preDealProductsAndSpec(products);
- return productsService.updateProductsDirect(products);
- }
-
- /**
- * 修改商品信息,前端传过来的是但规格商品
- * @param products
- * @return
- */
- @Transactional
- @Override
- public boolean updateSingleProducts(Products products) {
- // 校验products的基本信息
- Products oldProducts = productsService.selectProductsByProductId(products.getProductId());
- if(oldProducts==null){
- throw new ServiceException("商品不存在");
- }
- String type= products.getType();
- switch (type) {
- case Constants.GOODS_MONEY_BUY:
- if (products.getBasePrice() == null || products.getBasePrice() <= 0) {
- throw new ServiceException("商品购买类型为金额购买时,商品价格不能为空且必须大于0");
- }
- products.setBaseIntegral(0);
- break;
- case Constants.GOODS_INTEGRAL_BUY:
- if (products.getBaseIntegral() == null || products.getBaseIntegral() <= 0) {
- throw new ServiceException("商品购买类型为积分兑换时,商品所需积分不能为空且必须大于0");
- }
- products.setBasePrice(0);
- break;
- default:
- throw new ServiceException("商品购买类型错误");
- }
-
- // 校验库存信息
- if(products.getTotalStock() == null || products.getTotalStock() < 0){
- throw new ServiceException("商品库存不能为空且不能小于0");
- }
-
- //设置
- // 2.原来是单规格的直接更新;非但规格的清空规格商品信息在更新商品信息
- if(Constants.MULTI_SPEC.equals(oldProducts.getIsSpecs())){
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(ProductsSpec::getProductId, products.getProductId());
- productsSpecMapper.delete(queryWrapper);
- }
- int count= productsService.updateProductsDirect(products);
- return count>0;
- }
-
- /**
- * 前端传入的商品节点信息是
- * @param products
- * @return
- */
- @Override
- @Transactional
- public boolean updateMulSpecProducts(Products products) {
-
- // 不允许单规格变多规格的实现
- // 需要校验是否修改商品的库存信息
- Products oldProducts = productsService.selectProductsByProductId(products.getProductId());
- if(oldProducts==null){
- throw new ServiceException("商品不存在");
- }
- if(Constants.MULTI_SPEC.equals(oldProducts.getIsSpecs()) ){
- // 多规格的限制,不更新basePrice,baseIntegral,totalStock,type(多规格的type没法变动)
- if(!products.getType().equals(oldProducts.getType())){
- throw new ServiceException("多规格商品不允许修改购买类型");
- }
-
- // 库存不进行修改
- products.setBasePrice(oldProducts.getBasePrice());
- products.setBaseIntegral(oldProducts.getBaseIntegral());
- products.setTotalStock(oldProducts.getTotalStock());
-
- int count=productsService.updateProductsDirect(products);
- return count>0;
- }
-
- // 暂定但规格无法转变为多规格
- if(Constants.SINGLE_SPEC.equals(oldProducts.getIsSpecs())){
- throw new ServiceException("单规格商品不允许修改为多规格商品");
-
- // 允许添加多规格逻辑
-
- }
- return false;
- }
-
-
- public Products preDealProductsAndSpec(Products products) {
- if (products == null) {
- return null;
- }
- // 购买类型校验
- switch (products.getType()) {
- // 自动设置所需积分为0
- case Constants.GOODS_MONEY_BUY:
- if (products.getBasePrice() == null || products.getBasePrice() < 0) {
- throw new ServiceException("商品购买类型为金额购买时,商品基础价格不能为空且不能小于0");
- }
- products.setBaseIntegral(0);
- break;
- // 自动设置价格为0
- case Constants.GOODS_INTEGRAL_BUY:
- if (products.getBaseIntegral() == null || products.getBaseIntegral() < 0) {
- throw new ServiceException("商品购买类型为积分购买时,商品所需积分不能为空且不能小于0");
- }
- products.setBasePrice(0);
- break;
- default:
- throw new ServiceException("商品购买类型错误");
- }
-
- return products;
- }
-
- public void dealProductsSpecArrayToValues(ProductsSpec productsSpec) {
- List> specValueArray = productsSpec.getSpecValueArray();
- if (specValueArray == null || specValueArray.size() == 0) {
- throw new RuntimeException("多规格商品必须指定具体规格");
- }
- if (specValueArray.size() > maxSpecTypeCount) {
- throw new RuntimeException("多规格商品最多只能设置" + maxSpecTypeCount + "个规格");
- }
-
- StringBuilder valueItems = new StringBuilder();
- for (List item : specValueArray) {
- if (CollectionUtils.isEmpty(item) || item.size() != 2) {
- throw new RuntimeException("多规格商品必须具体规格有误");
- }
- valueItems.append(item.get(1)).append(",");
- }
- valueItems.deleteCharAt(valueItems.length() - 1);
-
- productsSpec.setSpecValues(valueItems.toString());
- }
-
-
-
- private void dealProductsSpec(Products products, List productsSpecs) {
- if (products == null) {
- return;
- }
- if (CollectionUtils.isEmpty(productsSpecs)) {
- return;
- }
-
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs())) {
- Integer minPrice = -1;
- Integer minIntegral = -1;
- for (ProductsSpec ps : productsSpecs) {
- minPrice = minPrice == -1 ? ps.getPrice() : Math.min(minPrice, ps.getPrice());
- minIntegral = minIntegral == -1 ? ps.getIntegral() : Math.min(minIntegral, ps.getIntegral());
- }
- if (minPrice != -1) {
- products.setBasePrice(minPrice);
- }
- if (minIntegral != -1) {
- products.setBaseIntegral(minIntegral);
- }
-
- }
- }
-
- /**
- * 如果该商品列表中存在商品只有一个商品规格信息,
- * 删除规格后会自动将该商品库存置0,设置为非多规格商品,并下架(因为库存为0);
- * 并将该商品加入列表中返回给前端
- *
- * @param list
- * @return
- */
- @Transactional
- @Override
- public AjaxResult removeProductsByIds(List list) {
- List lastProducts = new ArrayList<>();
- for (Integer id : list) {
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(ProductsSpec::getId, id);
- ProductsSpec productsSpec = getOne(queryWrapper);
-
- Products products = productsService.selectProductsByProductId(productsSpec.getProductId());
- if (productsSpec == null || products == null) {
- continue;
- }
- // 判断是否为最后一个规格
- queryWrapper.clear();
- queryWrapper.eq(ProductsSpec::getProductId, productsSpec.getProductId());
- List productsSpecs = list(queryWrapper);
- // 修改库存
- products.setTotalStock(products.getTotalStock() - productsSpec.getStock());
- products.setUpdateTime(DateUtils.getNowDate());
- products.setOperId(getLoginUser().getUser().getUserId());
- boolean isLast = productsSpecs.size() == 1;
- // 最后一个规格:
- if (isLast) {
- return AjaxResult.error("多规格商品至少要有一个规格商品,如果确实需要删除,请直接删除商品");
- }
- removeById(id);
-
- // 设置products的最小值
- // 查询 price 的最小值
- Map map=productsSpecMapper.selectMinOne(products.getProductId());
- products.setBasePrice(map.get("price")==null?0:map.get("price").intValue());
- products.setBaseIntegral(map.get("integral")==null?0:map.get("integral").intValue());
- boolean isUpdate = productsService.updateProductsDirect(products)>0;
- if (!isUpdate) {
- throw new RuntimeException("删除失败");
- }
- lastProducts.add(products);
- }
-
- return AjaxResult.success("删除成功").put("data", lastProducts);
- }
-
- @Override
- public List listWithProductSpecValues(LambdaQueryWrapper queryWrapper) {
- List productsSpecs = list(queryWrapper);
- if (productsSpecs == null || productsSpecs.size() == 0) {
- return Collections.emptyList();
- }
- for (ProductsSpec productsSpec : productsSpecs) {
- String specValues = productsSpec.getSpecValues();
- List specValuesIds = new ArrayList<>();
- if (StringUtils.isBlank(specValues)) {
- continue;
- }
- if (!specValues.contains(",")) {
- specValuesIds.add(Integer.parseInt(specValues));
- } else {
- specValuesIds = Arrays.stream(specValues.split(",")).map(Integer::parseInt).collect(Collectors.toList());
- }
- List list = specValuesServiceImpl.queryByIds(specValuesIds);
- productsSpec.setSpecValuesList(list);
- String specStr = SpecUtils.getSpecStr(list);
- productsSpec.setSpecStr(specStr);
-
- }
- return productsSpecs;
- }
-
- /**
- * 对productSpec预处理,
- * 按照对应value的id对应specType的id由低到高排序
- *
- * @param productsSpec
- * @return
- */
- @Override
- public ProductsSpec preDealSpecValues(ProductsSpec productsSpec) {
- if (productsSpec == null || StringUtils.isBlank(productsSpec.getSpecValues())) {
- return productsSpec;
- }
- // 规格值在系统中是否存在校验
- List specValueIdList = productsSpec.getSpecValuesIds();
- if (specValueIdList.size() > 0) {
- // 逐个校验规格类型
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.in(SpecValues::getId, specValueIdList);
- queryWrapper.eq(SpecValues::getMerchantId, productsSpec.getMerchantId());
- List valuesList = specValuesServiceImpl.list(queryWrapper);
- int listSize = valuesList == null ? 0 : valuesList.size();
- if (listSize != specValueIdList.size()) {
- throw new ServiceException("部分规格在系统中不存在请检查");
- }
-
- // 存在多个valueList需要重新排序
- if (valuesList.size() > 1) {
- // 获取specTypeList
- List specTypeList = valuesList.stream()
- .map(SpecValues::getSpecType)
- .distinct()
- .sorted()
- .collect(Collectors.toList());
-
- if (specTypeList.size() != specValueIdList.size()) {
- throw new ServiceException("每种类型的规格值至多为一个");
- }
-
- // 重新排序
- Collections.sort(valuesList, Comparator.comparingInt(SpecValues::getSpecType));
-
- List collect = valuesList.stream().map(SpecValues::getId).collect(Collectors.toList());
- productsSpec.setSpecValues(StringUtils.join(collect, ","));
-
- }
-
- }
-
-
- return productsSpec;
-
- }
-
- /**
- * 插入/修改商品规格,对商品规格对象进行预处理
- *
- * @param products
- * @return
- */
- @Override
- public ProductsSpec preDealProductsSpec(Products products, ProductsSpec productsSpec) {
-
- if (products == null || productsSpec == null) {
- throw new ServiceException("商品或商品规格不能为空");
- }
- // 修改时不会修改规格类型
- productsSpec.setType(products.getType());
- // if (!products.getType().equals(productsSpec.getType())) {
- // throw new ServiceException("商品购买类型与商品规格购买类型必须要保持一致");
- // }
- // 购买类型校验
- switch (productsSpec.getType()) {
- // 自动设置所需积分为0
- case Constants.GOODS_MONEY_BUY:
- if (productsSpec.getPrice() == null || productsSpec.getPrice() <= 0) {
- throw new ServiceException("商品购买类型为金额购买时,商品价格不能为空且必须大于0");
- }
- productsSpec.setIntegral(0);
- break;
- // 自动设置价格为0
- case Constants.GOODS_INTEGRAL_BUY:
- if (productsSpec.getIntegral() == null || productsSpec.getIntegral() <= 0) {
- throw new ServiceException("商品购买类型为积分购买时,商品所需积分不能为空且不能小于0");
- }
- productsSpec.setPrice(0);
- break;
- default:
- throw new ServiceException("商品购买类型错误");
- }
-
- return productsSpec;
- }
-
- @Transactional(rollbackFor = Exception.class)
- @Override
- public boolean addWithSpec(Products products) {
-
- // 单规格商品处理
- if(Constants.SINGLE_SPEC.equals(products.getIsSpecs())){
- boolean flag = productsService.insertProducts(products) > 0;
- return flag;
- }
-
- // 多规格处理
- int stock = 0;
- int minPrice = -1;
- int minIntegral = -1;
- // 多规格商品的库存添加对应规格商品时,自动累加
- // 计算商品基本信息: 库存,最小价格,最小积分
- //代替preDealProducts_addWithSpec方法
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs())) {
- List productsSpecList = products.getProductsSpecList();
- if (productsSpecList == null || productsSpecList.size() == 0) {
- throw new ServiceException("多规格商品至少设置一种规格");
- }
- for (ProductsSpec productsSpec : productsSpecList) {
- if (productsSpec.getStock() == null || productsSpec.getStock() < 0) {
- throw new ServiceException("商品库存不能为空且不能小于0");
- }
-
- // 处理商品规格信息填充
- // 插入商品商品才会有productId
- // productsSpec.setProductId(products.getProductId());
- productsSpec.setMerchantId(products.getMerchantId());
- productsSpec.setType(products.getType());
- dealProductsSpecArrayToValues(productsSpec);
- productsSpec = preDealSpecValues(productsSpec);
- productsSpec.setOperId(products.getOperId());
- productsSpec.setCreateTime(DateUtils.getNowDate());
-
- // 规格商品校验--代替preDealProductsSpec()方法
- String type= productsSpec.getType();
- switch (type) {
- case Constants.GOODS_MONEY_BUY:
- if (productsSpec.getPrice() == null || productsSpec.getPrice() <= 0) {
- throw new ServiceException("商品购买类型为金额购买时,商品价格不能为空且必须大于0");
- }
- productsSpec.setIntegral(0);
- break;
- case Constants.GOODS_INTEGRAL_BUY:
- if (productsSpec.getIntegral() == null || productsSpec.getIntegral() <= 0) {
- throw new ServiceException("商品购买类型为积分兑换时,商品所需积分不能为空且必须大于0");
- }
- productsSpec.setPrice(0);
- break;
- default:
- throw new ServiceException("商品购买类型错误");
- }
- minPrice = minPrice == -1 ? productsSpec.getPrice() : Math.min(minPrice, productsSpec.getPrice());
- minIntegral = minIntegral == -1 ? productsSpec.getIntegral() : Math.min(minIntegral, productsSpec.getIntegral());
- stock += productsSpec.getStock();
-
- if (productsSpec.getStock() < 0) {
- throw new ServiceException("规格商品的库存不能小于0");
- }
- }
-
- products.setTotalStock(stock);
- products.setBasePrice(minPrice);
- products.setBaseIntegral(minIntegral);
- // 不需要额外校验products的类别
-
- }
-
-
- // 保存商品信息
- // boolean flag = productsService.insertProductsAndSpec(products) > 0;
- boolean flag = productsService.insertProductsDirect(products) > 0;
-
- if (flag) {
- List productsSpecList = products.getProductsSpecList();
-
- // 保存规格信息
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs()) && !CollectionUtils.isEmpty(productsSpecList)) {
- for(ProductsSpec productsSpec : productsSpecList){
- // 设置product_id
- productsSpec.setProductId(products.getProductId());
- if(StringUtils.isBlank(productsSpec.getSpecImage())){
- productsSpec.setSpecImage(null);
- }
- }
- flag = this.saveBatch(productsSpecList);
- }
- }else{
- throw new ServiceException("商品保存失败");
- }
-
- return flag;
- }
-
- @Override
- public Products preDealMultisSpecProducts(Products products) {
- int stock = 0;
- if (products == null) {
- return null;
- }
- products.setCreateTime(DateUtils.getNowDate());
- // 是否对多规格处理
- List productsSpecList = products.getProductsSpecList();
- if (Constants.MULTI_SPEC.equals(products.getIsSpecs()) && !CollectionUtils.isEmpty(productsSpecList)) {
- for (ProductsSpec productsSpec : productsSpecList) {
- if (productsSpec.getStock() < 0) {
- throw new ServiceException("规格商品的库存不能小于0");
- }
-
- productsSpec.setProductId(products.getProductId());
- productsSpec.setMerchantId(products.getMerchantId());
- productsSpec.setType(products.getType());
-
-
- productsSpec = preDealProductsSpec(products, productsSpec);
- dealProductsSpecArrayToValues(productsSpec);
- productsSpec = preDealSpecValues(productsSpec);
- productsSpec.setOperId(products.getOperId());
- productsSpec.setCreateTime(DateUtils.getNowDate());
-
- stock += productsSpec.getStock();
- }
- }
- products.setTotalStock(stock);
- return products;
- }
-
-
-
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/RepoRecordServiceImpl.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/RepoRecordServiceImpl.java
new file mode 100644
index 0000000..67f71d3
--- /dev/null
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/RepoRecordServiceImpl.java
@@ -0,0 +1,152 @@
+package com.zf.foodpurchase.fdsafe.service.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zf.foodpurchase.common.core.domain.AjaxResult;
+import com.zf.foodpurchase.common.core.domain.entity.SysUser;
+import com.zf.foodpurchase.fdsafe.entity.*;
+import com.zf.foodpurchase.fdsafe.mapper.FoodProductMapper;
+import com.zf.foodpurchase.fdsafe.mapper.FoodRepoMapper;
+import com.zf.foodpurchase.fdsafe.mapper.RepoRecordMapper;
+import com.zf.foodpurchase.fdsafe.mapper.SchoolOrderItemMapper;
+import com.zf.foodpurchase.fdsafe.service.IRepoRecordService;
+import com.zf.foodpurchase.fdsafe.vo.FoodProductCKVO;
+import com.zf.foodpurchase.fdsafe.vo.RepoRecordVO;
+import com.zf.foodpurchase.system.service.ISysUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+@Service
+public class RepoRecordServiceImpl extends ServiceImpl implements IRepoRecordService {
+
+ @Autowired
+ private RepoRecordMapper repoRecordMapper;
+ @Autowired
+ private FoodProductMapper foodProductsMapper;
+ @Autowired
+ private SchoolOrderItemMapper schoolOrderItemMapper;
+ @Autowired
+ private SchoolOrderServiceImpl schoolOrderServiceImpl;
+ @Autowired
+ private SchoolOrderItemServiceImpl schoolOrderItemServiceImpl;
+
+ @Autowired
+ private FoodRepoMapper foodRepoMapper;
+
+ @Autowired
+ private ISysUserService userService;
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public AjaxResult inRepo(List inRepoVOs) {
+ SysUser user = userService.getUser();
+ inRepoVOs.forEach(inRepoVO -> {
+ Integer productId = inRepoVO.getFoodProductId();
+ Integer repoId = inRepoVO.getRepoId();
+ Integer productNum = inRepoVO.getProductNum() == null ? 0 : inRepoVO.getProductNum();
+ String orderNo = inRepoVO.getOrderNo();
+ String orderItemNo = inRepoVO.getOrderItemNo();
+ Integer supplierId = inRepoVO.getSupplierId();
+ Integer categoryId = inRepoVO.getTypeId();
+ Date date = new Date();
+ RepoRecord repoRecord = new RepoRecord();
+ repoRecord.setSupplierId(supplierId);
+ repoRecord.setApplyDate( date);
+ repoRecord.setProductId(productId);
+ repoRecord.setRepoId(repoId);
+ repoRecord.setProductNum(productNum);
+ repoRecord.setCategoryId(categoryId);
+ repoRecord.setStatus(1);
+ BigDecimal price = inRepoVO.getPrice() == null ? BigDecimal.ZERO : inRepoVO.getPrice();
+ BigDecimal totalCost = price.multiply(new BigDecimal(productNum));
+ repoRecord.setTotalCost(totalCost);
+ if(!user.isAdmin()){
+ repoRecord.setSchoolId(user.getSchoolId().longValue());
+ }
+ repoRecordMapper.insertRepoRecord(repoRecord);
+
+ FoodRepo oldFoodRepo = foodRepoMapper.selectByProductIdAndRepoId(productId.longValue(),repoId.longValue());
+ if(ObjectUtil.isNotNull(oldFoodRepo)){
+ Integer foodProductNumNew = oldFoodRepo.getFoodProductNum() + productNum;
+ oldFoodRepo.setFoodProductNum(foodProductNumNew);
+ foodRepoMapper.update(oldFoodRepo);
+ } else {
+ FoodRepo foodRepo = new FoodRepo();
+ foodRepo.setFoodProductId(productId);
+ foodRepo.setRepoId(repoId);
+ foodRepo.setOrderNo(orderNo);
+ foodRepo.setOrderItemNo(orderItemNo);
+ foodRepo.setFoodProductNum(productNum);
+ foodRepoMapper.insert(foodRepo);
+ }
+
+ LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>();
+ updateWrapper.eq(SchoolOrderItem::getOrderNo,orderNo);
+ updateWrapper.set(SchoolOrderItem::getOrderItemStatus,5);
+ updateWrapper.set(SchoolOrderItem::getUpdateTime,new Date());
+ schoolOrderItemServiceImpl.update(updateWrapper);
+ LambdaUpdateWrapper updateWrapper2 = new LambdaUpdateWrapper<>();
+ updateWrapper2.eq(SchoolOrder::getOrderNo,orderNo);
+ updateWrapper2.set(SchoolOrder::getOrderStatus,5);
+ updateWrapper2.set(SchoolOrder::getUpdateTime,new Date());
+ schoolOrderServiceImpl.update(updateWrapper2);
+ });
+ return AjaxResult.success();
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public AjaxResult outRepo(List foodProductCKVOs) {
+ SysUser user = userService.getUser();
+ for (FoodProductCKVO foodProductCKVO : foodProductCKVOs) {
+ Integer productId = foodProductCKVO.getFoodProductId().intValue();
+ Integer repoId = foodProductCKVO.getRepoId();
+ Integer productNum = foodProductCKVO.getFoodProductNum() == null ? 0 : foodProductCKVO.getFoodProductNum();
+ Integer supplierId = foodProductCKVO.getSupplierId();
+ Integer categoryId = foodProductCKVO.getTypeId();
+ Date date = new Date();
+ RepoRecord repoRecord = new RepoRecord();
+ repoRecord.setSupplierId(supplierId);
+ repoRecord.setApplyDate( date);
+ repoRecord.setProductId(productId);
+ repoRecord.setRepoId(repoId);
+ repoRecord.setProductNum(productNum);
+ repoRecord.setCategoryId(categoryId);
+ repoRecord.setStatus(1);
+ BigDecimal price = foodProductCKVO.getPrice() == null ? BigDecimal.ZERO : foodProductCKVO.getPrice();
+ BigDecimal totalCost = price.multiply(new BigDecimal(productNum));
+ repoRecord.setTotalCost(totalCost);
+ if(!user.isAdmin()){
+ repoRecord.setSchoolId(user.getSchoolId().longValue());
+ }
+ repoRecordMapper.insertRepoRecord(repoRecord);
+ FoodRepo oldFoodRepo = foodRepoMapper.selectByProductIdAndRepoId(productId.longValue(),repoId.longValue());
+ Integer foodProductNumNew = oldFoodRepo.getFoodProductNum() - productNum;
+ oldFoodRepo.setFoodProductNum(foodProductNumNew);
+ foodRepoMapper.update(oldFoodRepo);
+ }
+ return AjaxResult.success();
+ }
+
+ @Override
+ public RepoRecordVO selectRepoRecordByRepoRecordId(Long repoRecordId) {
+ return repoRecordMapper.selectRepoRecordByRepoRecordId(repoRecordId);
+ }
+
+ @Override
+ public List selectRepoRecordList(RepoRecord repoRecord) {
+ String productName = repoRecord.getProductName();
+ Integer categoryId = repoRecord.getCategoryId();
+ Integer repoId = repoRecord.getRepoId();
+ Date startTime = repoRecord.getStartTime();
+ Date endTime = repoRecord.getEndTime();
+ return repoRecordMapper.selectRepoRecordList(productName, categoryId, repoId, startTime, endTime);
+ }
+
+}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/RepositoryServiceImpl.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/RepositoryServiceImpl.java
index 6bf5988..59110bc 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/RepositoryServiceImpl.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/RepositoryServiceImpl.java
@@ -29,8 +29,8 @@ public class RepositoryServiceImpl extends ServiceImpl joinQueryList(Repository quryRepository) {
- return repositoryMapper.joinQueryList(quryRepository);
+ public List queryRepoList(Repository quryRepository) {
+ return repositoryMapper.queryRepoList(quryRepository);
}
@Override
@@ -47,16 +47,7 @@ public class RepositoryServiceImpl extends ServiceImpl updateWrapper = new LambdaUpdateWrapper<>();
- updateWrapper.eq(Repository::getMerchantId, repository.getMerchantId());
- updateWrapper.ne(Repository::getId, repository.getId());
- updateWrapper.ne(Repository::getDefaultRepo, Constants.REPO_UN_DEFAULT);
- updateWrapper.set(Repository::getDefaultRepo, Constants.REPO_UN_DEFAULT);
- update(updateWrapper);
- }
+ boolean update = updateById(repository);
return update ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/SchoolOrderItemServiceImpl.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/SchoolOrderItemServiceImpl.java
index 90771b3..239efef 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/SchoolOrderItemServiceImpl.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/SchoolOrderItemServiceImpl.java
@@ -7,6 +7,7 @@ import com.zf.foodpurchase.fdsafe.entity.SchoolOrderItem;
import com.zf.foodpurchase.fdsafe.mapper.SchoolOrderItemMapper;
import com.zf.foodpurchase.fdsafe.service.ISchoolOrderItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zf.foodpurchase.fdsafe.vo.ProductCountVO;
import com.zf.foodpurchase.fdsafe.vo.SchoolOrderItemVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -46,4 +47,5 @@ public class SchoolOrderItemServiceImpl extends ServiceImpl querySupplierOrderVO(SchoolOrderVO schoolOrderVO) {
+ List list = baseMapper.querySupplierOrderVO(schoolOrderVO);
+ return list;
+ }
@Override
public List querySchoolOrderVO(SchoolOrderVO schoolOrderVO) {
List list = baseMapper.querySchoolOrderVO(schoolOrderVO);
+ list.forEach(f ->{
+ SchoolOrderItemVO schoolOrderItemVO = new SchoolOrderItemVO();
+ schoolOrderItemVO.setOrderNo(f.getOrderNo());
+ List schoolOrderItems = schoolOrderItemService.querySchoolOrderItemVO(schoolOrderItemVO);
+ if(!CollectionUtils.isEmpty(schoolOrderItems)){
+ f.setSchoolOrderItemVOList(schoolOrderItems);
+ }
+ });
return list;
}
@@ -291,5 +306,15 @@ public class SchoolOrderServiceImpl extends ServiceImpl0){
+ return AjaxResult.success("订单签收成功");
+ }
+ return AjaxResult.error("订单签收失败");
+ }
+
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/SpecTypesServiceImpl.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/SpecTypesServiceImpl.java
deleted file mode 100644
index 03c193a..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/SpecTypesServiceImpl.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.zf.foodpurchase.fdsafe.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.zf.foodpurchase.common.core.domain.AjaxResult;
-import com.zf.foodpurchase.fdsafe.entity.SpecTypes;
-import com.zf.foodpurchase.fdsafe.entity.SpecValues;
-import com.zf.foodpurchase.fdsafe.mapper.SpecTypesMapper;
-import com.zf.foodpurchase.fdsafe.service.ISpecTypesService;
-import com.zf.foodpurchase.fdsafe.service.ISpecValuesService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- *
- * 商品规格类型表 服务实现类
- *
- *
- * @author lilj
- * @since 2024-11-16
- */
-@Service
-public class SpecTypesServiceImpl extends ServiceImpl implements ISpecTypesService {
-
- @Autowired
- private ISpecValuesService specValuesService;
-
- @Override
- public AjaxResult saveTypes(SpecTypes specTypes) {
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(SpecTypes::getSpecName, specTypes.getSpecName());
- queryWrapper.eq(SpecTypes::getMerchantId, specTypes.getMerchantId());
- if (this.count(queryWrapper) > 0) {
- return AjaxResult.error("规格类型已存在,不能重复添加");
- }
- boolean result =this.save(specTypes);
- return result?AjaxResult.success("添加成功"):AjaxResult.error("添加失败");
- }
-
- @Override
- public AjaxResult removeSpecTypes(List list,Long merchantId) {
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.in(SpecValues::getSpecType, list);
- if (specValuesService.count(queryWrapper) > 0) {
- return AjaxResult.error("该规格类型下有规格值,请先删除规格值");
- }
- // 管理员删除所有,非管理员删除其所在部门下
- LambdaQueryWrapper deleteWrapper = new LambdaQueryWrapper<>();
- deleteWrapper.in(SpecTypes::getSpecType, list);
- if(merchantId!=null){
- deleteWrapper.eq(SpecTypes::getMerchantId,merchantId);
- }
- this.remove(deleteWrapper);
- return AjaxResult.success("删除成功");
- }
-
- @Override
- public AjaxResult updateType(SpecTypes specTypes, boolean admin) {
- LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>();
- updateWrapper.eq(SpecTypes::getSpecType, specTypes.getSpecType());
- if (admin) {
- updateWrapper.eq(SpecTypes::getMerchantId, specTypes.getMerchantId());
- }
- boolean flag=this.update(specTypes, updateWrapper);
- return flag?AjaxResult.success("修改成功"):AjaxResult.error("修改失败");
- }
-
- public void preValidateInsert(SpecTypes specTypes){
- }
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/SpecValuesServiceImpl.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/SpecValuesServiceImpl.java
deleted file mode 100644
index 14654de..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/service/impl/SpecValuesServiceImpl.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package com.zf.foodpurchase.fdsafe.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.zf.foodpurchase.common.core.domain.AjaxResult;
-import com.zf.foodpurchase.fdsafe.entity.ProductsSpec;
-import com.zf.foodpurchase.fdsafe.entity.SpecValues;
-import com.zf.foodpurchase.fdsafe.mapper.ProductsSpecMapper;
-import com.zf.foodpurchase.fdsafe.mapper.SpecValuesMapper;
-import com.zf.foodpurchase.fdsafe.service.ISpecValuesService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- *
- * 规格值表 服务实现类
- *
- *
- * @author lilj
- * @since 2024-11-16
- */
-@Service
-public class SpecValuesServiceImpl extends ServiceImpl implements ISpecValuesService {
-
- @Autowired
- private SpecValuesMapper specValuesMapper;
-
- @Autowired
- private ProductsSpecMapper productsSpecMapper;
-
- @Override
- public List queryList(SpecValues specValues) {
- return specValuesMapper.queryList(specValues);
- }
-
- @Override
- public List queryByIds(List specValuesIds) {
- return specValuesMapper.queryByIds(specValuesIds);
- }
-
- @Override
- public AjaxResult updateSpecValues(SpecValues specValues,boolean isAdmin) {
- LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>();
- updateWrapper.eq(SpecValues::getId,specValues.getId());
- if(!isAdmin){
- updateWrapper.eq(SpecValues::getMerchantId,specValues.getMerchantId());
- }
- int count=specValuesMapper.update(specValues,updateWrapper);
- return count>0 ? AjaxResult.success("修改成功"):AjaxResult.error("修改失败");
- }
-
- @Override
- public AjaxResult removeValues(List idList, Long merchantId) {
- // todo:判断商品规格表有无关联商品
- for (Long id : idList) {
- List list = productsSpecMapper.selectList(new LambdaQueryWrapper().like(ProductsSpec::getSpecValues, id));
- if (list != null && list.size() > 0) {
- return AjaxResult.error("该规格类型下有商品关联,请先解除关联");
- }
- }
-
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.in(SpecValues::getId,idList);
- if(merchantId!=null){
- queryWrapper.eq(SpecValues::getMerchantId,merchantId);
- }
- if(specValuesMapper.delete(queryWrapper)>0){
- return AjaxResult.success("删除成功");
- }
- return AjaxResult.error("删除失败");
- }
-
-
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/utils/ImagesPrefixUtil.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/utils/ImagesPrefixUtil.java
deleted file mode 100644
index 360963c..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/utils/ImagesPrefixUtil.java
+++ /dev/null
@@ -1,286 +0,0 @@
-package com.zf.foodpurchase.fdsafe.utils;
-
-import com.zf.foodpurchase.common.config.RuoYiConfig;
-import com.zf.foodpurchase.common.utils.StringUtils;
-import com.zf.foodpurchase.fdsafe.entity.CartItem;
-import com.zf.foodpurchase.fdsafe.entity.OrderItem;
-import com.zf.foodpurchase.fdsafe.entity.Products;
-import com.zf.foodpurchase.fdsafe.entity.ProductsSpec;
-
-import java.util.List;
-
-/**
- * @author:lilj
- * @date:2024/11/27
- */
-public class ImagesPrefixUtil {
- public static void productImageDeals(List productsList) {
- for (Products products : productsList) {
- String images = products.getImages();
- if(StringUtils.isNotBlank(images)){
- if (images.contains(",")) {
- String[] imageArray = images.split(",");
- for (int i = 0; i < imageArray.length; i++) {
- if(!imageArray[i].contains("http")){
- imageArray[i] = RuoYiConfig.getImagePrefix()+ imageArray[i];
- }
- }
- products.setImages(String.join(",", imageArray));
- products.setFirstImage(imageArray[0]);
- products.setImagesArray(imageArray);
- } else {
- if(!images.contains("http")){
- images = RuoYiConfig.getImagePrefix()+ images;
- }
- products.setFirstImage( images);
- products.setImages(images);
- products.setImagesArray(new String[]{images});
- }
- }
-
-
- String detailImages = products.getDetailImages();
- if (StringUtils.isBlank(detailImages)) {
- continue;
- }
- if (detailImages.contains(",")) {
- String[] imageArray = detailImages.split(",");
- for (int i = 0; i < imageArray.length; i++) {
- if(!imageArray[i].contains("http")){
- imageArray[i] = RuoYiConfig.getImagePrefix()+ imageArray[i];
- }
- }
- products.setFirstDetailsImage(imageArray[0]);
- products.setDetailImages(String.join(",", imageArray));
- products.setDetailImagesArray(imageArray);
- } else {
- if(!detailImages.contains("http")){
- detailImages = RuoYiConfig.getImagePrefix()+ detailImages;
- }
- products.setFirstDetailsImage(detailImages);
- products.setDetailImages(detailImages);
- products.setDetailImagesArray(new String[]{detailImages});
- }
- }
-
- }
-
- public static void productImageDeals(Products products) {
- String images = products.getImages();
- if (StringUtils.isNotBlank(images)) {
- if (images.contains(",")) {
- String[] imageArray = images.split(",");
- products.setFirstImage(imageArray[0]);
- for (int i = 0; i < imageArray.length; i++) {
- if(!imageArray[i].contains("http")){
- imageArray[i] = RuoYiConfig.getImagePrefix()+ imageArray[i];
- }
- }
- products.setImages(String.join(",", imageArray));
- products.setImagesArray(imageArray);
- } else {
- if(!images.contains("http")){
- images = RuoYiConfig.getImagePrefix()+ images;
- }
- products.setFirstImage(images);
- products.setImages(images);
- products.setImagesArray(new String[]{images});
- }
- }
-
-
- String detailImages = products.getDetailImages();
- if (StringUtils.isBlank(detailImages)) {
- return;
- }
- if (detailImages.contains(",")) {
- String[] imageArray = detailImages.split(",");
- for (int i = 0; i < imageArray.length; i++) {
- if(!imageArray[i].contains("http")){
- imageArray[i] = RuoYiConfig.getImagePrefix()+ imageArray[i];
- }
- }
- products.setFirstDetailsImage(imageArray[0]);
- products.setDetailImages(String.join(",", imageArray));
- products.setDetailImagesArray(imageArray);
- } else {
- if(!detailImages.contains("http")){
- detailImages = RuoYiConfig.getImagePrefix()+ detailImages;
- }
- products.setFirstDetailsImage(detailImages);
- products.setDetailImages(detailImages);
- products.setDetailImagesArray(new String[]{detailImages});
-
- }
- }
-
- public static void productSpecImageDeals(List productsSpecs) {
- for (ProductsSpec productsSpec : productsSpecs) {
- String images = productsSpec.getSpecImage();
- if (StringUtils.isBlank(images)) {
- continue;
- }
- if (images.contains(",")) {
- String[] imageArray = images.split(",");
- productsSpec.setFirstSpecImage(imageArray[0]);
- for (int i = 0; i < imageArray.length; i++) {
- if(!imageArray[i].contains("http")){
- imageArray[i] = RuoYiConfig.getImagePrefix()+ imageArray[i];
- }
- }
-
- productsSpec.setSpecImage(String.join(",", imageArray));
- productsSpec.setSpecImagesArray(imageArray);
- } else {
- if(!images.contains("http")){
- images = RuoYiConfig.getImagePrefix()+ images;
- }
- productsSpec.setFirstSpecImage(images);
- productsSpec.setSpecImage(images);
- productsSpec.setSpecImagesArray(new String[]{images});
- }
- }
-
- }
-
- public static void productSpecImageDeals(ProductsSpec productsSpec) {
-
- String images = productsSpec.getSpecImage();
- if (StringUtils.isBlank(images)) {
- return;
- }
- if (images.contains(",")) {
- String[] imageArray = images.split(",");
-
- for (int i = 0; i < imageArray.length; i++) {
- if(!imageArray[i].contains("http")){
- imageArray[i] = RuoYiConfig.getImagePrefix()+ imageArray[i];
- }
- }
- productsSpec.setFirstSpecImage(imageArray[0]);
- productsSpec.setSpecImage(String.join(",", imageArray));
- productsSpec.setSpecImagesArray(imageArray);
- } else {
- if(!images.contains("http")){
- images = RuoYiConfig.getImagePrefix()+ images;
- }
- productsSpec.setFirstSpecImage(images);
- productsSpec.setSpecImage(images);
- productsSpec.setSpecImagesArray(new String[]{images});
- }
- }
-
-
- public static void cartItemImage(CartItem item, Products products) {
- String images = products.getImages();
- String firstImage = getFirstImage(images);
- item.setImage(firstImage);
- }
-
- public static void cartItemImage(CartItem item, ProductsSpec spec) {
- String images = spec.getSpecImage();
- String firstImage = getFirstImage(images);
- item.setImage(firstImage);
- }
-
-
- /**
- * 处理查询的出的orderItem的图片参数信息
- */
- public static void dealOrderItemPic(OrderItem item){
- if(item == null || StringUtils.isBlank(item.getProductPicUrl()) ){
- return;
- }
- String picUrl = item.getProductPicUrl();
- String firstImage= getFirstImage(picUrl);
- item.setProductPicUrl(firstImage);
-
- }
-
- /**
- * 批量处理
- * @param list
- */
- public static void dealOrderItemPics(List list){
- for(OrderItem item:list){
- dealOrderItemPic(item);
- }
- }
-
- public static String imagesDeal(String images){
- if (StringUtils.isBlank(images)) {
- return null;
- }
- if (images.contains(",")) {
- String[] imageArray = images.split(",");
- for (int i = 0; i < imageArray.length; i++) {
- if(!imageArray[i].contains("http")){
- imageArray[i] = RuoYiConfig.getImagePrefix()+ imageArray[i];
- }
- }
- images = String.join(",", imageArray);
- }else {
- if (!images.contains("http")) {
- images = RuoYiConfig.getImagePrefix() + images;
- }
- }
- return images;
- }
-
-
- /**
- * 轮播图是商户上传的轮播图,对应的路径应该为商户的路径
- * @param sourceStr
- * @param firstImages
- * @param destStr
- */
- public static void dealImagesPath(String sourceStr,StringBuilder firstImages,StringBuilder destStr){
- String images = sourceStr;
- if (images == null) {
- firstImages=null;
- destStr=null;
- return;
- }
- if (images.contains(",")) {
- String[] imageArray = images.split(",");
- for (int i = 0; i < imageArray.length; i++) {
- if(!imageArray[i].contains("http")){
- imageArray[i] = RuoYiConfig.getImagePrefix() + imageArray[i];
- }
- destStr.append(imageArray[i]).append(",");
- }
- if(destStr.length()>1){
- destStr.deleteCharAt(destStr.length()-1);
- }
- firstImages .append( imageArray[0]);
- } else {
- if(!images.contains("http")){
- images = RuoYiConfig.getImagePrefix()+ images;
- }
- firstImages.append(images);
- destStr.append(images);
- }
- }
-
-
- public static String getFirstImage(String sourceStr){
- String firstImage=null;
- if (StringUtils.isBlank(sourceStr)) {
- return null;
- }
- if (sourceStr.contains(",")) {
- String[] imageArray = sourceStr.split(",");
- firstImage = imageArray[0];
- if(!firstImage.contains("http")){
- firstImage = RuoYiConfig.getImagePrefix() + firstImage;
- }
- } else {
- if(!sourceStr.contains("http")){
- sourceStr = RuoYiConfig.getImagePrefix()+ sourceStr;
- }
- firstImage= sourceStr;
- }
- return firstImage;
- }
-
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/utils/SpecUtils.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/utils/SpecUtils.java
deleted file mode 100644
index 5eac517..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/utils/SpecUtils.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.zf.foodpurchase.fdsafe.utils;
-
-import com.zf.foodpurchase.fdsafe.entity.SpecValues;
-import org.springframework.util.CollectionUtils;
-
-import java.util.List;
-
-/**
- * @author:lilj
- * @date:2024/12/5
- */
-public class SpecUtils {
-
- public static String getSpecStr(List specValuesList) {
- if(CollectionUtils.isEmpty(specValuesList)){
- return null;
- }
- StringBuilder sb = new StringBuilder();
- for (SpecValues specValue : specValuesList) {
- sb.append(specValue.getSpecValue());
- if (specValue.getSpecUnit() != null) {
- sb.append(specValue.getSpecUnit());
- }
- sb.append(" ");
- }
- sb.deleteCharAt(sb.length() - 1);
- return sb.toString();
- }
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/FoodProductCKVO.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/FoodProductCKVO.java
new file mode 100644
index 0000000..4583be5
--- /dev/null
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/FoodProductCKVO.java
@@ -0,0 +1,25 @@
+package com.zf.foodpurchase.fdsafe.vo;
+
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class FoodProductCKVO {
+
+ private Long foodProductId;
+ private String num;
+ private String name;
+ private String repoName;
+ private String specName;
+ private Integer foodProductNum;
+ private String unitName;
+ private Integer supplierId;
+ private Integer typeId;
+ private Integer repoId;
+ private Long deptId;
+ private BigDecimal price;
+ private String msg;
+
+}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/FoodProductVO.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/FoodProductVO.java
index e48cc06..1ff9094 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/FoodProductVO.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/FoodProductVO.java
@@ -1,20 +1,14 @@
package com.zf.foodpurchase.fdsafe.vo;
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
import com.zf.foodpurchase.common.valigroud.AddGroup;
import com.zf.foodpurchase.common.valigroud.CheckGroup;
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
import com.zf.foodpurchase.common.vo.CommonVO;
import lombok.Data;
-
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
-import java.time.LocalDateTime;
import java.util.Date;
/**
@@ -38,10 +32,12 @@ public class FoodProductVO extends CommonVO implements Serializable {
@NotNull(message = "食材id不能为空", groups = { AddGroup.class})
private Integer foodId;
+
+ private String num;
/**
* 商品名称
*/
- private String foodName;
+ private String name;
// 关联食材得到的信息
/**
@@ -57,14 +53,17 @@ public class FoodProductVO extends CommonVO implements Serializable {
@NotNull(message = "单价不能为空", groups = { AddGroup.class})
private BigDecimal price;
- // 规格单位信息
+ // 单位信息
private Integer unitId;
private String unitLabel;
+ // 单位信息
+ private Integer specId;
+ private String specLabel;
+
/**
* 供货商id
*/
- @NotNull(message = "供货商id不能为空", groups = {AddGroup.class})
private Integer supplierId;
/**
@@ -115,4 +114,8 @@ public class FoodProductVO extends CommonVO implements Serializable {
* 有效标志
*/
private Integer delFlag;
+
+ private Integer totalProductNum;
+
+ private Integer repoId;
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/FoodSpecVO.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/FoodSpecVO.java
new file mode 100644
index 0000000..106d7b8
--- /dev/null
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/FoodSpecVO.java
@@ -0,0 +1,51 @@
+package com.zf.foodpurchase.fdsafe.vo;
+
+import com.zf.foodpurchase.common.valigroud.AddGroup;
+import com.zf.foodpurchase.common.valigroud.UpdateGroup;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author:lilj
+ * @date:2025/4/17
+ */
+@Data
+public class FoodSpecVO implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 食材规格/单位id
+ */
+ @NotNull(message = "食材规格/单位id不能为空", groups = {UpdateGroup.class})
+ private Integer specId;
+
+ /**
+ * 食材规格
+ */
+ @NotBlank(message = "食材规格/单位不能为空", groups = {UpdateGroup.class, AddGroup.class})
+ private String specLabel;
+
+ /**
+ * 0 正常 1 停用
+ */
+ private Integer delFlag;
+
+ /**
+ * 创建时间
+ */
+ private Date createTime;
+
+ /**
+ * 更新时间
+ */
+ private Date updateTime;
+ /**
+ * 是否有效: 0 有效 1 无效
+ */
+ @NotNull(message = "是否有效不能为空", groups = {UpdateGroup.class, AddGroup.class})
+ private Integer status;
+}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/ProductCountVO.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/ProductCountVO.java
new file mode 100644
index 0000000..ababde0
--- /dev/null
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/ProductCountVO.java
@@ -0,0 +1,12 @@
+package com.zf.foodpurchase.fdsafe.vo;
+
+
+import lombok.Data;
+
+@Data
+public class ProductCountVO {
+
+ private Integer productId;
+ private String productName;
+ private Integer productNum;
+}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/ProductsSpecVO.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/ProductsSpecVO.java
deleted file mode 100644
index 6cd3298..0000000
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/ProductsSpecVO.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package com.zf.foodpurchase.fdsafe.vo;
-
-import com.zf.foodpurchase.common.utils.StringUtils;
-import com.zf.foodpurchase.fdsafe.entity.SpecValues;
-import lombok.Data;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * @author:lilj
- * @date:2024/12/2
- */
-@Data
-public class ProductsSpecVO {
-
- /**
- * 规格名
- */
- private String text;
-
- /**
- * 规格值id.
- */
- private Integer value;
-
- /**
- * 规格单位
- */
- private String unit;
-
- /**
- * 是否可选
- */
- private Boolean disabled;
-
- /**
- * 需要该属性辅助构建树形结构
- */
- private Integer parentId;
-
- /**
- * 唯一标识
- */
- private String uniqueKey;
-
- private String parentKey;
-
- List children;
-
- /**
- * 合并多个规格
- *
- * @param trees
- * @return
- */
-
- public static List mergeSpec(List> trees) {
- // Step 1: Create a map to store all nodes by their value
- Map nodeMap = new HashMap<>();
- for (List tree : trees) {
- for (ProductsSpecVO node : tree) {
- // nodeMap.put(node.getParentId() + ":" + node.getValue(), node);
- nodeMap.put(node.getUniqueKey(), node);
- }
- }
-
- // Step 2: Build the tree structure
- for (ProductsSpecVO node : nodeMap.values()) {
- String parentKey= node.getParentKey();
- if (parentKey != null && nodeMap.containsKey(parentKey)) {
- ProductsSpecVO parent = nodeMap.get(parentKey);
- if (parent.getChildren() == null) {
- parent.setChildren(new ArrayList<>());
- }
- parent.getChildren().add(node);
- // parent.getChildrenMap().put(node.getValue(), node);
- }
- }
-
- // Step 3: Collect root nodes (nodes with parentId == null)
- List rootNodes = new ArrayList<>();
- for (ProductsSpecVO node : nodeMap.values()) {
- if (node.getParentId() == null) {
- rootNodes.add(node);
- }
- }
-
- return rootNodes;
- }
-
- /**
- * 构建节点基本信息
- *
- * @param specValuesList
- * @param isDisabled
- * @return
- */
- public static List buildVOS(List specValuesList, Boolean isDisabled) {
-
- List productsSpecVOList = new ArrayList<>();
- List specTypeList = specValuesList.stream()
- .map(SpecValues::getSpecType)
- .distinct()
- .sorted()
- .collect(Collectors.toList());
-
-
- Map specTypeToSpecValueMap = specValuesList.stream()
- .collect(Collectors.toMap(
- SpecValues::getSpecType, // Key: specType
- value -> value // Value: specValue
- ));
-
-
- // 初始化根节点
- ProductsSpecVO preNod = null;
- for (int i = 0; i < specTypeList.size(); i++) {
- ProductsSpecVO node = new ProductsSpecVO();
- node = new ProductsSpecVO();
-
- SpecValues specValues =specTypeToSpecValueMap.get(specTypeList.get(i));
- if(StringUtils.isNotBlank(specValues.getSpecUnit())){
- node.setText(specValues.getSpecValue()+specValues.getSpecUnit());
-
- }else{
- node.setText(specValues.getSpecValue());
- }
- node.setValue(specValues.getId());
- node.setUnit(specValues.getSpecUnit());
- if (i == specValuesList.size() - 1) {
- node.setDisabled(isDisabled);
- } else {
- node.setDisabled(false);
- }
- if (i != 0) {
- node.setParentId(preNod.getValue());
- node.setUniqueKey(preNod.getUniqueKey()+":"+node.getValue());
- node.setParentKey(preNod.getUniqueKey());
- }else{
- node.setUniqueKey("0"+":"+node.getValue().toString());
- }
- productsSpecVOList.add(node);
- preNod = node;
-
- }
-
- return productsSpecVOList;
-
- }
-}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/RepoRecordVO.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/RepoRecordVO.java
new file mode 100644
index 0000000..bb7d60f
--- /dev/null
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/RepoRecordVO.java
@@ -0,0 +1,72 @@
+package com.zf.foodpurchase.fdsafe.vo;
+
+import com.zf.foodpurchase.fdsafe.entity.FoodProduct;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class RepoRecordVO {
+
+ /**
+ * 主键id
+ */
+ private Long id;
+
+ /**
+ * 申请日期
+ */
+ private Date applyDate;
+
+ /**
+ * 供应商id
+ */
+ private Long merchantId;
+
+ private String merchantName;
+
+ /**
+ * 类型id
+ */
+ private String categoryId;
+
+ private String categoryName;
+
+ /**
+ * 仓库id
+ */
+ private Integer repoId;
+
+ private String repoName;
+
+ /**
+ * 商品id
+ */
+ private Integer productId;
+
+ private List foodProducts;
+
+ /**
+ * 商品数量
+ */
+ private Integer productNum;
+
+ /**
+ * 商品总价,单位:分
+ */
+ private BigDecimal totalCost;
+
+ /**
+ * 出入库状态 1:入库, 0:出库
+ */
+ private Integer status;
+
+ private String statusName;
+
+ /**
+ * 说明
+ */
+ private String msg;
+}
\ No newline at end of file
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/SchoolCartItemVO.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/SchoolCartItemVO.java
index 9d0e441..b52a39e 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/SchoolCartItemVO.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/SchoolCartItemVO.java
@@ -15,6 +15,7 @@ import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
+import java.util.List;
/**
* @author:lilj
@@ -153,4 +154,6 @@ public class SchoolCartItemVO extends CommonVO implements Serializable {
*/
private Integer foodDelFlag;
+ private List deptIds;
+
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/SchoolOrderItemVO.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/SchoolOrderItemVO.java
index dfa1121..aa30d64 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/SchoolOrderItemVO.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/SchoolOrderItemVO.java
@@ -48,7 +48,7 @@ public class SchoolOrderItemVO extends CommonVO implements Serializable {
/**
* 商品id
*/
- private Long foodProductId;
+ private Integer foodProductId;
/**
* 食材名称
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/SchoolOrderVO.java b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/SchoolOrderVO.java
index 5ec8cbf..2aff8fb 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/SchoolOrderVO.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/fdsafe/vo/SchoolOrderVO.java
@@ -5,12 +5,14 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.zf.foodpurchase.common.vo.CommonVO;
+import com.zf.foodpurchase.fdsafe.entity.SchoolOrderItem;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
+import java.util.List;
/**
* @author:lilj
@@ -105,4 +107,14 @@ public class SchoolOrderVO extends CommonVO implements Serializable {
* 订单是否可参与结算:0 不可参与结算; 1 可参与结算
*/
private Integer orderSettleStatus;
+
+ private List schoolOrderItemVOList;
+
+ private String signPerson;
+
+ private Date signTime;
+
+ private String signImage;
+
+ private List deptIds;
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysDeptMapper.java b/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysDeptMapper.java
index f412d2d..a979bc8 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysDeptMapper.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysDeptMapper.java
@@ -123,4 +123,6 @@ public interface SysDeptMapper
public void updateTenantId(@Param("deptIds") List deptIds, @Param("tenantId") String tenantId);
public List selectAllZSByDeptId(Long deptId);
+
+ List selectIdByDeptIds(@Param("deptIds") List deptIds);
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysRoleDeptMapper.java b/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysRoleDeptMapper.java
index 45f61da..934d4bf 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysRoleDeptMapper.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysRoleDeptMapper.java
@@ -2,6 +2,7 @@ package com.zf.foodpurchase.system.mapper;
import java.util.List;
import com.zf.foodpurchase.system.domain.SysRoleDept;
+import org.apache.ibatis.annotations.Param;
/**
* 角色与部门关联表 数据层
@@ -41,4 +42,6 @@ public interface SysRoleDeptMapper
* @return 结果
*/
public int batchRoleDept(List roleDeptList);
+
+ public List selectDeptIdsByRoleIds(@Param("roleIds") List roleIds);
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysRoleMapper.java b/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysRoleMapper.java
index 4619af5..ded7d05 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysRoleMapper.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysRoleMapper.java
@@ -2,6 +2,7 @@ package com.zf.foodpurchase.system.mapper;
import java.util.List;
import com.zf.foodpurchase.common.core.domain.entity.SysRole;
+import org.apache.ibatis.annotations.Param;
/**
* 角色表 数据层
@@ -106,4 +107,6 @@ public interface SysRoleMapper
public int deleteRoleByIds(Long[] roleIds);
public List selectRolesByTenantId(String tenantId);
+
+ public List selectRolesByIds(@Param("roleIds") List roleIds);
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysUserRoleMapper.java b/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysUserRoleMapper.java
index 63c7a87..b61697e 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysUserRoleMapper.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/system/mapper/SysUserRoleMapper.java
@@ -59,4 +59,6 @@ public interface SysUserRoleMapper
* @return 结果
*/
public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
+
+ public List selectRoleIdsByUserId(Long userId);
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/system/service/ISysUserService.java b/fp-system/src/main/java/com/zf/foodpurchase/system/service/ISysUserService.java
index f416072..a053a2a 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/system/service/ISysUserService.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/system/service/ISysUserService.java
@@ -203,4 +203,6 @@ public interface ISysUserService
* @return 结果
*/
public String importUser(List userList, Boolean isUpdateSupport, String operName);
+
+ public SysUser getUser();
}
diff --git a/fp-system/src/main/java/com/zf/foodpurchase/system/service/impl/SysUserServiceImpl.java b/fp-system/src/main/java/com/zf/foodpurchase/system/service/impl/SysUserServiceImpl.java
index c44ef0c..19dca9a 100644
--- a/fp-system/src/main/java/com/zf/foodpurchase/system/service/impl/SysUserServiceImpl.java
+++ b/fp-system/src/main/java/com/zf/foodpurchase/system/service/impl/SysUserServiceImpl.java
@@ -4,6 +4,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.validation.Validator;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.zf.foodpurchase.common.core.domain.entity.SysDept;
+import com.zf.foodpurchase.common.core.domain.model.LoginUser;
+import com.zf.foodpurchase.fdsafe.entity.School;
+import com.zf.foodpurchase.fdsafe.mapper.SchoolMapper;
+import com.zf.foodpurchase.system.mapper.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -22,11 +30,6 @@ import com.zf.foodpurchase.common.utils.spring.SpringUtils;
import com.zf.foodpurchase.system.domain.SysPost;
import com.zf.foodpurchase.system.domain.SysUserPost;
import com.zf.foodpurchase.system.domain.SysUserRole;
-import com.zf.foodpurchase.system.mapper.SysPostMapper;
-import com.zf.foodpurchase.system.mapper.SysRoleMapper;
-import com.zf.foodpurchase.system.mapper.SysUserMapper;
-import com.zf.foodpurchase.system.mapper.SysUserPostMapper;
-import com.zf.foodpurchase.system.mapper.SysUserRoleMapper;
import com.zf.foodpurchase.system.service.ISysConfigService;
import com.zf.foodpurchase.system.service.ISysDeptService;
import com.zf.foodpurchase.system.service.ISysUserService;
@@ -53,18 +56,27 @@ public class SysUserServiceImpl implements ISysUserService
@Autowired
private SysUserRoleMapper userRoleMapper;
+ @Autowired
+ private SysRoleDeptMapper roleDeptMapper;
+
@Autowired
private SysUserPostMapper userPostMapper;
@Autowired
private ISysConfigService configService;
+ @Autowired
+ private SysDeptMapper deptMapper;
+
@Autowired
private ISysDeptService deptService;
@Autowired
protected Validator validator;
+ @Autowired
+ private SchoolMapper schoolMapper;
+
/**
* 根据条件分页查询用户列表
*
@@ -547,4 +559,66 @@ public class SysUserServiceImpl implements ISysUserService
}
return successMsg.toString();
}
+
+ @Override
+ public SysUser getUser() {
+ LoginUser loginUser;
+ try {
+ loginUser = (LoginUser) SecurityUtils.getLoginUser();
+ } catch (Exception e) {
+ return null;
+ }
+ if (ObjectUtil.isNull(loginUser) || ObjectUtil.isNull(loginUser.getUser())
+ || ObjectUtil.isNull(loginUser.getUser().getUserId())) {
+ return null;
+ }
+ Long userId = loginUser.getUser().getUserId();
+ SysUser sysUser = userMapper.selectUserById(userId);
+ if (ObjectUtil.isNull(sysUser)) {
+ return null;
+ }
+ if (ObjectUtil.isNotNull(sysUser.getAccountDeptId())){
+ sysUser.setSupplierId(sysUser.getAccountDeptId());
+ }
+ if (ObjectUtil.isNotNull(sysUser.getOrganiId())){
+ sysUser.setSchoolId(sysUser.getOrganiId());
+ School school = schoolMapper.selectById(sysUser.getOrganiId());
+ if(ObjectUtil.isNotNull( school)){
+ sysUser.setEduId(school.getEduId());
+ }
+ }
+
+ List roleIds = userRoleMapper.selectRoleIdsByUserId(userId);
+ if (CollectionUtil.isEmpty(roleIds)) {
+ return sysUser;
+ }
+ List roles = roleMapper.selectRolesByIds(roleIds);
+ if (CollectionUtil.isEmpty(roles)) {
+ return sysUser;
+ }
+ List userRoleIds = roles.stream()
+ .map(SysRole::getRoleId)
+ .distinct()
+ .collect(Collectors.toList());
+ sysUser.setRoles(roles);
+ sysUser.setRoleIdList(userRoleIds);
+ List deptIds = roleDeptMapper.selectDeptIdsByRoleIds(userRoleIds);
+ if (CollectionUtil.isEmpty(deptIds)) {
+ return sysUser;
+ }
+ List deptIdInts = deptIds.stream()
+ .distinct()
+ .map(Long::intValue)
+ .collect(Collectors.toList());
+ List sysDepts = deptMapper.selectIdByDeptIds(deptIdInts);
+ if (CollectionUtil.isEmpty(sysDepts)) {
+ return sysUser;
+ }
+ List deptIdList = sysDepts.stream()
+ .map(dept -> Long.valueOf(dept.getDeptId()))
+ .distinct()
+ .collect(Collectors.toList());
+ sysUser.setDeptIdList(deptIdList);
+ return sysUser;
+ }
}
diff --git a/fp-system/src/main/resources/mapper/FoodProductMapper.xml b/fp-system/src/main/resources/mapper/FoodProductMapper.xml
index 76ebc33..6430acd 100644
--- a/fp-system/src/main/resources/mapper/FoodProductMapper.xml
+++ b/fp-system/src/main/resources/mapper/FoodProductMapper.xml
@@ -4,28 +4,47 @@
- fp.food_product_id, fp.food_id, fp.price, fp.supplier_id, fp.edu_id, fp.remark, fp.check_remark, fp.check_status, fp.create_time, fp.update_time, fp.check_time
+ fp.food_product_id, fp.food_id, fp.price, fp.supplier_id, fp.edu_id, fp.remark, fp.check_remark, fp.check_status, fp.create_time, fp.update_time, fp.check_time,
+ fp.num, fp.name, fp.type_id,fp.unit_id,fp.spec_id
+
+
+
diff --git a/fp-system/src/main/resources/mapper/FoodRepoMapper.xml b/fp-system/src/main/resources/mapper/FoodRepoMapper.xml
new file mode 100644
index 0000000..f4cedab
--- /dev/null
+++ b/fp-system/src/main/resources/mapper/FoodRepoMapper.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+ insert into food_repo(
+ food_product_id,
+ repo_id,
+ order_no,
+ order_item_no,
+ food_product_num
+ )values(
+ #{foodProductId},
+ #{repoId},
+ #{orderNo},
+ #{orderItemNo},
+ #{foodProductNum})
+
+
+
+ update food_repo
+
+ food_product_id=#{foodProductId},
+ repo_id=#{repoId},
+ order_no=#{orderNo},
+ order_item_no=#{orderItemNo},
+ food_product_num=#{foodProductNum}
+
+ where id=#{id}
+
+
+
+
+
+
diff --git a/fp-system/src/main/resources/mapper/FoodSpecMapper.xml b/fp-system/src/main/resources/mapper/FoodSpecMapper.xml
new file mode 100644
index 0000000..5353554
--- /dev/null
+++ b/fp-system/src/main/resources/mapper/FoodSpecMapper.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+ spec_id, spec_label, del_flag, create_time, update_time,status
+
+
+
+
diff --git a/fp-system/src/main/resources/mapper/ProductsMapper.xml b/fp-system/src/main/resources/mapper/ProductsMapper.xml
deleted file mode 100644
index c062607..0000000
--- a/fp-system/src/main/resources/mapper/ProductsMapper.xml
+++ /dev/null
@@ -1,211 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- select product_id, merchant_id,
- d.dept_name as dept_name, product_name,
- description, base_price, total_stock,
- images, category_id, p.status as status,
- type, base_integral, base_return_intergral,
- p.create_time, p.update_time, oper_id,
- p.del_flag as del_flag, detail_images ,
- is_specs,
- sail_count, hot, recommend,
- is_new,version
- from products p inner join sys_dept d on d.dept_id = p.merchant_id
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- insert into products
-
- merchant_id,
- product_name,
- description,
- base_price,
- total_stock,
- images,
- category_id,
- status,
- type,
- base_integral,
- base_return_intergral,
- create_time,
- update_time,
- oper_id,
- del_flag,
- detail_images,
- is_specs,
- sail_count,
- hot,
- recommend,
- is_new,
-
-
- #{merchantId},
- #{productName},
- #{description},
- #{basePrice},
- #{totalStock},
- #{images},
- #{categoryId},
- #{status},
- #{type},
- #{baseIntegral},
- #{baseReturnIntergral},
- #{createTime},
- #{updateTime},
- #{operId},
- #{delFlag},
- #{detailImages},
- #{isSpecs},
- #{sailCount},
- #{hot},
- #{recommend},
- #{isNew},
-
-
-
-
- update products
-
- merchant_id = #{merchantId},
- product_name = #{productName},
- description = #{description},
- base_price = #{basePrice},
- total_stock = #{totalStock},
- images = #{images},
- category_id = #{categoryId},
- status = #{status},
- type = #{type},
- base_integral = #{baseIntegral},
- base_return_intergral = #{baseReturnIntergral},
- create_time = #{createTime},
- update_time = #{updateTime},
- oper_id = #{operId},
- del_flag = #{delFlag},
- detail_images = #{detailImages},
- is_specs = #{isSpecs},
- sail_count= #{sailCount},
- hot=#{hot},
- recommend=#{recommend},
- is_new=#{isNew},
- version=#{version}+1,
-
- where product_id = #{productId} and version=#{version}
-
-
-
- delete from products where product_id = #{productId}
-
-
-
- delete from products where product_id in
-
- #{productId}
-
-
-
- update products set del_flag = '1' where product_id in
-
- #{productId}
-
-
-
diff --git a/fp-system/src/main/resources/mapper/ProductsSpecMapper.xml b/fp-system/src/main/resources/mapper/ProductsSpecMapper.xml
deleted file mode 100644
index 0714b86..0000000
--- a/fp-system/src/main/resources/mapper/ProductsSpecMapper.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
- update products_spec
-
- product_id = #{productId},
- spec_values = #{specValues},
- price = #{price},
- stock = #{stock},
- type = #{type},
- integral = #{integral},
- return_integral = #{returnIntegral},
- create_time = #{createTime},
- update_time = #{updateTime},
- oper_id = #{operId},
- spec_image = #{specImage},
- ps_version = #{psVersion}+1,
-
- where id = #{id} and ps_version=#{psVersion}
-
-
-
-
-
-
diff --git a/fp-system/src/main/resources/mapper/RepoRecordMapper.xml b/fp-system/src/main/resources/mapper/RepoRecordMapper.xml
new file mode 100644
index 0000000..ffdb6dc
--- /dev/null
+++ b/fp-system/src/main/resources/mapper/RepoRecordMapper.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ INSERT INTO repo_record
+
+ apply_date,
+ supplier_id,
+ category_id,
+ repo_id,
+ product_id,
+ product_num,
+ total_cost,
+ status,
+ msg,
+ school_id,
+
+
+ #{applyDate},
+ #{supplierId,jdbcType=INTEGER},
+ #{categoryId,jdbcType=INTEGER},
+ #{repoId,jdbcType=INTEGER},
+ #{productId,jdbcType=INTEGER},
+ #{productNum,jdbcType=INTEGER},
+ #{totalCost},
+ #{status,jdbcType=INTEGER},
+ #{msg,jdbcType=VARCHAR},
+ #{schoolId,jdbcType=BIGINT},
+
+
+
+
+
diff --git a/fp-system/src/main/resources/mapper/RepositoryMapper.xml b/fp-system/src/main/resources/mapper/RepositoryMapper.xml
index 0a125bd..e621c21 100644
--- a/fp-system/src/main/resources/mapper/RepositoryMapper.xml
+++ b/fp-system/src/main/resources/mapper/RepositoryMapper.xml
@@ -6,6 +6,7 @@
+
@@ -13,13 +14,16 @@
+
+
- select r.id, r.merchant_id,r.repo_name, r.area_code, r.detail_address, r.default_repo, r.create_time, r.update_time, r.oper_id,d.dept_name as merchant_name
+ select r.id, r.merchant_id,r.repo_num, r.repo_name, r.area_code, r.detail_address, r.default_repo, r.create_time, r.update_time, r.oper_id,
+ r.manager, r.order_num, d.dept_name as merchant_name
from repository r left join sys_dept d on r.merchant_id = d.dept_id
-
diff --git a/fp-system/src/main/resources/mapper/SchoolCartItemMapper.xml b/fp-system/src/main/resources/mapper/SchoolCartItemMapper.xml
index 92c2faf..66ee2f5 100644
--- a/fp-system/src/main/resources/mapper/SchoolCartItemMapper.xml
+++ b/fp-system/src/main/resources/mapper/SchoolCartItemMapper.xml
@@ -39,6 +39,12 @@
and su.supplier_name like concat('%',#{supplierName},'%')
+
+ and ci.school_id in
+
+ #{deptId}
+
+
order by ci.update_time desc
diff --git a/fp-system/src/main/resources/mapper/SchoolOrderItemMapper.xml b/fp-system/src/main/resources/mapper/SchoolOrderItemMapper.xml
index c3acdb8..37d36e3 100644
--- a/fp-system/src/main/resources/mapper/SchoolOrderItemMapper.xml
+++ b/fp-system/src/main/resources/mapper/SchoolOrderItemMapper.xml
@@ -53,5 +53,4 @@
order by soi.order_item_no desc
-
diff --git a/fp-system/src/main/resources/mapper/SchoolOrderMapper.xml b/fp-system/src/main/resources/mapper/SchoolOrderMapper.xml
index 1e38e0d..a000d9e 100644
--- a/fp-system/src/main/resources/mapper/SchoolOrderMapper.xml
+++ b/fp-system/src/main/resources/mapper/SchoolOrderMapper.xml
@@ -4,8 +4,10 @@
- so.order_no, so.supplier_id, so.school_id, so.edu_id, so.operator_person, so.operator_phone, so.total_money, so.refund_money, so.order_status, so.delivery_date, so.create_time, so.update_time, so.cancel_time, so.cancel_reason,so.order_remark,so.order_settle_status
+ so.order_no, so.supplier_id, so.school_id, so.edu_id, so.operator_person, so.operator_phone, so.total_money, so.refund_money, so.order_status, so.delivery_date, so.create_time, so.update_time, so.cancel_time, so.cancel_reason,so.order_remark,so.order_settle_status,
+ so.sign_person,so.sign_time,so.sign_image
+
+
+
+
+ update school_order
+
+ order_status = #{orderStatus},
+ sign_person = #{signPerson},
+ sign_time = #{signTime},
+ sign_image = #{signImage},
+
+ where order_no = #{orderNo}
+
+
diff --git a/fp-system/src/main/resources/mapper/SpecTypesMapper.xml b/fp-system/src/main/resources/mapper/SpecTypesMapper.xml
deleted file mode 100644
index b467546..0000000
--- a/fp-system/src/main/resources/mapper/SpecTypesMapper.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/fp-system/src/main/resources/mapper/SpecValuesMapper.xml b/fp-system/src/main/resources/mapper/SpecValuesMapper.xml
deleted file mode 100644
index 45299a1..0000000
--- a/fp-system/src/main/resources/mapper/SpecValuesMapper.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
-select
- id,
- spec_type as specType,
- spec_value as specValue,
- spec_unit as specUnit,
- create_time as createTime,
- update_time as updateTime,
- oper_id as operId
- from spec_values
-
-
- SELECT
- v.id,
- v.spec_type AS specType,
- v.spec_value AS specValue,
- v.spec_unit AS specUnit,
- v.create_time AS createTime,
- v.update_time AS updateTime,
- v.oper_id AS operId,
- t.spec_name AS specName
-FROM
- spec_values v
- LEFT JOIN spec_types t ON v.spec_type = t.spec_type
-
-
-
-
-
-
-
diff --git a/fp-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml b/fp-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml
index 2dff5f3..7a11d19 100644
--- a/fp-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml
+++ b/fp-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml
@@ -30,5 +30,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(#{item.roleId},#{item.deptId})
-
+
+
\ No newline at end of file
diff --git a/fp-system/src/main/resources/mapper/system/SysRoleMapper.xml b/fp-system/src/main/resources/mapper/system/SysRoleMapper.xml
index cac578c..1b83b73 100644
--- a/fp-system/src/main/resources/mapper/system/SysRoleMapper.xml
+++ b/fp-system/src/main/resources/mapper/system/SysRoleMapper.xml
@@ -154,5 +154,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where r.tenant_id = #{tenantId}
-
+
+
+
\ No newline at end of file
diff --git a/fp-system/src/main/resources/mapper/system/SysUserMapper.xml b/fp-system/src/main/resources/mapper/system/SysUserMapper.xml
index ccc717f..c459ed6 100644
--- a/fp-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/fp-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -54,7 +54,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.account_type ,u.account_dept_id,
+ select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password,
+ u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
+ u.account_type ,u.account_dept_id, u.organi_id, u.account_type,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u
diff --git a/fp-system/src/main/resources/mapper/system/SysUserRoleMapper.xml b/fp-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
index aef9653..a68074e 100644
--- a/fp-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
+++ b/fp-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
@@ -41,4 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{userId}
+
+
\ No newline at end of file
diff --git a/fp-system/src/main/resources/mapper/system/WxSysDeptMapper.xml b/fp-system/src/main/resources/mapper/system/WxSysDeptMapper.xml
index f13226e..2395a9f 100644
--- a/fp-system/src/main/resources/mapper/system/WxSysDeptMapper.xml
+++ b/fp-system/src/main/resources/mapper/system/WxSysDeptMapper.xml
@@ -219,5 +219,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+