Merge branch 'master' into pjfk

# Conflicts:
#	pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/SysUserController.java
#	pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/SysUserServiceImpl.java
This commit is contained in:
zjf committed 2025-07-09 12:28:26 +08:00
commit dd983527f3
529 files changed
+22179 -1213

No files matched your search

+54
View File
@@ -58,6 +58,60 @@ CREATE TABLE `third_door_log`
COLLATE = utf8mb4_general_ci
ROW_FORMAT = DYNAMIC COMMENT ='智能柜日志';
-- ----------------------------
-- Table structure for third_pay_log
-- ----------------------------
DROP TABLE IF EXISTS `third_pay_log`;
CREATE TABLE `third_pay_log`
(
`id` bigint NOT NULL COMMENT '主键',
`pay_source_type` varchar(32) NOT NULL COMMENT '支付发起方类型id',
`biz_type` varchar(32) NOT NULL COMMENT '支付类型',
`biz_id` varchar(2048) DEFAULT NULL COMMENT '支付类型id',
`api_url` text DEFAULT NULL COMMENT 'api-url',
`header` text DEFAULT NULL COMMENT 'header',
`res` text DEFAULT NULL COMMENT 'res',
`req` text DEFAULT NULL COMMENT 'req',
`error` text DEFAULT NULL COMMENT '调用错误',
`time_consuming` char(64) DEFAULT NULL COMMENT '耗时(毫秒)',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`create_by` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
`update_by` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人',
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除时间',
`tenant_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
ROW_FORMAT = DYNAMIC COMMENT ='第三方支付日志';
-- ----------------------------
-- Table structure for third_key_manage
-- ----------------------------
DROP TABLE IF EXISTS `third_key_manage`;
CREATE TABLE `third_key_manage`
(
`id` bigint NOT NULL COMMENT '主键',
`name` varchar(32) NOT NULL COMMENT '第三方名字',
`biz_type` varchar(32) NOT NULL COMMENT '第三方类型id(常量)',
`app_key` varchar(256) DEFAULT NULL COMMENT 'appKey',
`app_secret` varchar(256) DEFAULT NULL COMMENT 'appSecret',
`field_key` varchar(256) DEFAULT NULL COMMENT '字段加密key',
`status` varchar(32) DEFAULT '1' COMMENT '状态',
`remark` varchar(1024) DEFAULT NULL COMMENT '备注',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`create_by` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
`update_by` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人',
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除时间',
`tenant_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
ROW_FORMAT = DYNAMIC COMMENT ='第三方密钥管理';
-- ----------------------------
-- Table structure for third_zy_id_dict
+81 -1
View File
@@ -7,6 +7,7 @@ DROP TABLE IF EXISTS sys_user_transaction;
CREATE TABLE `sys_user_transaction`
(
id bigint NOT NULL COMMENT '编号',
apply_user_id bigint NOT NULL COMMENT '申请用户id',
user_id bigint NOT NULL COMMENT '用户id',
biz_id bigint DEFAULT NULL COMMENT '业务id',
biz_type varchar(32) NOT NULL COMMENT '业务类型',
@@ -20,6 +21,7 @@ CREATE TABLE `sys_user_transaction`
process_id varchar(256) DEFAULT NULL COMMENT '流程id',
process_status varchar(10) DEFAULT NULL COMMENT '审核状体',
process_time datetime DEFAULT NULL COMMENT '审核时间',
remark varchar(1024) DEFAULT NULL COMMENT '备注',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
@@ -91,6 +93,29 @@ CREATE TABLE mch_manage
COLLATE = utf8mb4_general_ci COMMENT ='商户管理';
CREATE INDEX idx_dept_id ON mch_manage (dept_id);
-- ----------------------------
-- Table structure for mch_catgory
-- ----------------------------
DROP TABLE IF EXISTS `mch_catgory`;
CREATE TABLE mch_catgory
(
id bigint NOT NULL COMMENT '主键',
name varchar(64) NOT NULL COMMENT '分类名',
biz_type varchar(64) NOT NULL COMMENT '分类名类型',
sort int DEFAULT 0 COMMENT '排序',
remark varchar(512) DEFAULT '' COMMENT '备注',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='商户分类表';
-- ----------------------------
-- Table structure for mch_dpet_user
-- ----------------------------
@@ -234,6 +259,7 @@ DROP TABLE IF EXISTS wallet_rule_transaction;
CREATE TABLE wallet_rule_transaction
(
id BIGINT(19) not null comment '主键',
biz_type VARCHAR(32) default null comment '转账类型',
source_wallet_id BIGINT(19) not null comment '源钱包id',
target_wallet_id BIGINT(19) not null comment '目标钱包id',
source_wallet_balance int not null comment '源钱包余额',
@@ -359,6 +385,37 @@ CREATE TABLE wallet_recharge_apply
COLLATE = utf8mb4_general_ci COMMENT ='充值申请表';
CREATE INDEX idx_dept_id ON wallet_recharge_apply (user_id);
-- ----------------------------
-- Table structure for wallet_recharge_invoice
-- ----------------------------
DROP TABLE IF EXISTS wallet_recharge_invoice;
CREATE TABLE wallet_recharge_invoice
(
id bigint NOT NULL COMMENT '主键ID',
apply_user_id bigint DEFAULT NULL COMMENT '申请用户id',
apply_dept_id bigint DEFAULT NULL COMMENT '申请用户部门id',
apply_id bigint DEFAULT NULL COMMENT '申请id',
code varchar(32) NOT NULL COMMENT '发票代码(七位数)',
time datetime DEFAULT NULL COMMENT '发票日期',
dept_or_user varchar(64) DEFAULT NULL COMMENT '交款单位或个人',
total_price int DEFAULT NULL COMMENT '合计人民币',
payee_dept varchar(64) DEFAULT NULL COMMENT '收款单位',
payee_user varchar(64) DEFAULT NULL COMMENT '收款人',
item_json varchar(2048) DEFAULT NULL COMMENT '备注',
remark varchar(1024) DEFAULT NULL COMMENT '备注',
status varchar(32) DEFAULT NULL COMMENT '状态',
pic_url varchar(1024) DEFAULT NULL COMMENT '发票图片地址',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='充值申请发票表';
-- ----------------------------
-- Table structure for wallet_recharge_import
-- ----------------------------
@@ -534,4 +591,27 @@ CREATE TABLE wallet_setting
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB COMMENT ='支付设置';
) ENGINE = InnoDB COMMENT ='支付设置';
-- ----------------------------
-- Table structure for mch_checkout
-- ----------------------------
DROP TABLE IF EXISTS mch_checkout;
CREATE TABLE mch_checkout
(
id bigint NOT NULL AUTO_INCREMENT COMMENT '创建者',
checkout_time date NOT NULL COMMENT '结账年月日(存入年月就行)',
checkout_user_id bigint NOT NULL COMMENT '结账人',
merchant_id bigint NOT NULL COMMENT '商户id',
price bigint NOT NULL COMMENT '结账价格',
pic varchar(2048) DEFAULT NULL COMMENT '结账凭证图片',
remark varchar(512) DEFAULT NULL COMMENT '结账备注',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB COMMENT ='商户结账表';
@@ -0,0 +1,31 @@
package com.bsd.pjcloud.canteen.constant;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 入库类型编码前兆
*/
@AllArgsConstructor
@Getter
public enum InventoryTypeEnum {
CGRK("1", "CGRK"),
SCJG("2", "SCJG"),
;
private final String type;
private final String value;
// 根据数字返回对应的值
public static String getValueByType(String type) {
for (InventoryTypeEnum v : InventoryTypeEnum.values()) {
if (v.type.equals(type)) {
return v.value;
}
}
return ""; // 如果没有找到对应的数字
}
}
@@ -0,0 +1,22 @@
package com.bsd.pjcloud.canteen.constant;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 出库入口
*/
@AllArgsConstructor
@Getter
public enum OrderTypeEnum {
RK("1", "入库"),
CK("2", "出库"),
No("0", "无盈亏")
;
private final String type;
private final String description;
}
@@ -0,0 +1,22 @@
package com.bsd.pjcloud.canteen.constant;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 库存类型
*/
@AllArgsConstructor
@Getter
public enum StockTypeEnum {
MATERIAL("1", "食材"),
DISH("2", "菜品"),
ONLINE_DISH("3", "在线菜品库存")
;
private final String type;
private final String description;
}
@@ -0,0 +1,10 @@
package com.bsd.pjcloud.canteen.dto.erp;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class CanteenErpMaterialEditorDTO extends CanteenErpMaterialSaveDTO {
private Long id;
}
@@ -0,0 +1,47 @@
package com.bsd.pjcloud.canteen.dto.erp;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class CanteenErpMaterialSaveDTO {
/**
* 商品名称
*/
@Schema(description="商品名称")
private String name;
/**
* 商品单位
*/
@Schema(description="商品单位")
private String unit;
/**
* 期初数量
*/
@Schema(description="期初数量")
private Double baseStock;
/**
* 库存上限
*/
@Schema(description="库存上限")
private Integer inventoryUpperLimit;
/**
* 库存下限
*/
@Schema(description="库存下限")
private Integer inventoryLowerLimit;
@Schema(description="采购价格")
private Integer purchasePrice;
@Schema(description="所属分类id")
private Long categoryId;
}
@@ -0,0 +1,95 @@
package com.bsd.pjcloud.canteen.dto.erp;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
@Data
@Schema(description = "出入库记录修改对象")
public class CanteenInventoryRecordEditDTO {
/**
* 主键
*/
@Schema(description="主键")
private Long id;
/**
* 单据编号(规则生成,出入库编号)
*/
@Schema(description="单据编号(规则生成,出入库编号)")
private String inventoryCode;
/**
* 单据日期
*/
@Schema(description="单据日期")
private LocalDate inventoryDate;
/**
* 单据类型(字典inventory_type)采购入库、采购退货、盘点入库等
*/
@Schema(description="单据类型(字典inventory_type)采购入库、采购退货、盘点入库等")
private String inventoryType;
/**
* 经办人id
*/
@Schema(description="经办人id")
private Long handlerUserId;
/**
* 商户编号
*/
@Schema(description="商户编号")
private Long merchantId;
/**
* 货商
*/
@Schema(description="货商")
private Long supplierId;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
/**
* 订单类型(1入库 2出库)
*/
@Schema(description="订单类型(1入库 2出库)")
private String orderType;
/**
* 入库总金额
*/
@Schema(description="入库总金额")
private Integer totalAmount;
@Schema(description="收货数量")
private Integer receiveAmount;
/**
* @Link SmCgPlanEditItemDTO
*/
@Schema(description="items")
private List<CanteenInventoryRecordEditItemDTO> items;
}
@@ -0,0 +1,92 @@
package com.bsd.pjcloud.canteen.dto.erp;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "出入库记录编辑-item")
public class CanteenInventoryRecordEditItemDTO {
/**
* id
*/
@Schema(description="id")
private Long id;
/**
* 单据类型(字典inventory_type)
*/
@Schema(description="单据类型(字典inventory_type)")
private String inventoryType;
/**
* 商品id
*/
@Schema(description="原料id")
private Long erpMaterialId;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* 出入库数量
*/
@Schema(description="出入库数量")
private Double quantity;
/**
* 单价
*/
@Schema(description="单价")
private Integer unitPrice;
/**
* 总金额
*/
@Schema(description="总金额")
private Integer totalAmount;
/**
* 税率%
*/
@Schema(description="税率%")
private Integer taxRate;
/**
* 税前金额
*/
@Schema(description="税前金额")
private Integer taxAmount;
/**
* 货商
*/
@Schema(description="货商")
private Long supplierId;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
/**
* 订单类型(1入库 2出库)
*/
@Schema(description="订单类型(1入库 2出库)")
private String orderType;
/**
* 实际单价
*/
@Schema(description="实际单价")
private Integer realPrice;
}
@@ -0,0 +1,97 @@
package com.bsd.pjcloud.canteen.dto.erp;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.bsd.pjcloud.common.core.util.TenantTable;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 采购记录明细表
*
* @author zjf
* @date 2025-05-07 17:02:53
*/
@Data
@Schema(description = "采购记录明细表")
public class CanteenInventoryRecordsItemDTO {
/**
* 原料id
*/
@Schema(description="原料id")
private Long erpMaterialId;
/**
* 出入库数量
*/
@Schema(description="出入库数量")
private Double quantity;
/**
* 单价
*/
@Schema(description="单价")
private Integer unitPrice;
/**
* 总金额
*/
@Schema(description="总金额")
private Integer totalAmount;
/**
* 税率%
*/
@Schema(description="税率%")
private Integer taxRate;
/**
* 税前金额
*/
@Schema(description="税前金额")
private Integer taxAmount;
/**
* 货商
*/
@Schema(description="货商")
private Long supplierId;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
/**
* 订单类型(1入库 2出库)
*/
@Schema(description="订单类型(1入库 2出库)")
private String orderType;
/**
* 出入库关联id
*/
@Schema(description="出入库关联id")
private Long inventoryId;
/**
* 总数
*/
@Schema(description="总数")
private Integer totalNumber;
/**
* 实际单价
*/
@Schema(description="实际单价")
private Integer realPrice;
}
@@ -0,0 +1,73 @@
package com.bsd.pjcloud.canteen.dto.erp;
import com.baomidou.mybatisplus.annotation.*;
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsItemEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class CanteenInventoryRecordsdDTO {
/**
* 单据编号(规则生成,出入库编号)
*/
@Schema(description="单据编号(规则生成,出入库编号)")
private String inventoryCode;
/**
* 单据日期
*/
@Schema(description="单据日期")
private LocalDate inventoryDate;
/**
* 单据类型(字典inventory_type)采购入库
*/
@Schema(description="单据类型采购入库=1")
private String inventoryType;
/**
* 经办人id
*/
@Schema(description="经办人id")
private Long handlerUserId;
/**
* 货商
*/
@Schema(description="货商")
private Long supplierId;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
/**
* 订单类型(1入库 2出库)
*/
@Schema(description="订单类型(1入库 2出库)")
private String orderType;
/**
* 入库总金额
*/
@Schema(description="入库总金额")
private Integer totalAmount;
@Schema(description="入库明细")
private List <CanteenInventoryRecordsItemDTO> items;
}
@@ -0,0 +1,121 @@
package com.bsd.pjcloud.canteen.dto.erp;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDate;
import java.util.List;
@Data
public class CanteenProductRecordSaveDTO {
// 生产时间(格式:yyyy-MM-dd)
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate productionTime;
// 加工人姓名
private String handlerUser;
// 记录编号(示例值:SCJG-2025051403005)
private String recordCode;
// 生产明细列表
private List<ProductionDetail> productionDetailList;
// 使用内部类表示明细
@Data
public static class ProductionDetail {
@Schema(description = "模板ID")
private String templateId;
// 菜品名称(示例值:"咸菜豆腐汤")
@Schema(description = "菜品名称")
private String dishName;
@Schema(description = "菜品ID")
private Long dishId;
// 原料单位(示例值:"斤")
private String materialUnit;
// 生产数量(示例值:1)
@Schema(description = "生产数量")
private Double produceQuantity;
// 是否手动修改(示例值:false)
private Boolean manualModified;
private List<MaterialDetailList> materialDetailList;
}
@Data
public static class MaterialDetailList {
/**
* id
*/
@Schema(description="id")
private Long id;
/**
* 食材id
*/
@Schema(description="食材id")
private Long materialId;
/**
* 记录item表id
*/
@Schema(description="记录item表id")
private Long recordItemId;
/**
* 食材名称
*/
@Schema(description="食材名称")
private String materialName;
/**
* 食材单位
*/
@Schema(description="食材单位")
private String unit;
/**
* 计算用量
*/
@Schema(description="计算用量")
private Double calculatedUsage;
/**
* 折损率
*/
@Schema(description="折损率")
private Double lossRate;
/**
* 基础用量
*/
@Schema(description="基础用量")
private Double baseUsage;
/**
* 实际用量
*/
@Schema(description="实际用量")
private Double actualUsage;
/**
* 实际折损率
*/
@Schema(description="实际折损率")
private Double actualLossRate;
}
}
@@ -0,0 +1,35 @@
package com.bsd.pjcloud.canteen.dto.erp;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 更新库存 DTO
*
* @author LeeYan9
* @since 2022-08-26
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UpdateStockDTO {
/**
* 商品 SKU 编号
*/
@NotNull(message = "商品 SPU 编号不能为空")
private Long id;
/**
* 库存变化数量
*
* 正数:增加库存
* 负数:扣减库存
*/
@NotNull(message = "库存变化数量不能为空")
private Double incrCount;
}
@@ -7,6 +7,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
/**
* 包厢预约记录表
@@ -38,13 +39,13 @@ public class BoxesBookingEntity extends Model<BoxesBookingEntity> {
* 开始时间
*/
@Schema(description="开始时间")
private Object startTime;
private LocalTime startTime;
/**
* 结束时间
*/
@Schema(description="结束时间")
private Object endTime;
private LocalTime endTime;
/**
* 审核人id
@@ -0,0 +1,103 @@
package com.bsd.pjcloud.canteen.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
* 原料表
*
* @author zjf
* @date 2025-05-07 13:16:32
*/
@Data
@TenantTable
@TableName("canteen_erp_material")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "原料表")
public class CanteenErpMaterialEntity extends Model<CanteenErpMaterialEntity> {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="id")
private Long id;
/**
* 商品名称
*/
@Schema(description="商品名称")
private String name;
/**
* 商品单位
*/
@Schema(description="商品单位")
private String unit;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新人")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新时间")
private LocalDateTime updateTime;
/**
* 是否删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="是否删除")
private String delFlag;
/**
* 租户编号
*/
@Schema(description="租户编号")
private Long tenantId;
/**
* 采购价格
*/
@Schema(description="采购价格")
private Integer purchasePrice;
@Schema(description="所属分类id")
private Long categoryId;
}
@@ -0,0 +1,176 @@
package com.bsd.pjcloud.canteen.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* 采购记录表
*
* @author zjf
* @date 2025-05-07 17:00:50
*/
@Data
@TenantTable
@TableName("canteen_inventory_records")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "采购记录表")
public class CanteenInventoryRecordsEntity extends Model<CanteenInventoryRecordsEntity> {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="主键")
private Long id;
/**
* 单据编号(规则生成,出入库编号)
*/
@Schema(description="单据编号(规则生成,出入库编号)")
private String inventoryCode;
/**
* 单据日期
*/
@Schema(description="单据日期")
private LocalDate inventoryDate;
/**
* 单据类型(字典inventory_type)采购入库
*/
@Schema(description="单据类型(字典inventory_type)采购入库")
private String inventoryType;
/**
* 来源ID(根据类型指向对应的表,如采购单ID、退货单ID等)
*/
@Schema(description="来源ID(根据类型指向对应的表,如采购单ID、退货单ID等)")
private String linkCode;
/**
* 经办人id
*/
@Schema(description="经办人id")
private Long handlerUserId;
/**
* 审批状态
*/
@Schema(description="审批状态")
private String checkStatus;
/**
* 审批人id
*/
@Schema(description="审批人id")
private Long checkUserId;
/**
* 审核日期
*/
@Schema(description="审核日期")
private LocalDateTime checkTime;
/**
* 商户编号
*/
@Schema(description="商户编号")
private Long merchantId;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* 货商
*/
@Schema(description="货商")
private Long supplierId;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
/**
* 订单类型(1入库 2出库)
*/
@Schema(description="订单类型(1入库 2出库)")
private String orderType;
/**
* 入库总金额
*/
@Schema(description="入库总金额")
private Integer totalAmount;
/**
* 收款金额
*/
@Schema(description="收款金额")
private Integer receiveAmount;
/**
* 实例id
*/
@Schema(description="实例id")
private String processInstanceId;
/**
* 审核原因
*/
@Schema(description="审核原因")
private String checkReason;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新人")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新时间")
private LocalDateTime updateTime;
/**
* 是否删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="是否删除")
private String delFlag;
/**
* 租户编号
*/
@Schema(description="租户编号")
private Long tenantId;
}
@@ -0,0 +1,175 @@
package com.bsd.pjcloud.canteen.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
* 采购记录明细表
*
* @author zjf
* @date 2025-05-07 17:02:53
*/
@Data
@TenantTable
@TableName("canteen_inventory_records_item")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "采购记录明细表")
public class CanteenInventoryRecordsItemEntity extends Model<CanteenInventoryRecordsItemEntity> {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="id")
private Long id;
/**
* 单据类型(字典inventory_type)
*/
@Schema(description="单据类型(字典inventory_type)")
private String inventoryType;
/**
* 原料id
*/
@Schema(description="原料id")
private Long erpMaterialId;
/**
* 商户编号
*/
@Schema(description="商户编号")
private Long merchantId;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* 出入库数量
*/
@Schema(description="出入库数量")
private Double quantity;
/**
* 单价
*/
@Schema(description="单价")
private Integer unitPrice;
/**
* 总金额
*/
@Schema(description="总金额")
private Integer totalAmount;
/**
* 税率%
*/
@Schema(description="税率%")
private Integer taxRate;
/**
* 税前金额
*/
@Schema(description="税前金额")
private Integer taxAmount;
/**
* 货商
*/
@Schema(description="货商")
private Long supplierId;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
/**
* 订单类型(1入库 2出库)
*/
@Schema(description="订单类型(1入库 2出库)")
private String orderType;
/**
* 出入库关联id
*/
@Schema(description="出入库关联id")
private Long inventoryId;
/**
* 总数
*/
@Schema(description="总数")
private Integer totalNumber;
/**
* 账面数量
*/
@Schema(description="账面数量")
private Integer accountNumber;
/**
* 实际数量
*/
@Schema(description="实际数量")
private Integer realNumber;
/**
* 实际单价
*/
@Schema(description="实际单价")
private Integer realPrice;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新人")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新时间")
private LocalDateTime updateTime;
/**
* 是否删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="是否删除")
private String delFlag;
/**
* 租户编号
*/
@Schema(description="租户编号")
private Long tenantId;
}
@@ -0,0 +1,109 @@
package com.bsd.pjcloud.canteen.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
* 食材加工记录表
*
* @author zjf
* @date 2025-05-08 11:02:09
*/
@Data
@TenantTable
@TableName("canteen_production_record")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "食材加工记录表")
public class CanteenProductionRecordEntity extends Model<CanteenProductionRecordEntity> {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="id")
private Long id;
/**
* 加工日期
*/
@Schema(description="加工日期")
private LocalDateTime productionTime;
/**
* 加工人
*/
@Schema(description="加工人")
private String handlerUser;
/**
* 主id
*/
@Schema(description="主id")
private Long recordId;
/**
* 加工批次号
*/
@Schema(description="加工批次号")
private String recordCode;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新人")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新时间")
private LocalDateTime updateTime;
/**
* 是否删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="是否删除")
private String delFlag;
/**
* 租户编号
*/
@Schema(description="租户编号")
private Long tenantId;
}
@@ -0,0 +1,128 @@
package com.bsd.pjcloud.canteen.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
* 食材加工记录明细表
*
* @author zjf
* @date 2025-05-08 11:05:02
*/
@Data
@TenantTable
@TableName("canteen_production_record_item")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "食材加工记录明细表")
public class CanteenProductionRecordItemEntity extends Model<CanteenProductionRecordItemEntity> {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="id")
private Long id;
/**
* 关系表菜品id
*/
@Schema(description="关系表菜品id")
private Long itemRelationId;
/**
* 食材id
*/
@Schema(description="食材id")
private Long materialId;
/**
* 实际消耗原料量数量
*/
@Schema(description="实际消耗原料量数量")
private Double inputQuantity;
/**
* 实际产出菜品量
*/
@Schema(description="实际产出菜品量")
private Double outputQuantity;
/**
* 主id
*/
@Schema(description="主id")
private Long recordId;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
/**
* 折损率
*/
@Schema(description="折损率")
private Double lossRate;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新人")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新时间")
private LocalDateTime updateTime;
/**
* 是否删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="是否删除")
private String delFlag;
/**
* 租户编号
*/
@Schema(description="租户编号")
private Long tenantId;
@Schema(description = "菜品ID")
private Long dishId;
@Schema(description = "菜品名称")
private String dishName;
}
@@ -0,0 +1,103 @@
package com.bsd.pjcloud.canteen.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
* 加工模版明细表
*
* @author zjf
* @date 2025-05-12 13:53:57
*/
@Data
@TenantTable
@TableName("canteen_production_template_detail")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "加工模版明细表")
public class CanteenProductionTemplateDetailEntity extends Model<CanteenProductionTemplateDetailEntity> {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="id")
private Long id;
/**
* 模版id
*/
@Schema(description="模版id")
private Long templateId;
/**
* 原料id
*/
@Schema(description="原料id")
private Long materialId;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* 基准用量
*/
@Schema(description="基准用量")
private Double baseUsage;
/**
* 损耗率
*/
@Schema(description="损耗率")
private Double lossRate;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新人")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新时间")
private LocalDateTime updateTime;
/**
* 是否删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="是否删除")
private String delFlag;
/**
* 租户编号
*/
@Schema(description="租户编号")
private Long tenantId;
}
@@ -0,0 +1,104 @@
package com.bsd.pjcloud.canteen.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.github.yulichang.annotation.EntityMapping;
import java.util.List;
/**
* 加工模版表
*
* @author zjf
* @date 2025-05-12 13:41:26
*/
@Data
@TenantTable
@TableName("canteen_production_template")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "加工模版表")
public class CanteenProductionTemplateEntity extends Model<CanteenProductionTemplateEntity> {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="id")
private Long id;
/**
* 模版名称
*/
@Schema(description="模版名称")
private String templateName;
/**
* 菜品id
*/
@Schema(description="菜品id")
private Long dishId;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* 基准产出量(碗)
*/
@Schema(description="基准产出量(碗)")
private Double baseOutput;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新人")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新时间")
private LocalDateTime updateTime;
/**
* 是否删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="是否删除")
private String delFlag;
/**
* 租户编号
*/
@Schema(description="租户编号")
private Long tenantId;
@ExcelIgnore
@TableField(exist = false)
@EntityMapping(thisField = "id", joinField = "templateId")
private List<CanteenProductionTemplateDetailEntity> canteenProductionTemplateDetailList;
}
@@ -0,0 +1,118 @@
package com.bsd.pjcloud.canteen.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
* 库存表
*
* @author zjf
* @date 2025-05-07 16:40:35
*/
@Data
@TenantTable
@TableName("canteen_stock")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "库存表")
public class CanteenStockEntity extends Model<CanteenStockEntity> {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="id")
private Long id;
/**
* 期初数量
*/
@Schema(description="期初数量")
private Double baseStock;
/**
* 类型 原料/成品
*/
@Schema(description="类型 原料/成品")
private String itemType;
/**
* 成品id/原料id
*/
@Schema(description="成品id/原料id")
private Long itemId;
/**
* 乐观锁版本号
*/
@Schema(description="乐观锁版本号")
private Integer version;
/**
* 库存上限
*/
@Schema(description="库存上限")
private Integer inventoryUpperLimit;
/**
* 库存下限
*/
@Schema(description="库存下限")
private Integer inventoryLowerLimit;
/**
* 当前库存数量
*/
@Schema(description="当前库存数量")
private Double currentStock;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新人")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新时间")
private LocalDateTime updateTime;
/**
* 是否删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="是否删除")
private String delFlag;
/**
* 租户编号
*/
@Schema(description="租户编号")
private Long tenantId;
@Schema(description="部门id")
private Long deptId;
}
@@ -0,0 +1,163 @@
package com.bsd.pjcloud.canteen.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
* 货商信息
*
* @author zjf
* @date 2025-05-09 13:18:19
*/
@Data
@TenantTable
@TableName("canteen_supplier")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "货商信息")
public class CanteenSupplierEntity extends Model<CanteenSupplierEntity> {
/**
* 货商ID
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="货商ID")
private Long supplierId;
/**
* 货商名称
*/
@Schema(description="货商名称")
private String supplierName;
/**
* 货商地址
*/
@Schema(description="货商地址")
private String address;
/**
* 电话号码
*/
@Schema(description="电话号码")
private String phone;
/**
* 税号
*/
@Schema(description="税号")
private String tax;
/**
* 联系人
*/
@Schema(description="联系人")
private String linkName;
/**
* 开户行账号
*/
@Schema(description="开户行账号")
private String openAccount;
/**
* 邮箱地址
*/
@Schema(description="邮箱地址")
private String email;
/**
* 所属部门ID
*/
@Schema(description="所属部门ID")
private Long deptId;
/**
* 货商类别
*/
@Schema(description="货商类别")
private Long supplierType;
/**
* 货商地区
*/
@Schema(description="货商地区")
private String supplierArea;
/**
* 修改时间
*/
@Schema(description="修改时间")
private LocalDateTime passwordModifyTime;
/**
* 开户行
*/
@Schema(description="开户行")
private String openName;
/**
* 合同号
*/
@Schema(description="合同号")
private String contractNumber;
/**
* 状态 0使用 1禁用
*/
@Schema(description="状态 0使用 1禁用")
private String status;
/**
* 拼音简码
*/
@Schema(description="拼音简码")
private String pinyinCod;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="修改人")
private String updateBy;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="修改时间")
private LocalDateTime updateTime;
/**
* 删除标记,0未删除,1已删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="删除标记,0未删除,1已删除")
private String delFlag;
/**
* 所属租户ID
*/
@Schema(description="所属租户ID")
private Long tenantId;
}
@@ -0,0 +1,84 @@
package com.bsd.pjcloud.canteen.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 食材加工菜品关系表
*
* @author zjf
* @date 2025-05-14 12:47:16
*/
@Data
@TableName("production_record_item_relation")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "食材加工菜品关系表")
public class ProductionRecordItemRelationEntity extends Model<ProductionRecordItemRelationEntity> {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="id")
private Long id;
/**
* 食材id
*/
@Schema(description="食材id")
private Long materialId;
/**
* 记录item表id
*/
@Schema(description="记录item表id")
private Long recordItemId;
/**
* 食材名称
*/
@Schema(description="食材名称")
private String materialName;
/**
* 食材单位
*/
@Schema(description="食材单位")
private String unit;
/**
* 计算用量
*/
@Schema(description="计算用量")
private Double calculatedUsage;
/**
* 折损率
*/
@Schema(description="折损率")
private Double lossRate;
/**
* 基础用量
*/
@Schema(description="基础用量")
private Double baseUsage;
/**
* 实际用量
*/
@Schema(description="实际用量")
private Double actualUsage;
/**
* 实际折损率
*/
@Schema(description="实际折损率")
private Double actualLossRate;
}
@@ -39,4 +39,9 @@ public class ADCanteenDailyMenuListVO {
* 时间类型
*/
private Integer hourType;
/**
* 排序
*/
private Integer sort;
}
@@ -0,0 +1,17 @@
package com.bsd.pjcloud.canteen.vo.erp;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class CanteenErpCategorySimpleVo {
@Schema(description = "分类id")
private Long id;
@Schema(description = "分类名称")
private String name;
}
@@ -0,0 +1,53 @@
package com.bsd.pjcloud.canteen.vo.erp;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class CanteenErpMaterialVO {
private Long id;
/**
* 商品名称
*/
@Schema(description="商品名称")
private String name;
/**
* 商品单位
*/
@Schema(description="商品单位")
private String unit;
/**
* 期初数量
*/
@Schema(description="期初数量")
private Double baseStock;
/**
* 库存上限
*/
@Schema(description="库存上限")
private Integer inventoryUpperLimit;
/**
* 库存下限
*/
@Schema(description="库存下限")
private Integer inventoryLowerLimit;
@Schema(description="当前总库存")
private Double currentStock;
@Schema(description="采购价格")
private Integer purchasePrice;
@Schema(description="所属分类id")
private Long categoryId;
}
@@ -0,0 +1,161 @@
package com.bsd.pjcloud.canteen.vo.erp;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Map;
/**
* 食材加工记录表
*
* @author zjf
* @date 2025-05-08 11:02:09
*/
@Data
@Schema(description = "采购入库分页vo")
public class CanteenProductionRecordPageVO {
/**
* 主键
*/
@Schema(description="主键")
private Long id;
/**
* 单据编号(规则生成,出入库编号)
*/
@Schema(description="单据编号(规则生成,出入库编号)")
private String inventoryCode;
/**
* 单据日期
*/
@Schema(description="单据日期")
private LocalDate inventoryDate;
/**
* 单据类型(字典inventory_type)采购入库、采购退货、盘点入库等
*/
@Schema(description="单据类型(字典inventory_type)采购入库、采购退货、盘点入库等")
private String inventoryType;
/**
* 来源ID(根据类型指向对应的表,如采购单ID、退货单ID等)
*/
@Schema(description="来源code")
private String linkCode;
/**
* 仓库id
*/
@Schema(description="仓库id")
private String warehouseId;
/**
* 经办人id
*/
@Schema(description="经办人id")
private Long handlerUserId;
/**
* 审批状态
*/
@Schema(description="审批状态")
private String checkStatus;
/**
* 审批人id
*/
@Schema(description="审批人id")
private String checkUserId;
/**
* 审核日期
*/
@Schema(description="审核日期")
private LocalDateTime checkTime;
/**
* 商户编号
*/
@Schema(description="商户编号")
private Long merchantId;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* 货商
*/
@Schema(description="货商")
private Long supplierId;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
/**
* 订单类型(1入库 2出库)
*/
@Schema(description="订单类型(1入库 2出库)")
private String orderType;
/**
* 入库总金额
*/
@Schema(description="入库总金额")
private Integer totalAmount;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 租户编号
*/
@Schema(description="租户编号")
private Long tenantId;
@Schema(description="设备类型")
private Integer deviceType;
@Schema(description="流程实例id")
private String processInstanceId;
@Schema(description="审核原因")
private String checkReason;
@Schema(description="商品名称")
@TableField(exist = false)
private String productName;
@Schema(description="经办人名称")
@TableField(exist = false)
private String handlerUserName;
@Schema(description="收货数量")
private Integer receiveAmount;
@Schema(description="货商名称")
@TableField(exist = false)
private String supplierName;
@Schema(description="参数")
@TableField(exist = false)
private Map<String, Object> paramMap;
}
@@ -0,0 +1,32 @@
package com.bsd.pjcloud.canteen.vo.erp;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class CanteenSpuSimpleVO {
@Schema(description="id")
private Long id;
/**
* 商品名称
*/
@Schema(description="菜品名称")
private String name;
/**
* 商品封面图
*/
@Schema(description="菜品封面图")
private String picUrl;
}
@@ -0,0 +1,56 @@
package com.bsd.pjcloud.canteen.vo.erp;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 菜品库存VO
*
* @author zhangjiafu
*/
@Data
@Schema(description = "菜品库存VO")
public class CanteenSpuStockVO {
/**
* 商品 SPU 编号
*/
@Schema(description = "库存ida")
private Long id;
/**
* 商品名称
*/
@Schema(description = "商品名称")
private String name;
/**
* 商品封面图
*/
@Schema(description = "商品封面图")
private String picUrl;
/**
* 期初库存
*/
@Schema(description = "期初库存")
private Double baseStock;
/**
* 当前库存
*/
@Schema(description = "当前库存")
private Double currentStock;
/**
* 库存上限
*/
@Schema(description="库存上限")
private Integer inventoryUpperLimit;
/**
* 库存下限
*/
@Schema(description="库存下限")
private Integer inventoryLowerLimit;
}
@@ -0,0 +1,23 @@
package com.bsd.pjcloud.canteen.vo.erp;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "货商下拉")
public class CanteenSupplierSimpleVo {
/**
* id
*/
@Schema(description="id")
private Long supplierId;
/**
* 货商类别名称
*/
@Schema(description="货商名称")
private String supplierName;
}
@@ -0,0 +1,40 @@
package com.bsd.pjcloud.canteen.vo.erp;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Data
@Schema(description = "erp选择食材分页vo")
public class ErpMaterialPageVo {
/**
* id
*/
@Schema(description="食材id")
private Long id;
/**
* 商品名称
*/
@Schema(description="食材名称")
private String name;
/**
* 商品单位
*/
@Schema(description="食材单位")
private String unit;
/**
* 当前库存数量
*/
@Schema(description="当前库存数量")
private Double stock;
@Schema(description="采购价格")
private Integer purchasePrice;
}
@@ -0,0 +1,75 @@
package com.bsd.pjcloud.canteen.vo.erp;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* 采购计划-item
*
* @author zjf
* @date 2025-02-11 17:11:41
*/
@Data
@Schema(description = "采购计划-item")
public class InventoryRecordItemVo {
@Schema(description = "id")
private Long id;
@Schema(description="食材id")
private Long erpMaterialId;
@Schema(description="食材名称")
private String name;
/**
* 主表id
*/
@Schema(description="主表id")
private Long inventoryId;
/**
* 数量
*/
@Schema(description="数量")
private Integer quantity;
/**
* 进价
*/
@Schema(description="进价")
private Integer unitPrice;
/**
* 累计总金额
*/
@Schema(description="累计总金额")
private Integer totalAmount;
/**
* 累计数量
*/
@Schema(description="累计数量")
private Integer totalNumber;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
@Schema(description="实际进价")
private Integer realPrice;
/**
* 进价(分为单位)
*/
@Schema(description="进价(分为单位)")
private Integer purchasePrice;
}
@@ -0,0 +1,72 @@
package com.bsd.pjcloud.canteen.vo.erp;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "采购根据id查询-编辑回显 vo")
@Data
public class InventoryRecordVo {
@Schema(description ="id")
private Long id;
/**
* 采购计划编号
*/
@Schema(description="编号")
private String inventoryCode;
/**
* 采购计划单据日期
*/
@Schema(description="单据日期")
private LocalDate inventoryDate;
@Schema(description="商品名称")
private String productName;
/**
* 经办人id
*/
@Schema(description="经办人id")
private Long handlerUserId;
@Schema(description="供应商id")
private Long supplierId;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* @link InventoryRecordItemVo
*/
@Schema(description="item")
private List<InventoryRecordItemVo> items;
}
@@ -0,0 +1,54 @@
package com.bsd.pjcloud.canteen.vo.erp;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.baomidou.mybatisplus.annotation.*;
import com.github.yulichang.annotation.EntityMapping;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Data
@Schema(description = "菜品模版vo")
public class ProductTemplateVO {
/**
* id
*/
@Schema(description="id")
private Long id;
/**
* 模版名称
*/
@Schema(description="模版名称")
private String templateName;
/**
* 菜品id
*/
@Schema(description="菜品id")
private Long dishId;
/**
* 基准产出量(碗)
*/
@Schema(description="基准产出量(碗)")
private Double baseOutput;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
@Schema(description="菜品名称")
private String dishName;
private List<ProductionTemplateDetailVO> canteenProductionTemplateDetailList;
}
@@ -0,0 +1,43 @@
package com.bsd.pjcloud.canteen.vo.erp;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class ProductionRecordDTO {
/**
* id
*/
@Schema(description="id")
private Long id;
/**
* 加工日期
*/
@Schema(description="加工日期")
private LocalDateTime productionTime;
/**
* 加工人
*/
@Schema(description="加工人")
private String handlerUser;
/**
* 加工批次号
*/
@Schema(description="加工批次号")
private String recordCode;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
}
@@ -0,0 +1,105 @@
package com.bsd.pjcloud.canteen.vo.erp;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class ProductionRecordItemDTO {
/**
* id
*/
@Schema(description="id")
private Long id;
/**
* 单据类型(字典inventory_type)
*/
@Schema(description="单据类型(字典inventory_type)")
private String inventoryType;
/**
* 原料id
*/
@Schema(description="原料id")
private Long erpMaterialId;
/**
* 商户编号
*/
@Schema(description="商户编号")
private Long merchantId;
/**
* 出入库数量
*/
@Schema(description="出入库数量")
private Double quantity;
/**
* 单价
*/
@Schema(description="单价")
private Integer unitPrice;
/**
* 总金额
*/
@Schema(description="总金额")
private Integer totalAmount;
/**
* 税率%
*/
@Schema(description="税率%")
private Integer taxRate;
/**
* 税前金额
*/
@Schema(description="税前金额")
private Integer taxAmount;
/**
* 货商
*/
@Schema(description="货商")
private Long supplierId;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
/**
* 总数
*/
@Schema(description="总数")
private Integer totalNumber;
/**
* 账面数量
*/
@Schema(description="账面数量")
private Integer accountNumber;
/**
* 实际数量
*/
@Schema(description="实际数量")
private Integer realNumber;
/**
* 实际单价
*/
@Schema(description="实际单价")
private Integer realPrice;
}
@@ -0,0 +1,62 @@
package com.bsd.pjcloud.canteen.vo.erp;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.bsd.pjcloud.common.core.util.TenantTable;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 加工模版明细表
*
* @author zjf
* @date 2025-05-12 13:53:57
*/
@Data
@Schema(description = "加工模版明细表")
public class ProductionTemplateDetailVO{
/**
* id
*/
@Schema(description="id")
private Long id;
/**
* 模版id
*/
@Schema(description="模版id")
private Long templateId;
/**
* 原料id
*/
@Schema(description="原料id")
private Long materialId;
/**
* 基准用量
*/
@Schema(description="基准用量")
private Double baseUsage;
/**
* 损耗率
*/
@Schema(description="损耗率")
private Double lossRate;
@Schema(description="食材名称")
private String materialName;
@Schema(description="单位")
private String unit;
}
@@ -14,6 +14,11 @@
<dependencies>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
<version>1.3.4</version>
</dependency>
<!-- 分布式任务-->
<dependency>
@@ -71,6 +76,11 @@
<groupId>com.bsd</groupId>
<artifactId>pjcloud-common-feign</artifactId>
</dependency>
<!-- 分布式发号器-->
<dependency>
<groupId>com.bsd</groupId>
<artifactId>pjcloud-common-sequence</artifactId>
</dependency>
<!--必备: 依赖api模块-->
<dependency>
<groupId>com.bsd</groupId>
@@ -0,0 +1,14 @@
package com.bsd.pjcloud.canteen.config;
import cn.hutool.core.date.DateUtil;
import com.bsd.pjcloud.common.sequence.range.BizName;
public class PjcloudBizName implements BizName {
/**
* 生成名称
*/
@Override
public String create() {
return DateUtil.today();
}
}
@@ -0,0 +1,29 @@
package com.bsd.pjcloud.canteen.config;
import com.bsd.pjcloud.common.sequence.builder.DbSeqBuilder;
import com.bsd.pjcloud.common.sequence.sequence.Sequence;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
/**
* <p>
* 设置发号器生成规则
*/
@Configuration
public class SequenceConfig {
@Bean
public Sequence sequence(DataSource dataSource) {
return DbSeqBuilder
.create()
.bizName(new PjcloudBizName())// 定义切片规则
.dataSource(dataSource) // 注入数据源
.step(1000) // 每次获取数据的个数
.retryTimes(3) // 重试次数
.tableName("pjcloud_sequence") // 存储表名信息
.build();
}
}
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.canteen.dto.boxes.admin.BokingPageDTO;
import com.bsd.pjcloud.canteen.job.BoxesAvaliabilityJob;
import com.bsd.pjcloud.canteen.vo.AppMakeSaveReqVO;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
@@ -47,6 +48,9 @@ public class BoxesBookingController {
private final BoxesBookingService boxesBookingService;
private final BoxesAvaliabilityJob batchAvaliabilityJob;
/**
* 分页查询
* @param page 分页对象
@@ -157,6 +161,15 @@ public class BoxesBookingController {
}
@Operation(summary = "同步包厢时间" , description = "同步包厢时间" )
@GetMapping("/anscyJob" )
public R getById() {
batchAvaliabilityJob.avaliabilityJobHandler();
return R.ok();
}
//-------------app------------------
// @GetMapping("/getMyBookingPage")
// @Operation(summary = "获得我的预约包厢信息")
@@ -0,0 +1,49 @@
package com.bsd.pjcloud.canteen.controller;
import com.bsd.pjcloud.canteen.constant.InventoryTypeEnum;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.sequence.sequence.Sequence;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 超市公共接口
*
* @author pjcloud
* @date 2025-02-10 12:15:37
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/canteen/common" )
@Tag(description = "食堂公共部分接口" , name = "食堂公共部分接口" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class CanteenCommonController {
@Autowired
private Sequence sequence;
/**
* 采购计划选择商品分页数据
* 分页查询
* @param type @link InventoryTypeEnum
* @return
*/
@Operation(summary = "获取业务流水编号" , description = "获取业务流水编号" )
@GetMapping("/getSequence")
public R getErpSpuPage(@RequestParam("type")String type) {
String valueByType = InventoryTypeEnum.getValueByType(type);
String s = sequence.nextNo();
String result = valueByType + "-" + s;
return R.ok(result);
}
}
@@ -0,0 +1,141 @@
package com.bsd.pjcloud.canteen.controller;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
import com.bsd.pjcloud.canteen.vo.erp.CanteenErpCategorySimpleVo;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.canteen.entity.CanteenErpCategoryEntity;
import com.bsd.pjcloud.canteen.service.CanteenErpCategoryService;
import com.bsd.pjcloud.common.security.util.SecurityUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 食材分类
*
* @author zjf
* @date 2025-05-28 11:12:41
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/canteenErpCategory" )
@Tag(description = "canteenErpCategory" , name = "食材分类管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class CanteenErpCategoryController {
private final CanteenErpCategoryService canteenErpCategoryService;
/**
* 分页查询
* @param page 分页对象
* @param canteenErpCategory 食材分类
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('canteen_canteenErpCategory_view')" )
public R getCanteenErpCategoryPage(@ParameterObject Page page, @ParameterObject CanteenErpCategoryEntity canteenErpCategory) {
LambdaQueryWrapper<CanteenErpCategoryEntity> wrapper = Wrappers.lambdaQuery();
wrapper.eq(StrUtil.isNotBlank(canteenErpCategory.getName()),CanteenErpCategoryEntity::getName,canteenErpCategory.getName());
return R.ok(canteenErpCategoryService.pageScope(page, wrapper));
}
/**
* 通过id查询食材分类
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('canteen_canteenErpCategory_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(canteenErpCategoryService.getById(id));
}
/**
* 新增食材分类
* @param canteenErpCategory 食材分类
* @return R
*/
@Operation(summary = "新增食材分类" , description = "新增食材分类" )
@SysLog("新增食材分类" )
@PostMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenErpCategory_add')" )
public R save(@RequestBody CanteenErpCategoryEntity canteenErpCategory) {
canteenErpCategory.setDeptId(SecurityUtils.getUser().getDeptId());
return R.ok(canteenErpCategoryService.save(canteenErpCategory));
}
/**
* 修改食材分类
* @param canteenErpCategory 食材分类
* @return R
*/
@Operation(summary = "修改食材分类" , description = "修改食材分类" )
@SysLog("修改食材分类" )
@PutMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenErpCategory_edit')" )
public R updateById(@RequestBody CanteenErpCategoryEntity canteenErpCategory) {
return R.ok(canteenErpCategoryService.updateById(canteenErpCategory));
}
/**
* 通过id删除食材分类
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除食材分类" , description = "通过id删除食材分类" )
@SysLog("通过id删除食材分类" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenErpCategory_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(canteenErpCategoryService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param canteenErpCategory 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('canteen_canteenErpCategory_export')" )
public List<CanteenErpCategoryEntity> export(CanteenErpCategoryEntity canteenErpCategory,Long[] ids) {
return canteenErpCategoryService.list(Wrappers.lambdaQuery(canteenErpCategory).in(ArrayUtil.isNotEmpty(ids), CanteenErpCategoryEntity::getId, ids));
}
/**
* 获取所有分类
* @return
*/
@Operation(summary = "下拉查询")
@GetMapping("/simpleAll")
public R getSimpleAll(@RequestParam(value = "id",required = false)Long categoryId) {
List<CanteenErpCategoryEntity> list = canteenErpCategoryService.listScope(categoryId);
List<CanteenErpCategorySimpleVo> bean = BeanUtils.toBean(list, CanteenErpCategorySimpleVo.class);
return R.ok(bean);
}
}
@@ -0,0 +1,139 @@
package com.bsd.pjcloud.canteen.controller;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.canteen.dto.erp.CanteenErpMaterialEditorDTO;
import com.bsd.pjcloud.canteen.dto.erp.CanteenErpMaterialSaveDTO;
import com.bsd.pjcloud.canteen.entity.CanteenStockEntity;
import com.bsd.pjcloud.canteen.service.CanteenStockService;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.canteen.entity.CanteenErpMaterialEntity;
import com.bsd.pjcloud.canteen.service.CanteenErpMaterialService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 原料表
*
* @author zjf
* @date 2025-05-07 13:16:32
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/canteenErpMaterial" )
@Tag(description = "canteenErpMaterial" , name = "原料表管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class CanteenErpMaterialController {
private final CanteenErpMaterialService canteenErpMaterialService;
private final CanteenStockService canteenStockService;
/**
* 分页查询
* @param page 分页对象
* @param canteenErpMaterial 原料表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('canteen_canteenErpMaterial_view')" )
public R getCanteenErpMaterialPage(@ParameterObject Page page, @ParameterObject CanteenErpMaterialEntity canteenErpMaterial) {
return R.ok(canteenErpMaterialService.pageScope(page, canteenErpMaterial));
}
/**
* 通过id查询原料表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('canteen_canteenErpMaterial_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(canteenErpMaterialService.getCanteenErpMaterialVOById(id));
}
/**
* 新增原料表
* @param
* @return R
*/
@Operation(summary = "新增原料表" , description = "新增原料表" )
@SysLog("新增原料表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenErpMaterial_add')" )
public R save(@RequestBody CanteenErpMaterialSaveDTO canteenErpMaterialSaveDTO) {
return R.ok(canteenErpMaterialService.saveCanteenErpMaterialDTO(canteenErpMaterialSaveDTO));
}
/**
* 修改原料表
* @return R
*/
@Operation(summary = "修改原料表" , description = "修改原料表" )
@SysLog("修改原料表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenErpMaterial_edit')" )
public R updateById(@RequestBody CanteenErpMaterialEditorDTO canteenErpMaterialEditorDTO) {
return R.ok(canteenErpMaterialService.updateById(canteenErpMaterialEditorDTO));
}
/**
* 通过id删除原料表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除原料表" , description = "通过id删除原料表" )
@SysLog("通过id删除原料表" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenErpMaterial_del')")
@Transactional
public R removeById(@RequestBody Long[] ids) {
boolean b = canteenErpMaterialService.removeBatchByIds(CollUtil.toList(ids));
canteenStockService.remove(Wrappers.lambdaQuery(CanteenStockEntity.class).in(CanteenStockEntity::getItemId, ids));
return R.ok(b);
}
/**
* 导出excel 表格
* @param canteenErpMaterial 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('canteen_canteenErpMaterial_export')" )
public List<CanteenErpMaterialEntity> export(CanteenErpMaterialEntity canteenErpMaterial,Long[] ids) {
return canteenErpMaterialService.list(Wrappers.lambdaQuery(canteenErpMaterial).in(ArrayUtil.isNotEmpty(ids), CanteenErpMaterialEntity::getId, ids));
}
/**
* erp选择食材分页数据
* 分页查询
* @param page 分页对象
* @return
*/
@Operation(summary = "选择食材分页数据" , description = "选择食材分页数据" )
@GetMapping("/erpMaterialPage" )
public R getErpMaterialPage(@ParameterObject Page page, @RequestParam(value = "name",required = false)String name) {
return R.ok(canteenErpMaterialService.getErpMaterialPage(page, name));
}
}
@@ -0,0 +1,134 @@
package com.bsd.pjcloud.canteen.controller;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.canteen.dto.erp.CanteenInventoryRecordEditDTO;
import com.bsd.pjcloud.canteen.dto.erp.CanteenInventoryRecordsdDTO;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsEntity;
import com.bsd.pjcloud.canteen.service.CanteenInventoryRecordsService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 采购记录表
*
* @author zjf
* @date 2025-05-07 17:00:50
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/canteenInventoryRecords" )
@Tag(description = "canteenInventoryRecords" , name = "食堂进销管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class CanteenInventoryRecordsController {
private final CanteenInventoryRecordsService canteenInventoryRecordsService;
/**
* 分页查询
* @param page 分页对象
* @param canteenInventoryRecords 采购记录表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecords_view')" )
public R getCanteenInventoryRecordsPage(@ParameterObject Page page, @ParameterObject CanteenInventoryRecordsEntity canteenInventoryRecords) {
// LambdaQueryWrapper<CanteenInventoryRecordsEntity> wrapper = Wrappers.lambdaQuery();
// wrapper.eq(StrUtil.isNotBlank(canteenInventoryRecords.getInventoryCode()),CanteenInventoryRecordsEntity::getInventoryCode,canteenInventoryRecords.getInventoryCode());
// wrapper.eq(Objects.nonNull(canteenInventoryRecords.getInventoryDate()),CanteenInventoryRecordsEntity::getInventoryDate,canteenInventoryRecords.getInventoryDate());
return R.ok(canteenInventoryRecordsService.pageScope(page, canteenInventoryRecords));
}
/**
* 通过id查询采购记录表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecords_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(canteenInventoryRecordsService.getInventoryDetailById(id));
}
/**
* 新增采购记录表
* @param canteenInventoryRecordsdDTO 采购记录表
* @return R
*/
@Operation(summary = "新增采购记录表" , description = "新增采购记录表" )
@SysLog("新增采购记录表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecords_add')" )
public R save(@RequestBody CanteenInventoryRecordsdDTO canteenInventoryRecordsdDTO) {
return R.ok(canteenInventoryRecordsService.saveCanteenInventoryRecordsdDTO(canteenInventoryRecordsdDTO));
}
@Operation(summary = "采购验收" , description = "采购验收" )
@SysLog("采购验收" )
@PostMapping("/ys")
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecords_ys')" )
public R ys(@RequestParam Long id) {
canteenInventoryRecordsService.ys(id);
return R.ok();
}
/**
* 修改采购记录表
* @param canteenInventoryRecordEditDTO 采购记录表
* @return R
*/
@Operation(summary = "修改采购记录表" , description = "修改采购记录表" )
@SysLog("修改采购记录表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecords_edit')" )
public R updateById(@RequestBody CanteenInventoryRecordEditDTO canteenInventoryRecordEditDTO) {
return R.ok(canteenInventoryRecordsService.updateByCanteenInventoryRecordEditDTO(canteenInventoryRecordEditDTO));
}
/**
* 通过id删除采购记录表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除采购记录表" , description = "通过id删除采购记录表" )
@SysLog("通过id删除采购记录表" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecords_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(canteenInventoryRecordsService.removeBatch(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param canteenInventoryRecords 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecords_export')" )
public List<CanteenInventoryRecordsEntity> export(CanteenInventoryRecordsEntity canteenInventoryRecords,Long[] ids) {
return canteenInventoryRecordsService.list(Wrappers.lambdaQuery(canteenInventoryRecords).in(ArrayUtil.isNotEmpty(ids), CanteenInventoryRecordsEntity::getId, ids));
}
}
@@ -0,0 +1,119 @@
package com.bsd.pjcloud.canteen.controller;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsItemEntity;
import com.bsd.pjcloud.canteen.service.CanteenInventoryRecordsItemService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 采购记录明细表
*
* @author zjf
* @date 2025-05-07 17:02:53
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/canteenInventoryRecordsItem" )
@Tag(description = "canteenInventoryRecordsItem" , name = "食堂进销管理明细管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class CanteenInventoryRecordsItemController {
private final CanteenInventoryRecordsItemService canteenInventoryRecordsItemService;
/**
* 分页查询
* @param page 分页对象
* @param canteenInventoryRecordsItem 采购记录明细表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecordsItem_view')" )
public R getCanteenInventoryRecordsItemPage(@ParameterObject Page page, @ParameterObject CanteenInventoryRecordsItemEntity canteenInventoryRecordsItem) {
LambdaQueryWrapper<CanteenInventoryRecordsItemEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(canteenInventoryRecordsItemService.page(page, wrapper));
}
/**
* 通过id查询采购记录明细表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecordsItem_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(canteenInventoryRecordsItemService.getById(id));
}
/**
* 新增采购记录明细表
* @param canteenInventoryRecordsItem 采购记录明细表
* @return R
*/
@Operation(summary = "新增采购记录明细表" , description = "新增采购记录明细表" )
@SysLog("新增采购记录明细表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecordsItem_add')" )
public R save(@RequestBody CanteenInventoryRecordsItemEntity canteenInventoryRecordsItem) {
return R.ok(canteenInventoryRecordsItemService.save(canteenInventoryRecordsItem));
}
/**
* 修改采购记录明细表
* @param canteenInventoryRecordsItem 采购记录明细表
* @return R
*/
@Operation(summary = "修改采购记录明细表" , description = "修改采购记录明细表" )
@SysLog("修改采购记录明细表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecordsItem_edit')" )
public R updateById(@RequestBody CanteenInventoryRecordsItemEntity canteenInventoryRecordsItem) {
return R.ok(canteenInventoryRecordsItemService.updateById(canteenInventoryRecordsItem));
}
/**
* 通过id删除采购记录明细表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除采购记录明细表" , description = "通过id删除采购记录明细表" )
@SysLog("通过id删除采购记录明细表" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecordsItem_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(canteenInventoryRecordsItemService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param canteenInventoryRecordsItem 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecordsItem_export')" )
public List<CanteenInventoryRecordsItemEntity> export(CanteenInventoryRecordsItemEntity canteenInventoryRecordsItem,Long[] ids) {
return canteenInventoryRecordsItemService.list(Wrappers.lambdaQuery(canteenInventoryRecordsItem).in(ArrayUtil.isNotEmpty(ids), CanteenInventoryRecordsItemEntity::getId, ids));
}
}
@@ -191,7 +191,7 @@ public class CanteenOnlineSpuController {
*/
@Operation(summary = "通过ids查询", description = "通过ids查询")
@PostMapping("/app/getSpuListByIds")
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')")
// @PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')")
public R<List<CanteenOnlineSpuAppVO>> getByIds(@RequestBody List<Long> ids) {
List<CanteenOnlineSpuEntity> list = canteenOnlineSpuService.list(new LambdaQueryWrapper<CanteenOnlineSpuEntity>().in(CanteenOnlineSpuEntity::getId, ids));
List<CanteenOnlineSpuAppVO> canteenOnlineSpuAppVOS = BeanUtils.toBean(list, CanteenOnlineSpuAppVO.class);
@@ -0,0 +1,122 @@
package com.bsd.pjcloud.canteen.controller;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.canteen.dto.erp.CanteenProductRecordSaveDTO;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.canteen.entity.CanteenProductionRecordEntity;
import com.bsd.pjcloud.canteen.service.CanteenProductionRecordService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 食材加工记录表
*
* @author zjf
* @date 2025-05-08 11:02:09
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/canteenProductionRecord" )
@Tag(description = "canteenProductionRecord" , name = "食材加工记录表管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class CanteenProductionRecordController {
private final CanteenProductionRecordService canteenProductionRecordService;
/**
* 分页查询
* @param page 分页对象
* @param canteenProductionRecord 食材加工记录表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionRecord_view')" )
public R getCanteenProductionRecordPage(@ParameterObject Page page, @ParameterObject CanteenProductionRecordEntity canteenProductionRecord) {
LambdaQueryWrapper<CanteenProductionRecordEntity> wrapper = Wrappers.lambdaQuery();
wrapper.eq(Objects.nonNull(canteenProductionRecord.getProductionTime()),CanteenProductionRecordEntity::getProductionTime,canteenProductionRecord.getProductionTime());
wrapper.eq(StrUtil.isNotBlank(canteenProductionRecord.getRecordCode()),CanteenProductionRecordEntity::getRecordCode,canteenProductionRecord.getRecordCode());
return R.ok(canteenProductionRecordService.pageScope(page, wrapper));
}
/**
* 通过id查询食材加工记录表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionRecord_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(canteenProductionRecordService.getById(id));
}
/**
* 新增食材加工记录表
* @return R
*/
@Operation(summary = "新增食材加工记录表" , description = "新增食材加工记录表" )
@SysLog("新增食材加工记录表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionRecord_add')" )
public R save(@RequestBody CanteenProductRecordSaveDTO canteenProductRecordSaveDTO) {
return R.ok(canteenProductionRecordService.saveCanteenProductRecordSaveDTO(canteenProductRecordSaveDTO));
}
/**
* 修改食材加工记录表
* @param canteenProductionRecord 食材加工记录表
* @return R
*/
@Operation(summary = "修改食材加工记录表" , description = "修改食材加工记录表" )
@SysLog("修改食材加工记录表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionRecord_edit')" )
public R updateById(@RequestBody CanteenProductionRecordEntity canteenProductionRecord) {
return R.ok(canteenProductionRecordService.updateById(canteenProductionRecord));
}
/**
* 通过id删除食材加工记录表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除食材加工记录表" , description = "通过id删除食材加工记录表" )
@SysLog("通过id删除食材加工记录表" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionRecord_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(canteenProductionRecordService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param canteenProductionRecord 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionRecord_export')" )
public List<CanteenProductionRecordEntity> export(CanteenProductionRecordEntity canteenProductionRecord,Long[] ids) {
return canteenProductionRecordService.list(Wrappers.lambdaQuery(canteenProductionRecord).in(ArrayUtil.isNotEmpty(ids), CanteenProductionRecordEntity::getId, ids));
}
}
@@ -0,0 +1,119 @@
package com.bsd.pjcloud.canteen.controller;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.canteen.entity.CanteenProductionRecordItemEntity;
import com.bsd.pjcloud.canteen.service.CanteenProductionRecordItemService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 食材加工记录明细表
*
* @author zjf
* @date 2025-05-08 11:05:02
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/canteenProductionRecordItem" )
@Tag(description = "canteenProductionRecordItem" , name = "食材加工记录明细表管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class CanteenProductionRecordItemController {
private final CanteenProductionRecordItemService canteenProductionRecordItemService;
/**
* 分页查询
* @param page 分页对象
* @param canteenProductionRecordItem 食材加工记录明细表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionRecordItem_view')" )
public R getCanteenProductionRecordItemPage(@ParameterObject Page page, @ParameterObject CanteenProductionRecordItemEntity canteenProductionRecordItem) {
LambdaQueryWrapper<CanteenProductionRecordItemEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(canteenProductionRecordItemService.page(page, wrapper));
}
/**
* 通过id查询食材加工记录明细表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionRecordItem_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(canteenProductionRecordItemService.getById(id));
}
/**
* 新增食材加工记录明细表
* @param canteenProductionRecordItem 食材加工记录明细表
* @return R
*/
@Operation(summary = "新增食材加工记录明细表" , description = "新增食材加工记录明细表" )
@SysLog("新增食材加工记录明细表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionRecordItem_add')" )
public R save(@RequestBody CanteenProductionRecordItemEntity canteenProductionRecordItem) {
return R.ok(canteenProductionRecordItemService.save(canteenProductionRecordItem));
}
/**
* 修改食材加工记录明细表
* @param canteenProductionRecordItem 食材加工记录明细表
* @return R
*/
@Operation(summary = "修改食材加工记录明细表" , description = "修改食材加工记录明细表" )
@SysLog("修改食材加工记录明细表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionRecordItem_edit')" )
public R updateById(@RequestBody CanteenProductionRecordItemEntity canteenProductionRecordItem) {
return R.ok(canteenProductionRecordItemService.updateById(canteenProductionRecordItem));
}
/**
* 通过id删除食材加工记录明细表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除食材加工记录明细表" , description = "通过id删除食材加工记录明细表" )
@SysLog("通过id删除食材加工记录明细表" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionRecordItem_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(canteenProductionRecordItemService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param canteenProductionRecordItem 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionRecordItem_export')" )
public List<CanteenProductionRecordItemEntity> export(CanteenProductionRecordItemEntity canteenProductionRecordItem,Long[] ids) {
return canteenProductionRecordItemService.list(Wrappers.lambdaQuery(canteenProductionRecordItem).in(ArrayUtil.isNotEmpty(ids), CanteenProductionRecordItemEntity::getId, ids));
}
}
@@ -0,0 +1,132 @@
package com.bsd.pjcloud.canteen.controller;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.canteen.entity.CanteenProductionTemplateEntity;
import com.bsd.pjcloud.canteen.service.CanteenProductionTemplateService;
import com.bsd.pjcloud.common.security.util.SecurityUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 加工模版表
*
* @author zjf
* @date 2025-05-12 13:41:26
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/canteenProductionTemplate" )
@Tag(description = "canteenProductionTemplate" , name = "加工模版表管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class CanteenProductionTemplateController {
private final CanteenProductionTemplateService canteenProductionTemplateService;
/**
* 分页查询
* @param page 分页对象
* @param canteenProductionTemplate 加工模版表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionTemplate_view')" )
public R getCanteenProductionTemplatePage(@ParameterObject Page page, @ParameterObject CanteenProductionTemplateEntity canteenProductionTemplate) {
LambdaQueryWrapper<CanteenProductionTemplateEntity> wrapper = Wrappers.lambdaQuery();
wrapper.eq(StrUtil.isNotBlank(canteenProductionTemplate.getTemplateName()),CanteenProductionTemplateEntity::getTemplateName,canteenProductionTemplate.getTemplateName());
return R.ok(canteenProductionTemplateService.pageScope(page, wrapper));
}
/**
* 通过id查询加工模版表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionTemplate_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(canteenProductionTemplateService.getDetailById(id));
}
/**
* 新增加工模版表
* @param canteenProductionTemplate 加工模版表
* @return R
*/
@Operation(summary = "新增加工模版表" , description = "新增加工模版表" )
@SysLog("新增加工模版表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionTemplate_add')" )
public R save(@RequestBody CanteenProductionTemplateEntity canteenProductionTemplate) {
canteenProductionTemplate.setDeptId(SecurityUtils.getUser().getDeptId());
return R.ok(canteenProductionTemplateService.saveDeep(canteenProductionTemplate));
}
/**
* 修改加工模版表
* @param canteenProductionTemplate 加工模版表
* @return R
*/
@Operation(summary = "修改加工模版表" , description = "修改加工模版表" )
@SysLog("修改加工模版表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionTemplate_edit')" )
public R updateById(@RequestBody CanteenProductionTemplateEntity canteenProductionTemplate) {
return R.ok(canteenProductionTemplateService.updateDeep(canteenProductionTemplate));
}
/**
* 通过id删除加工模版表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除加工模版表" , description = "通过id删除加工模版表" )
@SysLog("通过id删除加工模版表" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionTemplate_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(canteenProductionTemplateService.removeDeep(ids));
}
/**
* 导出excel 表格
* @param canteenProductionTemplate 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionTemplate_export')" )
public List<CanteenProductionTemplateEntity> export(CanteenProductionTemplateEntity canteenProductionTemplate,Long[] ids) {
return canteenProductionTemplateService.list(Wrappers.lambdaQuery(canteenProductionTemplate).in(ArrayUtil.isNotEmpty(ids), CanteenProductionTemplateEntity::getId, ids));
}
@Operation(summary = "选择加工菜品模版分页" , description = "选择加工菜品模版分页" )
@GetMapping("/getSelectTemplatePage" )
public R getSelectTemplatePage(@ParameterObject Page page, @RequestParam(value = "name",required = false)String name) {
return R.ok(canteenProductionTemplateService.getSelectTemplatePageScope(page, name));
}
}
@@ -0,0 +1,119 @@
package com.bsd.pjcloud.canteen.controller;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.canteen.entity.CanteenProductionTemplateDetailEntity;
import com.bsd.pjcloud.canteen.service.CanteenProductionTemplateDetailService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 加工模版明细表
*
* @author zjf
* @date 2025-05-12 13:53:57
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/canteenProductionTemplateDetail" )
@Tag(description = "canteenProductionTemplateDetail" , name = "加工模版明细表管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class CanteenProductionTemplateDetailController {
private final CanteenProductionTemplateDetailService canteenProductionTemplateDetailService;
/**
* 分页查询
* @param page 分页对象
* @param canteenProductionTemplateDetail 加工模版明细表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionTemplateDetail_view')" )
public R getCanteenProductionTemplateDetailPage(@ParameterObject Page page, @ParameterObject CanteenProductionTemplateDetailEntity canteenProductionTemplateDetail) {
LambdaQueryWrapper<CanteenProductionTemplateDetailEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(canteenProductionTemplateDetailService.page(page, wrapper));
}
/**
* 通过id查询加工模版明细表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionTemplateDetail_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(canteenProductionTemplateDetailService.getById(id));
}
/**
* 新增加工模版明细表
* @param canteenProductionTemplateDetail 加工模版明细表
* @return R
*/
@Operation(summary = "新增加工模版明细表" , description = "新增加工模版明细表" )
@SysLog("新增加工模版明细表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionTemplateDetail_add')" )
public R save(@RequestBody CanteenProductionTemplateDetailEntity canteenProductionTemplateDetail) {
return R.ok(canteenProductionTemplateDetailService.save(canteenProductionTemplateDetail));
}
/**
* 修改加工模版明细表
* @param canteenProductionTemplateDetail 加工模版明细表
* @return R
*/
@Operation(summary = "修改加工模版明细表" , description = "修改加工模版明细表" )
@SysLog("修改加工模版明细表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionTemplateDetail_edit')" )
public R updateById(@RequestBody CanteenProductionTemplateDetailEntity canteenProductionTemplateDetail) {
return R.ok(canteenProductionTemplateDetailService.updateById(canteenProductionTemplateDetail));
}
/**
* 通过id删除加工模版明细表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除加工模版明细表" , description = "通过id删除加工模版明细表" )
@SysLog("通过id删除加工模版明细表" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionTemplateDetail_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(canteenProductionTemplateDetailService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param canteenProductionTemplateDetail 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionTemplateDetail_export')" )
public List<CanteenProductionTemplateDetailEntity> export(CanteenProductionTemplateDetailEntity canteenProductionTemplateDetail,Long[] ids) {
return canteenProductionTemplateDetailService.list(Wrappers.lambdaQuery(canteenProductionTemplateDetail).in(ArrayUtil.isNotEmpty(ids), CanteenProductionTemplateDetailEntity::getId, ids));
}
}
@@ -6,9 +6,16 @@ import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.canteen.constant.StockTypeEnum;
import com.bsd.pjcloud.canteen.dto.CanteenDailySpuDTO;
import com.bsd.pjcloud.canteen.dto.CanteenSpuUpdateStockReqDTO;
import com.bsd.pjcloud.canteen.entity.CanteenErpMaterialEntity;
import com.bsd.pjcloud.canteen.entity.CanteenOnlineSpuEntity;
import com.bsd.pjcloud.canteen.entity.CanteenStockEntity;
import com.bsd.pjcloud.canteen.mapper.CanteenStockMapper;
import com.bsd.pjcloud.canteen.service.CanteenStockService;
import com.bsd.pjcloud.canteen.vo.erp.CanteenSpuSimpleVO;
import com.bsd.pjcloud.canteen.vo.erp.CanteenSpuStockVO;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
@@ -43,6 +50,8 @@ public class CanteenSpuController {
private final CanteenSpuService canteenSpuService;
private final CanteenStockService canteenStockService;
/**
* 分页查询
*
@@ -58,6 +67,27 @@ public class CanteenSpuController {
}
@Operation(summary = "erp分页查询", description = "erp分页查询")
@GetMapping("/erp/page")
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')")
public R<Page<CanteenSpuStockVO>> getCanteenSpuErpPage(@ParameterObject Page page, @ParameterObject CanteenSpuEntity canteenSpu) {
return R.ok(canteenSpuService.erpPageScope(page, canteenSpu));
}
/**
* 选择菜品分页查询
* 1.生产加工模版选择菜品
* @param page
* @param canteenSpu
* @return
*/
@Operation(summary = "生产加工模版选择菜品分页查询", description = "生产加工模版选择菜品分页查询")
@GetMapping("/getCanteenSpuSimplePage")
public R<Page<CanteenSpuSimpleVO>> getCanteenSpuSimplePage(@ParameterObject Page page, @ParameterObject CanteenSpuEntity canteenSpu) {
return R.ok(canteenSpuService.getCanteenSpuSimplePageScope(page, canteenSpu));
}
/**
* 每日分页查询
*
@@ -96,9 +126,21 @@ public class CanteenSpuController {
@SysLog("新增菜品spu")
@PostMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_add')")
@Transactional
public R save(@RequestBody CanteenSpuEntity canteenSpu) {
canteenSpu.setDeptId(SecurityUtils.getUser().getDeptId());
return R.ok(canteenSpuService.save(canteenSpu));
Long deptId = SecurityUtils.getUser().getDeptId();
canteenSpu.setDeptId(deptId);
boolean save = canteenSpuService.save(canteenSpu);
CanteenStockEntity canteenStockEntity = new CanteenStockEntity();
canteenStockEntity.setItemId(canteenSpu.getId());
canteenStockEntity.setItemType(StockTypeEnum.DISH.getType());
canteenStockEntity.setBaseStock(0D);
canteenStockEntity.setInventoryUpperLimit(0);
canteenStockEntity.setInventoryLowerLimit(0);
canteenStockEntity.setCurrentStock(0D);
canteenStockEntity.setDeptId(deptId);
canteenStockService.save(canteenStockEntity);
return R.ok(save);
}
/**
@@ -115,6 +157,20 @@ public class CanteenSpuController {
return R.ok(canteenSpuService.updateById(canteenSpu));
}
/**
* 修改菜品spu
*
* @param canteenSpu 菜品spu
* @return R
*/
// @Operation(summary = "修改erp菜品库存", description = "修改erp菜品库存")
// @SysLog("修改erp菜品库存")
// @PutMapping("/editor")
// @PreAuthorize("@pms.hasPermission('canteen_canteenSpu_edit')")
// public R updateById(@RequestBody CanteenSpuEntity canteenSpu) {
// return R.ok(canteenSpuService.updateById(canteenSpu));
// }
/**
* 通过id删除菜品spu
*
@@ -194,4 +250,7 @@ public class CanteenSpuController {
}
return R.ok();
}
}
@@ -0,0 +1,185 @@
package com.bsd.pjcloud.canteen.controller;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.canteen.entity.CanteenErpMaterialEntity;
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
import com.bsd.pjcloud.canteen.service.CanteenSpuService;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.canteen.entity.CanteenStockEntity;
import com.bsd.pjcloud.canteen.service.CanteenStockService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 库存表
*
* @author zjf
* @date 2025-05-07 16:40:35
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/canteenStock" )
@Tag(description = "canteenStock" , name = "库存表管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class CanteenStockController {
private final CanteenStockService canteenStockService;
private final CanteenSpuService canteenSpuService;
/**
* 分页查询
* @param page 分页对象
* @param canteenStock 库存表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('canteen_canteenStock_view')" )
public R getCanteenStockPage(@ParameterObject Page page, @ParameterObject CanteenStockEntity canteenStock) {
LambdaQueryWrapper<CanteenStockEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(canteenStockService.page(page, wrapper));
}
/**
* 通过id查询库存表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('canteen_canteenStock_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(canteenStockService.getById(id));
}
/**
* 新增库存表
* @param canteenStock 库存表
* @return R
*/
@Operation(summary = "新增库存表" , description = "新增库存表" )
@SysLog("新增库存表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenStock_add')" )
public R save(@RequestBody CanteenStockEntity canteenStock) {
return R.ok(canteenStockService.save(canteenStock));
}
/**
* 修改库存表
* @param canteenStock 库存表
* @return R
*/
@Operation(summary = "修改库存表" , description = "修改库存表" )
@SysLog("修改库存表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenStock_edit')" )
public R updateById(@RequestBody CanteenStockEntity canteenStock) {
return R.ok(canteenStockService.updateById(canteenStock));
}
/**
* 通过id删除库存表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除库存表" , description = "通过id删除库存表" )
@SysLog("通过id删除库存表" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenStock_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(canteenStockService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param canteenStock 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('canteen_canteenStock_export')" )
public List<CanteenStockEntity> export(CanteenStockEntity canteenStock,Long[] ids) {
return canteenStockService.list(Wrappers.lambdaQuery(canteenStock).in(ArrayUtil.isNotEmpty(ids), CanteenStockEntity::getId, ids));
}
@PostMapping("/canteen/ansync")
@PreAuthorize("@pms.hasPermission('canteen_canteenStock_add')" )
public R ansyncStock() {
// 获取所有SPU列表
List<CanteenSpuEntity> list = canteenSpuService.list();
// 提取所有SPU ID
List<Long> skuIds = list.stream()
.map(CanteenSpuEntity::getId)
.collect(Collectors.toList());
// 查询已存在的库存记录
LambdaQueryWrapper<CanteenStockEntity> wrapper = Wrappers.lambdaQuery();
wrapper.in(CanteenStockEntity::getItemId, skuIds);
List<CanteenStockEntity> existingStocks = canteenStockService.list(wrapper);
// 将已存在的itemId存入Set用于快速查找
Set<Long> existingItemIds = existingStocks.stream()
.map(CanteenStockEntity::getItemId)
.collect(Collectors.toSet());
// 过滤出需要新增的SPU
List<CanteenStockEntity> toSaveList = list.stream()
.filter(spu -> !existingItemIds.contains(spu.getId()))
.map(spu -> {
CanteenStockEntity entity = new CanteenStockEntity();
entity.setCurrentStock(0D);
entity.setBaseStock(0D);
entity.setItemType("2");
entity.setItemId(spu.getId());
entity.setDeptId(spu.getDeptId());
entity.setInventoryUpperLimit(0);
entity.setInventoryLowerLimit(0);
return entity;
}).collect(Collectors.toList());
// 批量保存新数据
if (CollUtil.isNotEmpty(toSaveList)) {
canteenStockService.saveBatch(toSaveList);
}
return R.ok();
}
// /**
// * 分页查询
// * @param page 分页对象
// * @return
// */
// @Operation(summary = "分页查询" , description = "分页查询" )
// @GetMapping("/dishStockPage" )
// @PreAuthorize("@pms.hasPermission('canteen_canteenErpMaterial_view')" )
// public R getDishStockPage(@ParameterObject Page page, @ParameterObject CanteenSpuEntity canteenSpuEntity) {
// return R.ok(canteenErpMaterialService.pageScope(page, canteenErpMaterial));
// }
}
@@ -0,0 +1,138 @@
package com.bsd.pjcloud.canteen.controller;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.canteen.vo.erp.CanteenSupplierSimpleVo;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.canteen.entity.CanteenSupplierEntity;
import com.bsd.pjcloud.canteen.service.CanteenSupplierService;
import com.bsd.pjcloud.common.security.util.SecurityUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 货商信息
*
* @author zjf
* @date 2025-05-09 13:18:19
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/canteenSupplier" )
@Tag(description = "canteenSupplier" , name = "货商信息管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class CanteenSupplierController {
private final CanteenSupplierService canteenSupplierService;
/**
* 分页查询
* @param page 分页对象
* @param canteenSupplier 货商信息
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('canteen_canteenSupplier_view')" )
public R getCanteenSupplierPage(@ParameterObject Page page, @ParameterObject CanteenSupplierEntity canteenSupplier) {
LambdaQueryWrapper<CanteenSupplierEntity> wrapper = Wrappers.lambdaQuery();
wrapper.like(StrUtil.isNotBlank(canteenSupplier.getSupplierName()),CanteenSupplierEntity::getSupplierName,canteenSupplier.getSupplierName());
wrapper.eq(StrUtil.isNotBlank(canteenSupplier.getPhone()),CanteenSupplierEntity::getPhone,canteenSupplier.getPhone());
return R.ok(canteenSupplierService.pageScope(page, wrapper));
}
/**
* 通过id查询货商信息
* @param supplierId id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{supplierId}" )
@PreAuthorize("@pms.hasPermission('canteen_canteenSupplier_view')" )
public R getById(@PathVariable("supplierId" ) Long supplierId) {
return R.ok(canteenSupplierService.getById(supplierId));
}
/**
* 新增货商信息
* @param canteenSupplier 货商信息
* @return R
*/
@Operation(summary = "新增货商信息" , description = "新增货商信息" )
@SysLog("新增货商信息" )
@PostMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenSupplier_add')" )
public R save(@RequestBody CanteenSupplierEntity canteenSupplier) {
canteenSupplier.setDeptId(SecurityUtils.getUser().getDeptId());
return R.ok(canteenSupplierService.save(canteenSupplier));
}
/**
* 修改货商信息
* @param canteenSupplier 货商信息
* @return R
*/
@Operation(summary = "修改货商信息" , description = "修改货商信息" )
@SysLog("修改货商信息" )
@PutMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenSupplier_edit')" )
public R updateById(@RequestBody CanteenSupplierEntity canteenSupplier) {
return R.ok(canteenSupplierService.updateById(canteenSupplier));
}
/**
* 通过id删除货商信息
* @param ids supplierId列表
* @return R
*/
@Operation(summary = "通过id删除货商信息" , description = "通过id删除货商信息" )
@SysLog("通过id删除货商信息" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('canteen_canteenSupplier_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(canteenSupplierService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param canteenSupplier 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('canteen_canteenSupplier_export')" )
public List<CanteenSupplierEntity> export(CanteenSupplierEntity canteenSupplier,Long[] ids) {
return canteenSupplierService.list(Wrappers.lambdaQuery(canteenSupplier).in(ArrayUtil.isNotEmpty(ids), CanteenSupplierEntity::getSupplierId, ids));
}
/**
* 货商下拉
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/selectSimpleAll" )
public R selectSimpleAll(@RequestParam(value = "name",required = false)String name,
@RequestParam(value = "supplierId",required = false)Long supplierId) {
List<CanteenSupplierEntity> list = canteenSupplierService.selectSimpleAllScope(name,supplierId);
List<CanteenSupplierSimpleVo> bean = BeanUtils.toBean(list, CanteenSupplierSimpleVo.class);
return R.ok(bean);
}
}
@@ -0,0 +1,119 @@
package com.bsd.pjcloud.canteen.controller;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.canteen.entity.ProductionRecordItemRelationEntity;
import com.bsd.pjcloud.canteen.service.ProductionRecordItemRelationService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 食材加工菜品关系表
*
* @author zjf
* @date 2025-05-14 12:47:16
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/productionRecordItemRelation" )
@Tag(description = "productionRecordItemRelation" , name = "食材加工菜品关系表管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class ProductionRecordItemRelationController {
private final ProductionRecordItemRelationService productionRecordItemRelationService;
/**
* 分页查询
* @param page 分页对象
* @param productionRecordItemRelation 食材加工菜品关系表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('canteen_productionRecordItemRelation_view')" )
public R getProductionRecordItemRelationPage(@ParameterObject Page page, @ParameterObject ProductionRecordItemRelationEntity productionRecordItemRelation) {
LambdaQueryWrapper<ProductionRecordItemRelationEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(productionRecordItemRelationService.page(page, wrapper));
}
/**
* 通过id查询食材加工菜品关系表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('canteen_productionRecordItemRelation_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(productionRecordItemRelationService.getById(id));
}
/**
* 新增食材加工菜品关系表
* @param productionRecordItemRelation 食材加工菜品关系表
* @return R
*/
@Operation(summary = "新增食材加工菜品关系表" , description = "新增食材加工菜品关系表" )
@SysLog("新增食材加工菜品关系表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('canteen_productionRecordItemRelation_add')" )
public R save(@RequestBody ProductionRecordItemRelationEntity productionRecordItemRelation) {
return R.ok(productionRecordItemRelationService.save(productionRecordItemRelation));
}
/**
* 修改食材加工菜品关系表
* @param productionRecordItemRelation 食材加工菜品关系表
* @return R
*/
@Operation(summary = "修改食材加工菜品关系表" , description = "修改食材加工菜品关系表" )
@SysLog("修改食材加工菜品关系表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('canteen_productionRecordItemRelation_edit')" )
public R updateById(@RequestBody ProductionRecordItemRelationEntity productionRecordItemRelation) {
return R.ok(productionRecordItemRelationService.updateById(productionRecordItemRelation));
}
/**
* 通过id删除食材加工菜品关系表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除食材加工菜品关系表" , description = "通过id删除食材加工菜品关系表" )
@SysLog("通过id删除食材加工菜品关系表" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('canteen_productionRecordItemRelation_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(productionRecordItemRelationService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param productionRecordItemRelation 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('canteen_productionRecordItemRelation_export')" )
public List<ProductionRecordItemRelationEntity> export(ProductionRecordItemRelationEntity productionRecordItemRelation,Long[] ids) {
return productionRecordItemRelationService.list(Wrappers.lambdaQuery(productionRecordItemRelation).in(ArrayUtil.isNotEmpty(ids), ProductionRecordItemRelationEntity::getId, ids));
}
}
@@ -0,0 +1,115 @@
package com.bsd.pjcloud.canteen.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
* 食材分类
*
* @author zjf
* @date 2025-05-28 11:12:41
*/
@Data
@TenantTable
@TableName("canteen_erp_category")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "食材分类")
public class CanteenErpCategoryEntity extends Model<CanteenErpCategoryEntity> {
/**
* 分类编号
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="分类编号")
private Long id;
/**
* 父分类编号
*/
@Schema(description="父分类编号")
private Long parentId;
/**
* 分类名称
*/
@Schema(description="分类名称")
private String name;
/**
* 分类图
*/
@Schema(description="分类图")
private String picUrl;
/**
* 分类排序
*/
@Schema(description="分类排序")
private Integer sort;
/**
* 开启状态
*/
@Schema(description="开启状态")
private String status;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* merchantId
*/
@Schema(description="merchantId")
private Long merchantId;
/**
* 创建者
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建者")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 更新者
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新者")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新时间")
private LocalDateTime updateTime;
/**
* 是否删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="是否删除")
private String delFlag;
/**
* 租户编号
*/
@Schema(description="租户编号")
private Long tenantId;
}
@@ -0,0 +1,82 @@
package com.bsd.pjcloud.canteen.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 食材加工菜品关系表
*
* @author zjf
* @date 2025-05-14 12:47:16
*/
@Data
@TableName("production_record_item_relation")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "食材加工菜品关系表")
public class ProductionRecordItemRelationEntity extends Model<ProductionRecordItemRelationEntity> {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="id")
private Long id;
/**
* 食材id
*/
@Schema(description="食材id")
private Long materialId;
/**
* 记录item表id
*/
@Schema(description="记录item表id")
private Long recordItemId;
/**
* 食材名称
*/
@Schema(description="食材名称")
private String materialName;
/**
* 食材单位
*/
@Schema(description="食材单位")
private String unit;
/**
* 计算用量
*/
@Schema(description="计算用量")
private Double calculatedUsage;
/**
* 折损率
*/
@Schema(description="折损率")
private Double lossRate;
/**
* 基础用量
*/
@Schema(description="基础用量")
private Double baseUsage;
/**
* 实际用量
*/
@Schema(description="实际用量")
private Double actualUsage;
/**
* 实际折损率
*/
@Schema(description="实际折损率")
private Double actualLossRate;
}
@@ -26,7 +26,7 @@ public class BoxesAvaliabilityJob {
private final BoxesAvailabilityMapper boxesAvailabilityMapper;
@XxlJob("avaliabilityJobHandler")
public void demoJobHandler() {
public void avaliabilityJobHandler() {
//查询所有包厢
List<BoxesInfoEntity> rooms = boxesInfoMapper.selectList(null);
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.canteen.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.canteen.entity.CanteenErpCategoryEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CanteenErpCategoryMapper extends PjcloudBaseMapper<CanteenErpCategoryEntity> {
}
@@ -0,0 +1,17 @@
package com.bsd.pjcloud.canteen.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.canteen.vo.erp.CanteenErpMaterialVO;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.canteen.entity.CanteenErpMaterialEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface CanteenErpMaterialMapper extends PjcloudBaseMapper<CanteenErpMaterialEntity> {
Page<CanteenErpMaterialVO> selectPageDataByScope(Page page, @Param("canteenErpMaterial") CanteenErpMaterialEntity canteenErpMaterial, DataScope of);
}
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.canteen.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsItemEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CanteenInventoryRecordsItemMapper extends PjcloudBaseMapper<CanteenInventoryRecordsItemEntity> {
}
@@ -0,0 +1,23 @@
package com.bsd.pjcloud.canteen.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.canteen.vo.erp.CanteenProductionRecordPageVO;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface CanteenInventoryRecordsMapper extends PjcloudBaseMapper<CanteenInventoryRecordsEntity> {
/**
* 分页查询
* @param page
* @param canteenInventoryRecords
* @param of
* @return
*/
Page<CanteenProductionRecordPageVO> selectPageDataByScope(Page page, @Param("canteenInventoryRecords") CanteenInventoryRecordsEntity canteenInventoryRecords, DataScope of);
}
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.canteen.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.canteen.entity.CanteenProductionRecordItemEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CanteenProductionRecordItemMapper extends PjcloudBaseMapper<CanteenProductionRecordItemEntity> {
}
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.canteen.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.canteen.entity.CanteenProductionRecordEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CanteenProductionRecordMapper extends PjcloudBaseMapper<CanteenProductionRecordEntity> {
}
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.canteen.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.canteen.entity.CanteenProductionTemplateDetailEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CanteenProductionTemplateDetailMapper extends PjcloudBaseMapper<CanteenProductionTemplateDetailEntity> {
}
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.canteen.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.canteen.entity.CanteenProductionTemplateEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CanteenProductionTemplateMapper extends PjcloudBaseMapper<CanteenProductionTemplateEntity> {
}
@@ -0,0 +1,14 @@
package com.bsd.pjcloud.canteen.mapper;
import com.bsd.pjcloud.canteen.dto.erp.UpdateStockDTO;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.canteen.entity.CanteenStockEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface CanteenStockMapper extends PjcloudBaseMapper<CanteenStockEntity> {
}
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.canteen.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.canteen.entity.CanteenSupplierEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CanteenSupplierMapper extends PjcloudBaseMapper<CanteenSupplierEntity> {
}
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.canteen.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.canteen.entity.ProductionRecordItemRelationEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ProductionRecordItemRelationMapper extends PjcloudBaseMapper<ProductionRecordItemRelationEntity> {
}
@@ -0,0 +1,29 @@
package com.bsd.pjcloud.canteen.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
import com.bsd.pjcloud.canteen.entity.CanteenErpCategoryEntity;
import java.util.List;
public interface CanteenErpCategoryService extends IService<CanteenErpCategoryEntity> {
/**
* 分页查询
* @param page
* @param wrapper
* @return
*/
Object pageScope(Page page, LambdaQueryWrapper<CanteenErpCategoryEntity> wrapper);
/**
* 查询下拉分类
* @param categoryId
* @return
*/
List<CanteenErpCategoryEntity> listScope(Long categoryId);
}
@@ -0,0 +1,46 @@
package com.bsd.pjcloud.canteen.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.canteen.dto.erp.CanteenErpMaterialEditorDTO;
import com.bsd.pjcloud.canteen.dto.erp.CanteenErpMaterialSaveDTO;
import com.bsd.pjcloud.canteen.entity.CanteenErpMaterialEntity;
import com.bsd.pjcloud.canteen.vo.erp.CanteenErpMaterialVO;
public interface CanteenErpMaterialService extends IService<CanteenErpMaterialEntity> {
/**
* 保存
* @param canteenErpMaterialSaveDTO
* @return
*/
Object saveCanteenErpMaterialDTO(CanteenErpMaterialSaveDTO canteenErpMaterialSaveDTO);
/**
* 修改
* @param canteenErpMaterialEditorDTO
* @return
*/
Object updateById(CanteenErpMaterialEditorDTO canteenErpMaterialEditorDTO);
/**
* 分页查询
* @param page
* @return
*/
Page<CanteenErpMaterialVO> pageScope(Page page, CanteenErpMaterialEntity canteenErpMaterial);
CanteenErpMaterialVO getCanteenErpMaterialVOById(Long id);
/**
* erp选择分页
* @param page
* @param name
* @return
*/
Object getErpMaterialPage(Page page, String name);
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.canteen.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsItemEntity;
public interface CanteenInventoryRecordsItemService extends IService<CanteenInventoryRecordsItemEntity> {
}
@@ -0,0 +1,47 @@
package com.bsd.pjcloud.canteen.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.canteen.dto.erp.CanteenInventoryRecordEditDTO;
import com.bsd.pjcloud.canteen.dto.erp.CanteenInventoryRecordsdDTO;
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsEntity;
import com.bsd.pjcloud.canteen.vo.erp.CanteenProductionRecordPageVO;
import java.util.ArrayList;
import java.util.List;
public interface CanteenInventoryRecordsService extends IService<CanteenInventoryRecordsEntity> {
/**
* 新增
* @param canteenInventoryRecordsdDTO
* @return
*/
Object saveCanteenInventoryRecordsdDTO(CanteenInventoryRecordsdDTO canteenInventoryRecordsdDTO);
/**
* 分页
* @param page
* @param canteenInventoryRecords
* @return
*/
Page<CanteenProductionRecordPageVO> pageScope(Page page, CanteenInventoryRecordsEntity canteenInventoryRecords);
/**
* 修改
* @param canteenInventoryRecordEditDTO
* @return
*/
Object updateByCanteenInventoryRecordEditDTO(CanteenInventoryRecordEditDTO canteenInventoryRecordEditDTO);
Object getInventoryDetailById(Long id);
Object removeBatch(List<Long> list);
void ys(Long id);
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.canteen.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.canteen.entity.CanteenProductionRecordItemEntity;
public interface CanteenProductionRecordItemService extends IService<CanteenProductionRecordItemEntity> {
}
@@ -0,0 +1,27 @@
package com.bsd.pjcloud.canteen.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.canteen.dto.erp.CanteenProductRecordSaveDTO;
import com.bsd.pjcloud.canteen.entity.CanteenProductionRecordEntity;
public interface CanteenProductionRecordService extends IService<CanteenProductionRecordEntity> {
/**
* 分页
* @param page
* @param wrapper
* @return
*/
Object pageScope(Page page, LambdaQueryWrapper<CanteenProductionRecordEntity> wrapper);
/**
* 保存
* @param canteenProductRecordSaveDTO
* @return
*/
Object saveCanteenProductRecordSaveDTO(CanteenProductRecordSaveDTO canteenProductRecordSaveDTO);
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.canteen.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.canteen.entity.CanteenProductionTemplateDetailEntity;
public interface CanteenProductionTemplateDetailService extends IService<CanteenProductionTemplateDetailEntity> {
}
@@ -0,0 +1,40 @@
package com.bsd.pjcloud.canteen.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.canteen.vo.erp.ProductTemplateVO;
import com.github.yulichang.extension.mapping.base.MPJDeepService;
import com.bsd.pjcloud.canteen.entity.CanteenProductionTemplateDetailEntity;
import com.bsd.pjcloud.canteen.entity.CanteenProductionTemplateEntity;
public interface CanteenProductionTemplateService extends MPJDeepService<CanteenProductionTemplateEntity> {
Boolean saveDeep(CanteenProductionTemplateEntity canteenProductionTemplate);
Boolean updateDeep(CanteenProductionTemplateEntity canteenProductionTemplate);
Boolean removeDeep(Long[] ids);
Boolean removeChild(Long[] ids);
ProductTemplateVO getDetailById(Long id);
/**
* 分页
* @param page
* @param wrapper
* @return
*/
Object pageScope(Page page, LambdaQueryWrapper<CanteenProductionTemplateEntity> wrapper);
/**
* 获取模版分页选择下拉
* @param page
* @param name
* @return
*/
Object getSelectTemplatePageScope(Page page, String name);
}
@@ -6,8 +6,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.canteen.dto.CanteenDailySpuDTO;
import com.bsd.pjcloud.canteen.dto.CanteenSpuUpdateStockReqDTO;
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
import com.bsd.pjcloud.canteen.vo.erp.CanteenSpuSimpleVO;
import com.bsd.pjcloud.canteen.vo.erp.CanteenSpuStockVO;
import com.bsd.pjcloud.common.core.util.R;
import java.util.List;
public interface CanteenSpuService extends IService<CanteenSpuEntity> {
@@ -51,4 +55,17 @@ public interface CanteenSpuService extends IService<CanteenSpuEntity> {
* @return
*/
Object pageDailyScope(Page page, CanteenDailySpuDTO canteenDailySpuDTO);
Page<CanteenSpuSimpleVO> getCanteenSpuSimplePageScope(Page page, CanteenSpuEntity canteenSpu);
/**
* erp分页查询
* @param page
* @param canteenSpu 查询参数
* @return 分页菜品库存VO
*/
Page<CanteenSpuStockVO> erpPageScope(Page page, CanteenSpuEntity canteenSpu);
}
@@ -0,0 +1,13 @@
package com.bsd.pjcloud.canteen.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.canteen.dto.erp.UpdateStockDTO;
import com.bsd.pjcloud.canteen.entity.CanteenStockEntity;
import java.util.List;
public interface CanteenStockService extends IService<CanteenStockEntity> {
void updateStock(List<UpdateStockDTO> updateStockDTOS);
}
@@ -0,0 +1,29 @@
package com.bsd.pjcloud.canteen.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.canteen.entity.CanteenSupplierEntity;
import java.util.List;
public interface CanteenSupplierService extends IService<CanteenSupplierEntity> {
/**
* 数据权限分页查询
* @param page
* @param wrapper
* @return
*/
Object pageScope(Page page, LambdaQueryWrapper<CanteenSupplierEntity> wrapper);
/**
* 货商下拉
* @param name
* @param supplierId
* @return
*/
List<CanteenSupplierEntity> selectSimpleAllScope(String name, Long supplierId);
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.canteen.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.canteen.entity.ProductionRecordItemRelationEntity;
public interface ProductionRecordItemRelationService extends IService<ProductionRecordItemRelationEntity> {
}
@@ -128,6 +128,9 @@ public class BoxesBookingServiceImpl extends ServiceImpl<BoxesBookingMapper, Box
}
Page pageData = baseMapper.selectPageByScope(page, wrapper, DataScope.of());
List<BoxesBookingEntity> records = pageData.getRecords();
if (CollectionUtils.isEmpty(records)){
return pageData;
}
Set<Long> boxesIds = records.stream().map(boxesBookingEntity -> boxesBookingEntity.getBoxesId()).collect(Collectors.toSet());
Set<Long> usersIds = records.stream().map(boxesBookingEntity -> boxesBookingEntity.getUserId()).collect(Collectors.toSet());
@@ -0,0 +1,36 @@
package com.bsd.pjcloud.canteen.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
import com.bsd.pjcloud.canteen.entity.CanteenErpCategoryEntity;
import com.bsd.pjcloud.canteen.mapper.CanteenErpCategoryMapper;
import com.bsd.pjcloud.canteen.service.CanteenErpCategoryService;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 食材分类
*
* @author zjf
* @date 2025-05-28 11:12:41
*/
@Service
public class CanteenErpCategoryServiceImpl extends ServiceImpl<CanteenErpCategoryMapper, CanteenErpCategoryEntity> implements CanteenErpCategoryService {
@Override
public Object pageScope(Page page, LambdaQueryWrapper<CanteenErpCategoryEntity> wrapper) {
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
}
@Override
public List<CanteenErpCategoryEntity> listScope(Long categoryId) {
LambdaQueryWrapper<CanteenErpCategoryEntity> wrapper = new LambdaQueryWrapper<>();
if (categoryId != null) {
wrapper.eq(CanteenErpCategoryEntity::getId, categoryId);
}
return baseMapper.selectListByScope(wrapper, DataScope.of());
}
}
@@ -0,0 +1,149 @@
package com.bsd.pjcloud.canteen.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.canteen.dto.erp.CanteenErpMaterialEditorDTO;
import com.bsd.pjcloud.canteen.dto.erp.CanteenErpMaterialSaveDTO;
import com.bsd.pjcloud.canteen.entity.CanteenErpMaterialEntity;
import com.bsd.pjcloud.canteen.entity.CanteenStockEntity;
import com.bsd.pjcloud.canteen.mapper.CanteenErpMaterialMapper;
import com.bsd.pjcloud.canteen.mapper.CanteenStockMapper;
import com.bsd.pjcloud.canteen.service.CanteenErpMaterialService;
import com.bsd.pjcloud.canteen.vo.erp.CanteenErpMaterialVO;
import com.bsd.pjcloud.canteen.vo.erp.ErpMaterialPageVo;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.security.util.SecurityUtils;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 原料表
*
* @author zjf
* @date 2025-05-07 13:16:32
*/
@Service
@AllArgsConstructor
public class CanteenErpMaterialServiceImpl extends ServiceImpl<CanteenErpMaterialMapper, CanteenErpMaterialEntity> implements CanteenErpMaterialService {
private final CanteenStockMapper canteenStockMapper;
@Override
@Transactional
public Object saveCanteenErpMaterialDTO(CanteenErpMaterialSaveDTO canteenErpMaterialSaveDTO) {
Long deptId = SecurityUtils.getUser().getDeptId();
CanteenErpMaterialEntity canteenErpMaterialEntity = new CanteenErpMaterialEntity();
canteenErpMaterialEntity.setName(canteenErpMaterialSaveDTO.getName());
canteenErpMaterialEntity.setUnit(canteenErpMaterialSaveDTO.getUnit());
canteenErpMaterialEntity.setDeptId(deptId);
canteenErpMaterialEntity.setPurchasePrice(canteenErpMaterialSaveDTO.getPurchasePrice());
canteenErpMaterialEntity.setCategoryId(canteenErpMaterialSaveDTO.getCategoryId());
int insert = baseMapper.insert(canteenErpMaterialEntity);
CanteenStockEntity canteenStockEntity = new CanteenStockEntity();
canteenStockEntity.setItemType("1");
canteenStockEntity.setItemId(canteenErpMaterialEntity.getId());
canteenStockEntity.setBaseStock(canteenErpMaterialSaveDTO.getBaseStock());
canteenStockEntity.setCurrentStock(canteenErpMaterialSaveDTO.getBaseStock());
canteenStockEntity.setInventoryUpperLimit(canteenErpMaterialSaveDTO.getInventoryUpperLimit());
canteenStockEntity.setInventoryLowerLimit(canteenErpMaterialSaveDTO.getInventoryLowerLimit());
canteenStockMapper.insert(canteenStockEntity);
return insert;
}
@Override
@Transactional
public Object updateById(CanteenErpMaterialEditorDTO canteenErpMaterialEditorDTO) {
Long id = canteenErpMaterialEditorDTO.getId();
CanteenErpMaterialEntity canteenErpMaterialEntity = new CanteenErpMaterialEntity();
canteenErpMaterialEntity.setId(id);
canteenErpMaterialEntity.setName(canteenErpMaterialEditorDTO.getName());
canteenErpMaterialEntity.setUnit(canteenErpMaterialEditorDTO.getUnit());
canteenErpMaterialEntity.setPurchasePrice(canteenErpMaterialEditorDTO.getPurchasePrice());
canteenErpMaterialEntity.setCategoryId(canteenErpMaterialEditorDTO.getCategoryId());
LambdaQueryWrapper<CanteenStockEntity> canteenStockEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
canteenStockEntityLambdaQueryWrapper.eq(CanteenStockEntity::getItemId, id);
CanteenStockEntity sourceCanteenStockEntity = canteenStockMapper.selectOne(canteenStockEntityLambdaQueryWrapper);
CanteenStockEntity canteenStockEntity = new CanteenStockEntity();
canteenStockEntity.setItemId(canteenErpMaterialEntity.getId());
canteenStockEntity.setBaseStock(canteenErpMaterialEditorDTO.getBaseStock());
canteenStockEntity.setCurrentStock(canteenErpMaterialEditorDTO.getBaseStock()+(sourceCanteenStockEntity.getCurrentStock()-sourceCanteenStockEntity.getBaseStock()));
canteenStockEntity.setInventoryUpperLimit(canteenErpMaterialEditorDTO.getInventoryUpperLimit());
canteenStockEntity.setInventoryLowerLimit(canteenErpMaterialEditorDTO.getInventoryLowerLimit());
int i = baseMapper.updateById(canteenErpMaterialEntity);
canteenStockMapper.update(canteenStockEntity,
new LambdaQueryWrapper<CanteenStockEntity>().eq(CanteenStockEntity::getItemId, id));
return i;
}
@Override
public Page<CanteenErpMaterialVO> pageScope(Page page, CanteenErpMaterialEntity canteenErpMaterial) {
return baseMapper.selectPageDataByScope(page, canteenErpMaterial, DataScope.of());
}
@Override
public CanteenErpMaterialVO getCanteenErpMaterialVOById(Long id) {
CanteenErpMaterialEntity canteenErpMaterialEntity = baseMapper.selectById(id);
LambdaQueryWrapper<CanteenStockEntity> canteenStockEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
canteenStockEntityLambdaQueryWrapper.eq(CanteenStockEntity::getItemId, id);
CanteenStockEntity sourceCanteenStockEntity = canteenStockMapper.selectOne(canteenStockEntityLambdaQueryWrapper);
CanteenErpMaterialVO canteenErpMaterialVO = new CanteenErpMaterialVO();
canteenErpMaterialVO.setId(canteenErpMaterialEntity.getId());
canteenErpMaterialVO.setName(canteenErpMaterialEntity.getName());
canteenErpMaterialVO.setUnit(canteenErpMaterialEntity.getUnit());
canteenErpMaterialVO.setBaseStock(sourceCanteenStockEntity.getBaseStock());
canteenErpMaterialVO.setInventoryUpperLimit(sourceCanteenStockEntity.getInventoryUpperLimit());
canteenErpMaterialVO.setInventoryLowerLimit(sourceCanteenStockEntity.getInventoryLowerLimit());
canteenErpMaterialVO.setCurrentStock(sourceCanteenStockEntity.getCurrentStock());
canteenErpMaterialVO.setPurchasePrice(canteenErpMaterialEntity.getPurchasePrice());
canteenErpMaterialVO.setCategoryId(canteenErpMaterialEntity.getCategoryId());
return canteenErpMaterialVO;
}
@Override
public Page<ErpMaterialPageVo> getErpMaterialPage(Page page, String name) {
LambdaQueryWrapper<CanteenErpMaterialEntity> smErpUnitEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
smErpUnitEntityLambdaQueryWrapper.like(StringUtils.isNotBlank(name), CanteenErpMaterialEntity::getName, name);
Page<CanteenErpMaterialEntity> spuPage = baseMapper.selectPageByScope(page, smErpUnitEntityLambdaQueryWrapper, DataScope.of());
// 将 SmErpSpuEntity 转换为 SmErpPageScopeVo
List<ErpMaterialPageVo> voList = spuPage.getRecords().stream()
.map(entity -> BeanUtils.toBean(entity, ErpMaterialPageVo.class))
.collect(Collectors.toList());
List<Long> materialIds = voList.stream().map(vo -> vo.getId()).collect(Collectors.toList());
// 批量查询库存信息
List<CanteenStockEntity> stocks = canteenStockMapper.selectList(
new LambdaQueryWrapper<CanteenStockEntity>()
.in(CanteenStockEntity::getItemId, materialIds));
// 建立SPU ID与库存的映射关系
Map<Long,CanteenStockEntity> stockMap = stocks.stream()
.collect(Collectors.toMap(CanteenStockEntity::getItemId, smErpStockEntity -> smErpStockEntity));
voList.stream().forEach(vo -> {
//库存
CanteenStockEntity smErpStockEntity = stockMap.get(vo.getId());
vo.setStock(smErpStockEntity != null ? smErpStockEntity.getCurrentStock() : 0);
});
// 创建新的 Page 对象并设置数据
Page<ErpMaterialPageVo> resultPage = new Page<>();
org.springframework.beans.BeanUtils.copyProperties(spuPage, resultPage);
resultPage.setRecords(voList);
return resultPage;
}
}
@@ -0,0 +1,16 @@
package com.bsd.pjcloud.canteen.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsItemEntity;
import com.bsd.pjcloud.canteen.mapper.CanteenInventoryRecordsItemMapper;
import com.bsd.pjcloud.canteen.service.CanteenInventoryRecordsItemService;
import org.springframework.stereotype.Service;
/**
* 采购记录明细表
*
* @author zjf
* @date 2025-05-07 17:02:53
*/
@Service
public class CanteenInventoryRecordsItemServiceImpl extends ServiceImpl<CanteenInventoryRecordsItemMapper, CanteenInventoryRecordsItemEntity> implements CanteenInventoryRecordsItemService {
}
@@ -0,0 +1,287 @@
package com.bsd.pjcloud.canteen.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.canteen.constant.OrderTypeEnum;
import com.bsd.pjcloud.canteen.dto.erp.*;
import com.bsd.pjcloud.canteen.entity.CanteenErpMaterialEntity;
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsEntity;
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsItemEntity;
import com.bsd.pjcloud.canteen.entity.CanteenProductionRecordEntity;
import com.bsd.pjcloud.canteen.mapper.*;
import com.bsd.pjcloud.canteen.service.CanteenInventoryRecordsService;
import com.bsd.pjcloud.canteen.service.CanteenStockService;
import com.bsd.pjcloud.canteen.vo.erp.CanteenProductionRecordPageVO;
import com.bsd.pjcloud.canteen.vo.erp.InventoryRecordItemVo;
import com.bsd.pjcloud.canteen.vo.erp.InventoryRecordVo;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.security.util.SecurityUtils;
import com.bsd.pjcloud.flow.task.constant.TaskCheckStatusEnum;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 采购记录表
*
* @author zjf
* @date 2025-05-07 17:00:50
*/
@Service
@AllArgsConstructor
public class CanteenInventoryRecordsServiceImpl extends ServiceImpl<CanteenInventoryRecordsMapper, CanteenInventoryRecordsEntity> implements CanteenInventoryRecordsService {
private final CanteenInventoryRecordsItemMapper canteenInventoryRecordsItemMapper;
private final CanteenStockMapper canteenStockMapper;
private final CanteenStockService canteenStockService;
private final CanteenErpMaterialMapper canteenErpMaterialMapper;
@Override
@Transactional
public Object saveCanteenInventoryRecordsdDTO(CanteenInventoryRecordsdDTO canteenInventoryRecordsdDTO) {
Long deptId = SecurityUtils.getUser().getDeptId();
CanteenInventoryRecordsEntity canteenInventoryRecordsEntity= BeanUtils.toBean(canteenInventoryRecordsdDTO, CanteenInventoryRecordsEntity.class);
canteenInventoryRecordsEntity.setDeptId(deptId);
canteenInventoryRecordsEntity.setCheckStatus(TaskCheckStatusEnum.PADDING.getCode());
// canteenInventoryRecordsEntity.setCheckStatus(TaskCheckStatusEnum.RESULT.getCode());
baseMapper.insert(canteenInventoryRecordsEntity);
Long id = canteenInventoryRecordsEntity.getId();
List<CanteenInventoryRecordsItemDTO> canteenInventoryRecordsItemDTOS = canteenInventoryRecordsdDTO.getItems();
List<CanteenInventoryRecordsItemEntity> canteenInventoryRecordsItemEntityList = BeanUtils.toBean(canteenInventoryRecordsItemDTOS, CanteenInventoryRecordsItemEntity.class);
// List<UpdateStockDTO> updateStockDTOS = new ArrayList<>();
for (CanteenInventoryRecordsItemEntity canteenInventoryRecordsItemEntity : canteenInventoryRecordsItemEntityList){
canteenInventoryRecordsItemEntity.setInventoryId(id);
canteenInventoryRecordsItemEntity.setDeptId(deptId);
String orderType = canteenInventoryRecordsEntity.getOrderType();
canteenInventoryRecordsItemEntity.setOrderType(orderType);
// UpdateStockDTO updateStockDTO = new UpdateStockDTO();
// updateStockDTO.setId(canteenInventoryRecordsItemEntity.getErpMaterialId());
Double quantity = canteenInventoryRecordsItemEntity.getQuantity();
// if (orderType.equals(OrderTypeEnum.RK.getType())){
// updateStockDTO.setIncrCount(quantity);
// }else if (orderType.equals(OrderTypeEnum.CK.getType())){
// updateStockDTO.setIncrCount(-quantity);
// }else if (orderType.equals(OrderTypeEnum.No.getType())){
//无需更新库存
// }else {
// throw new RuntimeException("订单类型错误");
// }
// updateStockDTOS.add(updateStockDTO);
}
canteenInventoryRecordsItemMapper.insert(canteenInventoryRecordsItemEntityList);
// if (!CollectionUtils.isEmpty(updateStockDTOS)){
// canteenStockService.updateStock(updateStockDTOS);
// }
return id;
}
@Override
public Page<CanteenProductionRecordPageVO> pageScope(Page page, CanteenInventoryRecordsEntity canteenInventoryRecords) {
return baseMapper.selectPageDataByScope(page,canteenInventoryRecords, DataScope.of());
}
@Override
public Object updateByCanteenInventoryRecordEditDTO(CanteenInventoryRecordEditDTO canteenInventoryRecordEditDTO) {
CanteenInventoryRecordsEntity smErpInventoryRecordsEntity = BeanUtils.toBean(canteenInventoryRecordEditDTO, CanteenInventoryRecordsEntity.class);
int i = baseMapper.updateById(smErpInventoryRecordsEntity);
List<CanteenInventoryRecordEditItemDTO> items = canteenInventoryRecordEditDTO.getItems();
List<UpdateStockDTO> updateStockDTOS = new ArrayList<>();
List<CanteenInventoryRecordsItemEntity> CanteenInventoryRecordsItemEntityList = new ArrayList<>();
for (CanteenInventoryRecordEditItemDTO item : items){
CanteenInventoryRecordsItemEntity CanteenInventoryRecordsItemEntity = new CanteenInventoryRecordsItemEntity();
org.springframework.beans.BeanUtils.copyProperties(item,CanteenInventoryRecordsItemEntity);
//库存更新对象
UpdateStockDTO updateStockDTO = new UpdateStockDTO();
updateStockDTO.setId(item.getErpMaterialId());
Double quantity = item.getQuantity();
String orderType = smErpInventoryRecordsEntity.getOrderType();
CanteenInventoryRecordsItemEntity.setOrderType(orderType);
if (orderType.equals(OrderTypeEnum.RK.getType())){
updateStockDTO.setIncrCount(quantity);
}else if (orderType.equals(OrderTypeEnum.CK.getType())){
updateStockDTO.setIncrCount(-quantity);
}else {
throw new RuntimeException("订单类型错误");
}
CanteenInventoryRecordsItemEntityList.add(CanteenInventoryRecordsItemEntity);
updateStockDTOS.add(updateStockDTO);
}
List<CanteenInventoryRecordsItemEntity> insertItems = CanteenInventoryRecordsItemEntityList.stream().
filter(CanteenInventoryRecordsItemEntity -> CanteenInventoryRecordsItemEntity.getId() == null).collect(Collectors.toList());
insertItems.forEach(item -> {item.setInventoryId(smErpInventoryRecordsEntity.getId());});
List<CanteenInventoryRecordsItemEntity> updateItems = CanteenInventoryRecordsItemEntityList.stream().
filter(CanteenInventoryRecordsItemEntity -> CanteenInventoryRecordsItemEntity.getId() != null).collect(Collectors.toList());
//更新的话,查询之前保存了哪些item,然后去库存表删掉从新计算库存
List<CanteenInventoryRecordsItemEntity> dataBaseCanteenInventoryRecordsItemEntityList = canteenInventoryRecordsItemMapper
.selectList(new LambdaQueryWrapper<CanteenInventoryRecordsItemEntity>().eq(CanteenInventoryRecordsItemEntity::getInventoryId, canteenInventoryRecordEditDTO.getId()));
//这部分是数据库原本添加的库存数据,需要全部减掉,重新添加更新的库存数据进去
dataBaseCanteenInventoryRecordsItemEntityList.forEach(item -> {
UpdateStockDTO updateStockDTO = new UpdateStockDTO();
updateStockDTO.setId(item.getErpMaterialId());
updateStockDTO.setIncrCount(-item.getQuantity());
updateStockDTOS.add(updateStockDTO);
});
List<Long> existingCodeIds = canteenInventoryRecordsItemMapper.selectList(
new LambdaQueryWrapper<CanteenInventoryRecordsItemEntity>()
.eq(CanteenInventoryRecordsItemEntity::getInventoryId, smErpInventoryRecordsEntity.getId())
).stream().map(CanteenInventoryRecordsItemEntity::getId).collect(Collectors.toList());
// 收集本次提交的ID(排除新增的)
List<Long> submittedCodeIds = updateItems.stream()
.map(CanteenInventoryRecordsItemEntity::getId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
// 计算需要删除的ID
List<Long> toDeleteCodeIds = existingCodeIds.stream()
.filter(id -> !submittedCodeIds.contains(id))
.collect(Collectors.toList());
canteenInventoryRecordsItemMapper.updateById(updateItems);
canteenInventoryRecordsItemMapper.insert(insertItems);
// 批量删除失效
if (!toDeleteCodeIds.isEmpty()) {
canteenInventoryRecordsItemMapper.deleteByIds(toDeleteCodeIds);
}
//更新库存
if (!CollectionUtils.isEmpty(updateStockDTOS)){
canteenStockService.updateStock(updateStockDTOS);
}
return i;
}
@Override
public Object getInventoryDetailById(Long id) {
CanteenInventoryRecordsEntity smErpInventoryRecordsEntity = this.getById(id);
List<CanteenInventoryRecordsItemEntity> list =canteenInventoryRecordsItemMapper.selectList(new LambdaQueryWrapper<CanteenInventoryRecordsItemEntity>()
.eq(CanteenInventoryRecordsItemEntity::getInventoryId, id));
InventoryRecordVo bean = BeanUtils.toBean(smErpInventoryRecordsEntity, InventoryRecordVo.class, (source) -> {
List<InventoryRecordItemVo> smeErpCgPlanItemVos = BeanUtils.toBean(list, InventoryRecordItemVo.class);
smeErpCgPlanItemVos.stream().forEach(item -> {
CanteenErpMaterialEntity canteenErpMaterialEntity = canteenErpMaterialMapper.selectById(item.getErpMaterialId());
item.setName(canteenErpMaterialEntity.getName());
});
source.setItems(smeErpCgPlanItemVos);
});
return bean;
}
@Override
public Object removeBatch(List<Long> list) {
//首先先查询是否有当前数据权限
LambdaQueryWrapper<CanteenInventoryRecordsEntity> eq = new LambdaQueryWrapper<CanteenInventoryRecordsEntity>()
.in(CanteenInventoryRecordsEntity::getId, list);
List<CanteenInventoryRecordsEntity> smErpCgDdEntities = baseMapper.selectListByScope(eq,DataScope.of());
List<Long> delIds= smErpCgDdEntities.stream().map(smErpCgDdEntity -> smErpCgDdEntity.getId()).collect(Collectors.toList());
LambdaQueryWrapper<CanteenInventoryRecordsItemEntity> itemEntityLambdaQueryWrapper = new LambdaQueryWrapper<CanteenInventoryRecordsItemEntity>()
.in(CanteenInventoryRecordsItemEntity::getInventoryId, delIds);
//要删除的item
List<CanteenInventoryRecordsItemEntity> items = canteenInventoryRecordsItemMapper.selectList(itemEntityLambdaQueryWrapper);
canteenInventoryRecordsItemMapper.delete(itemEntityLambdaQueryWrapper);
baseMapper.deleteByIds(delIds);
List<Long> toDeleteIds = delIds.stream()
.filter(id -> !list.contains(id))
.collect(Collectors.toList());
if (!CollectionUtils.isEmpty(toDeleteIds)){
return R.failed("越权删除!");
}
//删除之前入库的库存
List<UpdateStockDTO> updateStockDTOS = new ArrayList<>();
for (CanteenInventoryRecordsItemEntity item : items){
//库存更新对象
UpdateStockDTO updateStockDTO = new UpdateStockDTO();
updateStockDTO.setId(item.getErpMaterialId());
Double quantity = item.getQuantity();
String orderType = item.getOrderType();
//入库的删除就是减去入的库存,所以是负数
if (orderType.equals(OrderTypeEnum.RK.getType())){
updateStockDTO.setIncrCount(-quantity);
}else if (orderType.equals(OrderTypeEnum.CK.getType())){
updateStockDTO.setIncrCount(quantity);
}else {
throw new RuntimeException("订单类型错误");
}
updateStockDTOS.add(updateStockDTO);
}
canteenStockService.updateStock(updateStockDTOS);
return R.ok();
}
/**
* 采购验收
* @param id
* @return
*/
@Override
public void ys(Long id) {
CanteenInventoryRecordsEntity canteenInventoryRecordsEntity = baseMapper.selectById(id);
LambdaQueryWrapper<CanteenInventoryRecordsItemEntity> canteenInventoryRecordsItemEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
canteenInventoryRecordsItemEntityLambdaQueryWrapper.eq(CanteenInventoryRecordsItemEntity::getInventoryId, id);
List<CanteenInventoryRecordsItemEntity> canteenInventoryRecordsItemEntityList = canteenInventoryRecordsItemMapper.selectList(canteenInventoryRecordsItemEntityLambdaQueryWrapper);
List<UpdateStockDTO> updateStockDTOS = new ArrayList<>();
for (CanteenInventoryRecordsItemEntity canteenInventoryRecordsItemEntity : canteenInventoryRecordsItemEntityList){
String orderType = canteenInventoryRecordsEntity.getOrderType();
canteenInventoryRecordsItemEntity.setOrderType(orderType);
UpdateStockDTO updateStockDTO = new UpdateStockDTO();
updateStockDTO.setId(canteenInventoryRecordsItemEntity.getErpMaterialId());
Double quantity = canteenInventoryRecordsItemEntity.getQuantity();
if (orderType.equals(OrderTypeEnum.RK.getType())){
updateStockDTO.setIncrCount(quantity);
}else if (orderType.equals(OrderTypeEnum.CK.getType())){
updateStockDTO.setIncrCount(-quantity);
}else if (orderType.equals(OrderTypeEnum.No.getType())){
//无需更新库存
}else {
throw new RuntimeException("订单类型错误");
}
updateStockDTOS.add(updateStockDTO);
}
if (!CollectionUtils.isEmpty(updateStockDTOS)){
canteenStockService.updateStock(updateStockDTOS);
CanteenInventoryRecordsEntity updateCanteenInventoryRecordsEntity = new CanteenInventoryRecordsEntity();
updateCanteenInventoryRecordsEntity.setCheckStatus(TaskCheckStatusEnum.RESULT.getCode());
updateCanteenInventoryRecordsEntity.setId(id);
updateCanteenInventoryRecordsEntity.setCheckTime(LocalDateTime.now());
updateCanteenInventoryRecordsEntity.setCheckUserId(SecurityUtils.getUser().getId());
baseMapper.updateById(canteenInventoryRecordsEntity);
}
}
}
@@ -0,0 +1,16 @@
package com.bsd.pjcloud.canteen.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.canteen.entity.CanteenProductionRecordItemEntity;
import com.bsd.pjcloud.canteen.mapper.CanteenProductionRecordItemMapper;
import com.bsd.pjcloud.canteen.service.CanteenProductionRecordItemService;
import org.springframework.stereotype.Service;
/**
* 食材加工记录明细表
*
* @author zjf
* @date 2025-05-08 11:05:02
*/
@Service
public class CanteenProductionRecordItemServiceImpl extends ServiceImpl<CanteenProductionRecordItemMapper, CanteenProductionRecordItemEntity> implements CanteenProductionRecordItemService {
}
@@ -0,0 +1,87 @@
package com.bsd.pjcloud.canteen.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.canteen.dto.erp.CanteenProductRecordSaveDTO;
import com.bsd.pjcloud.canteen.dto.erp.UpdateStockDTO;
import com.bsd.pjcloud.canteen.entity.CanteenProductionRecordEntity;
import com.bsd.pjcloud.canteen.entity.CanteenProductionRecordItemEntity;
import com.bsd.pjcloud.canteen.entity.ProductionRecordItemRelationEntity;
import com.bsd.pjcloud.canteen.mapper.CanteenProductionRecordItemMapper;
import com.bsd.pjcloud.canteen.mapper.CanteenProductionRecordMapper;
import com.bsd.pjcloud.canteen.mapper.ProductionRecordItemRelationMapper;
import com.bsd.pjcloud.canteen.service.CanteenProductionRecordService;
import com.bsd.pjcloud.canteen.service.CanteenStockService;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.security.util.SecurityUtils;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* 食材加工记录表
*
* @author zjf
* @date 2025-05-08 11:02:09
*/
@Service
@AllArgsConstructor
public class CanteenProductionRecordServiceImpl extends ServiceImpl<CanteenProductionRecordMapper, CanteenProductionRecordEntity> implements CanteenProductionRecordService {
private final CanteenProductionRecordItemMapper canteenProductionRecordItemMapper;
private final ProductionRecordItemRelationMapper productionRecordItemRelationMapper;
private final CanteenStockService canteenStockService;
@Override
public Object pageScope(Page page, LambdaQueryWrapper<CanteenProductionRecordEntity> wrapper) {
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
}
@Override
@Transactional
public Object saveCanteenProductRecordSaveDTO(CanteenProductRecordSaveDTO canteenProductRecordSaveDTO) {
CanteenProductionRecordEntity canteenProductionRecord = BeanUtils.toBean(canteenProductRecordSaveDTO, CanteenProductionRecordEntity.class);
List<CanteenProductRecordSaveDTO.ProductionDetail> productionDetailList = canteenProductRecordSaveDTO.getProductionDetailList();
canteenProductionRecord.setDeptId(SecurityUtils.getUser().getDeptId());
int insert = baseMapper.insert(canteenProductionRecord);
List<UpdateStockDTO> materialUpdateStockDTOS = new ArrayList<>();
List<UpdateStockDTO> dishUpdateStockDTOS = new ArrayList<>();
for (CanteenProductRecordSaveDTO.ProductionDetail item: productionDetailList){
CanteenProductionRecordItemEntity canteenProductionRecordItemEntity = BeanUtils.toBean(item, CanteenProductionRecordItemEntity.class);
canteenProductionRecordItemEntity.setRecordId(canteenProductionRecord.getId());
canteenProductionRecordItemMapper.insert(canteenProductionRecordItemEntity);
UpdateStockDTO dishUpdateStockDTO = new UpdateStockDTO();
dishUpdateStockDTO.setId(item.getDishId());
dishUpdateStockDTO.setIncrCount(item.getProduceQuantity());
dishUpdateStockDTOS.add(dishUpdateStockDTO);
List<CanteenProductRecordSaveDTO.MaterialDetailList> materialDetailList = item.getMaterialDetailList();
List<ProductionRecordItemRelationEntity> productionRecordItemRelationEntities = BeanUtils.toBean(materialDetailList, ProductionRecordItemRelationEntity.class);
for (ProductionRecordItemRelationEntity materialDetailListItem: productionRecordItemRelationEntities){
materialDetailListItem.setRecordItemId(canteenProductionRecordItemEntity.getId());
UpdateStockDTO updateStockDTO = new UpdateStockDTO();
updateStockDTO.setId(materialDetailListItem.getMaterialId());
updateStockDTO.setIncrCount(-materialDetailListItem.getActualUsage());
materialUpdateStockDTOS.add(updateStockDTO);
}
productionRecordItemRelationMapper.insert(productionRecordItemRelationEntities);
}
//食材出库
canteenStockService.updateStock(materialUpdateStockDTOS);
//菜品入库
canteenStockService.updateStock(dishUpdateStockDTOS);
return insert;
}
}
@@ -0,0 +1,16 @@
package com.bsd.pjcloud.canteen.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.canteen.entity.CanteenProductionTemplateDetailEntity;
import com.bsd.pjcloud.canteen.mapper.CanteenProductionTemplateDetailMapper;
import com.bsd.pjcloud.canteen.service.CanteenProductionTemplateDetailService;
import org.springframework.stereotype.Service;
/**
* 加工模版明细表
*
* @author zjf
* @date 2025-05-12 13:53:57
*/
@Service
public class CanteenProductionTemplateDetailServiceImpl extends ServiceImpl<CanteenProductionTemplateDetailMapper, CanteenProductionTemplateDetailEntity> implements CanteenProductionTemplateDetailService {
}
@@ -0,0 +1,156 @@
package com.bsd.pjcloud.canteen.service.impl;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.canteen.entity.CanteenErpMaterialEntity;
import com.bsd.pjcloud.canteen.entity.CanteenProductionTemplateEntity;
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
import com.bsd.pjcloud.canteen.mapper.CanteenErpMaterialMapper;
import com.bsd.pjcloud.canteen.mapper.CanteenProductionTemplateMapper;
import com.bsd.pjcloud.canteen.mapper.CanteenSpuMapper;
import com.bsd.pjcloud.canteen.service.CanteenProductionTemplateService;
import com.bsd.pjcloud.canteen.vo.erp.ProductTemplateVO;
import com.bsd.pjcloud.canteen.vo.erp.ProductionTemplateDetailVO;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.bsd.pjcloud.canteen.entity.CanteenProductionTemplateDetailEntity;
import com.bsd.pjcloud.canteen.mapper.CanteenProductionTemplateDetailMapper;
import org.springframework.transaction.annotation.Transactional;
import lombok.RequiredArgsConstructor;
import java.util.*;
import java.util.stream.Collectors;
/**
* 加工模版表
*
* @author zjf
* @date 2025-05-12 13:41:26
*/
@Service
@RequiredArgsConstructor
public class CanteenProductionTemplateServiceImpl extends ServiceImpl<CanteenProductionTemplateMapper, CanteenProductionTemplateEntity> implements CanteenProductionTemplateService {
private final CanteenProductionTemplateDetailMapper canteenProductionTemplateDetailMapper;
private final CanteenSpuMapper canteenSpuMapper;
private final CanteenErpMaterialMapper canteenErpMaterialMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean saveDeep(CanteenProductionTemplateEntity canteenProductionTemplate) {
baseMapper.insert(canteenProductionTemplate);
for (CanteenProductionTemplateDetailEntity canteenProductionTemplateDetail : canteenProductionTemplate.getCanteenProductionTemplateDetailList()) {
canteenProductionTemplateDetail.setTemplateId(canteenProductionTemplate.getId());
canteenProductionTemplateDetailMapper.insert( canteenProductionTemplateDetail);
}
return Boolean.TRUE;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateDeep(CanteenProductionTemplateEntity canteenProductionTemplate) {
baseMapper.updateById(canteenProductionTemplate);
for (CanteenProductionTemplateDetailEntity canteenProductionTemplateDetail : canteenProductionTemplate.getCanteenProductionTemplateDetailList()) {
if (Objects.isNull(canteenProductionTemplateDetail.getId())) {
canteenProductionTemplateDetail.setTemplateId(canteenProductionTemplate.getId());
canteenProductionTemplateDetailMapper.insert(canteenProductionTemplateDetail);
} else {
canteenProductionTemplateDetailMapper.updateById(canteenProductionTemplateDetail);
}
}
return Boolean.TRUE;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean removeDeep(Long[] ids) {
baseMapper.deleteBatchIds(CollUtil.toList(ids));
canteenProductionTemplateDetailMapper.delete(Wrappers.<CanteenProductionTemplateDetailEntity>lambdaQuery().in(CanteenProductionTemplateDetailEntity::getTemplateId, ids));
return Boolean.TRUE;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean removeChild(Long[] ids) {
canteenProductionTemplateDetailMapper.deleteBatchIds(CollUtil.toList(ids));
return Boolean.TRUE;
}
@Override
public ProductTemplateVO getDetailById(Long id) {
CanteenProductionTemplateEntity canteenProductionTemplateEntity = baseMapper.selectById(id);
Long dishId = canteenProductionTemplateEntity.getDishId();
CanteenSpuEntity canteenSpuEntity = canteenSpuMapper.selectById(dishId);
LambdaQueryWrapper<CanteenProductionTemplateDetailEntity> canteenProductionTemplateDetailEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
canteenProductionTemplateDetailEntityLambdaQueryWrapper.eq(CanteenProductionTemplateDetailEntity::getTemplateId, id);
List<CanteenProductionTemplateDetailEntity> canteenProductionTemplateDetailEntities = canteenProductionTemplateDetailMapper.selectList(canteenProductionTemplateDetailEntityLambdaQueryWrapper);
ProductTemplateVO bean = BeanUtils.toBean(canteenProductionTemplateEntity, ProductTemplateVO.class);
bean.setDishName(canteenSpuEntity.getName());
List<ProductionTemplateDetailVO> productionTemplateDetailVOList= BeanUtils.toBean(canteenProductionTemplateDetailEntities, ProductionTemplateDetailVO.class);
for (ProductionTemplateDetailVO productionTemplateDetailVO : productionTemplateDetailVOList) {
Long materialId = productionTemplateDetailVO.getMaterialId();
CanteenErpMaterialEntity canteenErpMaterialEntity = canteenErpMaterialMapper.selectById(materialId);
productionTemplateDetailVO.setMaterialName(canteenErpMaterialEntity.getName());
productionTemplateDetailVO.setUnit(canteenErpMaterialEntity.getUnit());
}
bean.setCanteenProductionTemplateDetailList(productionTemplateDetailVOList);
return bean;
}
@Override
public Object pageScope(Page page, LambdaQueryWrapper<CanteenProductionTemplateEntity> wrapper) {
Page pageData = baseMapper.selectPageByScope(page, wrapper, DataScope.of());
// pageData.getRecords().forEach(item->{
// });
return pageData;
}
@Override
public Object getSelectTemplatePageScope(Page page, String name) {
Page<CanteenProductionTemplateEntity> pageData = baseMapper.selectPageByScope(page, Wrappers.<CanteenProductionTemplateEntity>lambdaQuery().like(StringUtils.isNotBlank(name),CanteenProductionTemplateEntity::getTemplateName, name), DataScope.of());
List<CanteenProductionTemplateEntity> records = pageData.getRecords();
if (CollectionUtils.isEmpty(records)){
return pageData;
}
List<ProductTemplateVO> canteenProductionTemplateVOList = BeanUtils.toBean(records, ProductTemplateVO.class);
Set<Long> distinctIds = canteenProductionTemplateVOList.stream().map(ProductTemplateVO::getDishId).collect(Collectors.toSet());
List<Long> templateIds = canteenProductionTemplateVOList.stream().map(ProductTemplateVO::getId).collect(Collectors.toList());
List<CanteenSpuEntity> canteenSpuEntities = canteenSpuMapper.selectByIds(distinctIds);
Map<Long, CanteenSpuEntity> dishMap = canteenSpuEntities.stream()
.collect(Collectors.toMap(CanteenSpuEntity::getId, entity -> entity));
List<CanteenProductionTemplateDetailEntity> canteenProductionTemplateDetailEntities = canteenProductionTemplateDetailMapper.selectList(Wrappers.<CanteenProductionTemplateDetailEntity>lambdaQuery().in(CanteenProductionTemplateDetailEntity::getTemplateId, templateIds));
Set<Long> materialIds = canteenProductionTemplateDetailEntities.stream().map(CanteenProductionTemplateDetailEntity::getMaterialId).collect(Collectors.toSet());
List<CanteenErpMaterialEntity> canteenErpMaterialEntities = canteenErpMaterialMapper.selectByIds(materialIds);
Map<Long, CanteenErpMaterialEntity> materialMap = canteenErpMaterialEntities.stream()
.collect(Collectors.toMap(CanteenErpMaterialEntity::getId, entity -> entity));
Page<ProductTemplateVO> productTemplateVOPage = new Page<>();
List<ProductionTemplateDetailVO> productionTemplateDetailVOList = BeanUtils.toBean(canteenProductionTemplateDetailEntities, ProductionTemplateDetailVO.class);
productionTemplateDetailVOList.forEach(item->{
item.setMaterialName(materialMap.getOrDefault(item.getMaterialId(), new CanteenErpMaterialEntity()).getName());
item.setUnit(materialMap.getOrDefault(item.getMaterialId(), new CanteenErpMaterialEntity()).getUnit());
});
Map<Long, List<ProductionTemplateDetailVO>> detailMap = productionTemplateDetailVOList.stream()
.collect(Collectors.groupingBy(ProductionTemplateDetailVO::getTemplateId));
canteenProductionTemplateVOList.forEach(item-> {
item.setDishName(dishMap.getOrDefault(item.getDishId(), new CanteenSpuEntity()).getName());
item.setCanteenProductionTemplateDetailList(detailMap.getOrDefault(item.getId(), new ArrayList<>()));
});
productTemplateVOPage.setRecords(canteenProductionTemplateVOList);
productTemplateVOPage.setTotal(pageData.getTotal());
productTemplateVOPage.setPages(pageData.getPages());
productTemplateVOPage.setCurrent(pageData.getCurrent());
return productTemplateVOPage;
}
}
@@ -11,12 +11,17 @@ import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
import com.bsd.pjcloud.canteen.entity.CanteenDailyMenuEntity;
import com.bsd.pjcloud.canteen.entity.CanteenOnlineSpuEntity;
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
import com.bsd.pjcloud.canteen.entity.CanteenStockEntity;
import com.bsd.pjcloud.canteen.mapper.CanteenCategoryMapper;
import com.bsd.pjcloud.canteen.mapper.CanteenDailyMenuMapper;
import com.bsd.pjcloud.canteen.mapper.CanteenSpuMapper;
import com.bsd.pjcloud.canteen.mapper.CanteenStockMapper;
import com.bsd.pjcloud.canteen.service.CanteenDailyMenuService;
import com.bsd.pjcloud.canteen.service.CanteenSpuService;
import com.bsd.pjcloud.canteen.service.CanteenStockService;
import com.bsd.pjcloud.canteen.vo.ADCanteenSpuListVO;
import com.bsd.pjcloud.canteen.vo.erp.CanteenSpuSimpleVO;
import com.bsd.pjcloud.canteen.vo.erp.CanteenSpuStockVO;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
@@ -26,6 +31,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -44,6 +50,7 @@ public class CanteenSpuServiceImpl extends ServiceImpl<CanteenSpuMapper, Canteen
private final CanteenDailyMenuMapper canteenDailyMenuMapper;
private final CanteenCategoryMapper canteenCategoryMapper;
private final CanteenStockMapper canteenStockMapper;
@Override
public Object selectFoodList(LambdaQueryWrapper<CanteenSpuEntity> wrapper) {
return baseMapper.selectListByScope(wrapper, DataScope.of());
@@ -133,5 +140,93 @@ public class CanteenSpuServiceImpl extends ServiceImpl<CanteenSpuMapper, Canteen
}
@Override
public Page<CanteenSpuSimpleVO> getCanteenSpuSimplePageScope(Page page, CanteenSpuEntity canteenSpu) {
LambdaQueryWrapper<CanteenSpuEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.like(StrUtil.isNotBlank(canteenSpu.getName()), CanteenSpuEntity::getName, canteenSpu.getName());
wrapper.eq(Objects.nonNull(canteenSpu.getCategoryId()), CanteenSpuEntity::getCategoryId, canteenSpu.getCategoryId());
wrapper.orderByAsc(CanteenSpuEntity::getSort).orderByDesc(CanteenSpuEntity::getId);
Page<CanteenSpuEntity> pageData = baseMapper.selectPageByScope(page, wrapper, DataScope.of());
List<CanteenSpuSimpleVO> canteenSpuSimpleVOList = BeanUtils.toBean(pageData.getRecords(), CanteenSpuSimpleVO.class);
Page<CanteenSpuSimpleVO> canteenSpuSimpleVOPage = new Page<>();
canteenSpuSimpleVOPage.setRecords(canteenSpuSimpleVOList);
pageData.setCurrent(pageData.getCurrent());
canteenSpuSimpleVOPage.setPages(pageData.getPages());
canteenSpuSimpleVOPage.setSize(pageData.getSize());
canteenSpuSimpleVOPage.setTotal(pageData.getTotal());
// 复制分页参数
return canteenSpuSimpleVOPage;
}
@Override
public Page<CanteenSpuStockVO> erpPageScope(Page page, CanteenSpuEntity canteenSpu) {
LambdaQueryWrapper<CanteenSpuEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.like(StrUtil.isNotBlank(canteenSpu.getName()), CanteenSpuEntity::getName, canteenSpu.getName());
wrapper.eq(Objects.nonNull(canteenSpu.getCategoryId()), CanteenSpuEntity::getCategoryId, canteenSpu.getCategoryId());
wrapper.orderByAsc(CanteenSpuEntity::getSort).orderByDesc(CanteenSpuEntity::getId);
// 查询SPU分页数据
Page<CanteenSpuEntity> pageData = baseMapper.selectPageByScope(page, wrapper, DataScope.of());
List<CanteenSpuEntity> records = pageData.getRecords();
// 构建返回的VO列表
List<CanteenSpuStockVO> resultList = new ArrayList<>();
if (!CollectionUtils.isEmpty(records)) {
// 获取所有SPU ID
List<Long> spuIds = records.stream()
.map(CanteenSpuEntity::getId)
.collect(Collectors.toList());
// 查询对应的库存信息
LambdaQueryWrapper<CanteenStockEntity> stockWrapper = Wrappers.lambdaQuery();
stockWrapper.in(CanteenStockEntity::getItemId, spuIds);
stockWrapper.eq(CanteenStockEntity::getItemType, "2"); // 假设"成品"表示菜品的类型
List<CanteenStockEntity> stockList = canteenStockMapper.selectList(stockWrapper);
// 将库存信息映射到SPU ID
Map<Long, CanteenStockEntity> stockMap = stockList.stream()
.collect(Collectors.toMap(CanteenStockEntity::getItemId, stock -> stock, (v1, v2) -> v1));
// 构建返回结果
for (CanteenSpuEntity spu : records) {
CanteenSpuStockVO vo = new CanteenSpuStockVO();
vo.setName(spu.getName());
vo.setPicUrl(spu.getPicUrl());
// 设置库存信息
CanteenStockEntity stock = stockMap.get(spu.getId());
if (stock != null) {
vo.setId(stock.getId());
vo.setBaseStock(stock.getBaseStock());
vo.setCurrentStock(stock.getCurrentStock());
vo.setInventoryUpperLimit(stock.getInventoryUpperLimit());
vo.setInventoryLowerLimit(stock.getInventoryLowerLimit());
} else {
// 如果没有对应的库存记录,则设置默认值
vo.setBaseStock(0.0);
vo.setCurrentStock(0.0);
vo.setInventoryUpperLimit(0);
vo.setInventoryLowerLimit(0);
}
resultList.add(vo);
}
}
// 构建分页返回对象
Page<CanteenSpuStockVO> resultPage = new Page<>();
resultPage.setRecords(resultList);
resultPage.setTotal(pageData.getTotal());
resultPage.setSize(pageData.getSize());
resultPage.setCurrent(pageData.getCurrent());
resultPage.setPages(pageData.getPages());
return resultPage;
}
}
@@ -0,0 +1,66 @@
package com.bsd.pjcloud.canteen.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.bsd.pjcloud.canteen.dto.erp.UpdateStockDTO;
import com.bsd.pjcloud.canteen.entity.CanteenErpMaterialEntity;
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
import com.bsd.pjcloud.canteen.entity.CanteenStockEntity;
import com.bsd.pjcloud.canteen.mapper.CanteenErpMaterialMapper;
import com.bsd.pjcloud.canteen.mapper.CanteenStockMapper;
import com.bsd.pjcloud.canteen.service.CanteenStockService;
import lombok.AllArgsConstructor;
import org.springframework.dao.OptimisticLockingFailureException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 库存表
*
* @author zjf
* @date 2025-05-07 16:40:35
*/
@Service
@AllArgsConstructor
public class CanteenStockServiceImpl extends ServiceImpl<CanteenStockMapper, CanteenStockEntity> implements CanteenStockService {
private final CanteenErpMaterialMapper canteenErpMaterialMapper;
@Override
@Transactional
// @Retryable(value = {OptimisticLockingFailureException.class}, maxAttempts = 3)
public void updateStock(List<UpdateStockDTO> updateStockDTOS) {
// 更新库存(手动乐观锁)
for (UpdateStockDTO item : updateStockDTOS) {
// 1. 先查询当前版本号
LambdaQueryWrapper<CanteenStockEntity> stockEntityLambdaQueryWrapper = new LambdaQueryWrapper<CanteenStockEntity>();
stockEntityLambdaQueryWrapper.eq(CanteenStockEntity::getItemId,item.getId());
CanteenStockEntity smErpStockEntity = baseMapper.selectOne(stockEntityLambdaQueryWrapper);
LambdaQueryWrapper<CanteenStockEntity> updateStockWithLockWrapper = new LambdaQueryWrapper<CanteenStockEntity>();
updateStockWithLockWrapper.eq(CanteenStockEntity::getItemId,item.getId());
updateStockWithLockWrapper.eq(CanteenStockEntity::getVersion,smErpStockEntity.getVersion());
CanteenStockEntity updateSmErpStockEntity = new CanteenStockEntity();
Double currentStock = smErpStockEntity.getCurrentStock();
if (item.getIncrCount()<0 &&currentStock<Math.abs(item.getIncrCount())){
LambdaQueryWrapper<CanteenErpMaterialEntity> canteenErpMaterialEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
canteenErpMaterialEntityLambdaQueryWrapper.eq(CanteenErpMaterialEntity::getId,item.getId());
CanteenErpMaterialEntity canteenErpMaterialEntity = canteenErpMaterialMapper.selectOne(canteenErpMaterialEntityLambdaQueryWrapper);
throw new RuntimeException(canteenErpMaterialEntity.getName()+"库存不足");
}
updateSmErpStockEntity.setCurrentStock(currentStock +item.getIncrCount());
updateSmErpStockEntity.setVersion(smErpStockEntity.getVersion()+1);
int update = baseMapper.update(updateSmErpStockEntity, updateStockWithLockWrapper);
// 3. 检查更新结果
if (update == 0) {
throw new RuntimeException("库存更新冲突,请重试操作");
}
}
}
}
@@ -0,0 +1,38 @@
package com.bsd.pjcloud.canteen.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.canteen.entity.CanteenSupplierEntity;
import com.bsd.pjcloud.canteen.mapper.CanteenSupplierMapper;
import com.bsd.pjcloud.canteen.service.CanteenSupplierService;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 货商信息
*
* @author zjf
* @date 2025-05-09 13:18:19
*/
@Service
@AllArgsConstructor
public class CanteenSupplierServiceImpl extends ServiceImpl<CanteenSupplierMapper, CanteenSupplierEntity> implements CanteenSupplierService {
@Override
public Object pageScope(Page page, LambdaQueryWrapper<CanteenSupplierEntity> wrapper) {
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
}
@Override
public List<CanteenSupplierEntity> selectSimpleAllScope(String name, Long supplierId) {
LambdaQueryWrapper<CanteenSupplierEntity> wrapper = new LambdaQueryWrapper<CanteenSupplierEntity>();
wrapper.eq(CanteenSupplierEntity::getStatus, "0");
wrapper.like(StringUtils.isNotBlank(name),CanteenSupplierEntity::getSupplierName,name);
wrapper.eq(supplierId!=null,CanteenSupplierEntity::getSupplierId,supplierId);
return baseMapper.selectListByScope(wrapper, DataScope.of());
}
}
@@ -0,0 +1,16 @@
package com.bsd.pjcloud.canteen.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.canteen.entity.ProductionRecordItemRelationEntity;
import com.bsd.pjcloud.canteen.mapper.ProductionRecordItemRelationMapper;
import com.bsd.pjcloud.canteen.service.ProductionRecordItemRelationService;
import org.springframework.stereotype.Service;
/**
* 食材加工菜品关系表
*
* @author zjf
* @date 2025-05-14 12:47:16
*/
@Service
public class ProductionRecordItemRelationServiceImpl extends ServiceImpl<ProductionRecordItemRelationMapper, ProductionRecordItemRelationEntity> implements ProductionRecordItemRelationService {
}
@@ -2,8 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsd.pjcloud.canteen.mapper.CanteenDailyMenuMapper">
<resultMap id="canteenDailyMenuMap" type="com.bsd.pjcloud.canteen.entity.CanteenDailyMenuEntity">
<resultMap id="canteenDailyMenuMap" type="com.bsd.pjcloud.canteen.entity.CanteenDailyMenuEntity">
<id property="id" column="id"/>
<result property="startTime" column="start_time"/>
<result property="spuId" column="spu_id"/>
@@ -16,7 +15,7 @@
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
</resultMap>
<resultMap id="adCanteenDailyMenuListVO" type="com.bsd.pjcloud.canteen.vo.ADCanteenDailyMenuListVO">
<id property="id" column="id"/>
@@ -27,28 +26,29 @@
<result property="categoryId" column="category_id"/>
<result property="picUrl" column="pic_url"/>
<result property="stock" column="stock"/>
<result property="sort" column="sort"/>
<result property="hourType" column="hour_type"/>
</resultMap>
<select id="selectTimeFood" resultType="com.bsd.pjcloud.canteen.vo.DailyMenuVO">
SELECT
DISTINCT(sp.id),
t.id as tid,
sp.name,
sp.pic_url,
t.hour_type,
sp.price,
sp.category_id
t.id as tid,
sp.name,
sp.pic_url,
t.hour_type,
sp.price,
sp.category_id
FROM canteen_daily_menu t
LEFT JOIN canteen_spu sp
on t.spu_id=sp.id
<where>
AND t.merchant_id = #{merchantId}
<if test="categoryId != null">
AND sp.category_id = #{categoryId}
</if>
AND sp.del_flag = 0
AND t.start_time = #{time}
And t.del_flag = 0
AND t.merchant_id = #{merchantId}
<if test="categoryId != null">
AND sp.category_id = #{categoryId}
</if>
AND sp.del_flag = 0
AND t.start_time = #{time}
And t.del_flag = 0
</where>
order by sp.sort asc
</select>
@@ -62,6 +62,7 @@
sp.price,
sp.stock,
sp.category_id,
sp.sort,
t.dept_id,
t.create_by
FROM canteen_daily_menu t
@@ -83,22 +84,23 @@
</if>
</where>
</select>
<select id="selectTimeFoodPage" resultType="com.bsd.pjcloud.canteen.vo.app.DailyMenuAppVO" parameterType="com.bsd.pjcloud.canteen.dto.app.DailyMenuDTO">
<select id="selectTimeFoodPage" resultType="com.bsd.pjcloud.canteen.vo.app.DailyMenuAppVO"
parameterType="com.bsd.pjcloud.canteen.dto.app.DailyMenuDTO">
SELECT m.id,
m.hour_type,
s.id as spu_id,
s.`name`,
s.price,
s.stock,
s.pic_url,
s.sort,
s.is_show,
c.id as category_id
m.hour_type,
s.id as spu_id,
s.`name`,
s.price,
s.stock,
s.pic_url,
s.sort,
s.is_show,
c.id as category_id
FROM `canteen_daily_menu` m
left JOIN canteen_spu s
on m.spu_id = s.id
LEFT JOIN canteen_category c
on s.category_id = c.id
left JOIN canteen_spu s
on m.spu_id = s.id
LEFT JOIN canteen_category c
on s.category_id = c.id
<where>
m.del_flag = 0 and s.del_flag = 0 and m.merchant_id = #{dailyMenuDTO.merchantId} and s.is_show = 0
<if test="dailyMenuDTO.startTime != null">
@@ -112,6 +114,5 @@
</if>
</where>
order by s.sort asc
</select>
</mapper>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsd.pjcloud.canteen.mapper.CanteenErpCategoryMapper">
<resultMap id="canteenErpCategoryMap" type="com.bsd.pjcloud.canteen.entity.CanteenErpCategoryEntity">
<id property="id" column="id"/>
<result property="parentId" column="parent_id"/>
<result property="name" column="name"/>
<result property="picUrl" column="pic_url"/>
<result property="sort" column="sort"/>
<result property="status" column="status"/>
<result property="deptId" column="dept_id"/>
<result property="merchantId" column="merchant_id"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
</mapper>
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsd.pjcloud.canteen.mapper.CanteenErpMaterialMapper">
<resultMap id="canteenErpMaterialMap" type="com.bsd.pjcloud.canteen.entity.CanteenErpMaterialEntity">
<id property="id" column="id"/>
<result property="name" column="name"/>
<result property="unit" column="unit"/>
<result property="deptId" column="dept_id"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
<result property="purchasePrice" column="purchase_price"/>
<result property="categoryId" column="category_id"/>
</resultMap>
<select id="selectPageDataByScope" resultType="com.bsd.pjcloud.canteen.vo.erp.CanteenErpMaterialVO">
SELECT
m.id,
m.name,
m.unit,
m.category_id,
m.purchase_price,
s.base_stock AS baseStock,
s.inventory_upper_limit AS inventoryUpperLimit,
s.inventory_lower_limit AS inventoryLowerLimit,
s.current_stock AS currentStock
FROM canteen_erp_material m
left join canteen_stock s
on m.id=s.item_id
<where>
m.del_flag = '0'
<if test="canteenErpMaterial.name != null">
and m.name like concat('%',#{canteenErpMaterial.name},'%')
</if>
</where>
</select>
</mapper>
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsd.pjcloud.canteen.mapper.CanteenInventoryRecordsItemMapper">
<resultMap id="canteenInventoryRecordsItemMap" type="com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsItemEntity">
<id property="id" column="id"/>
<result property="inventoryType" column="inventory_type"/>
<result property="erpMaterialId" column="erp_material_id"/>
<result property="merchantId" column="merchant_id"/>
<result property="deptId" column="dept_id"/>
<result property="quantity" column="quantity"/>
<result property="unitPrice" column="unit_price"/>
<result property="totalAmount" column="total_amount"/>
<result property="taxRate" column="tax_rate"/>
<result property="taxAmount" column="tax_amount"/>
<result property="supplierId" column="supplier_id"/>
<result property="remark" column="remark"/>
<result property="orderType" column="order_type"/>
<result property="inventoryId" column="inventory_id"/>
<result property="totalNumber" column="total_number"/>
<result property="accountNumber" column="account_number"/>
<result property="realNumber" column="real_number"/>
<result property="realPrice" column="real_price"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
</mapper>
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsd.pjcloud.canteen.mapper.CanteenInventoryRecordsMapper">
<resultMap id="canteenInventoryRecordsMap" type="com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsEntity">
<id property="id" column="id"/>
<result property="inventoryCode" column="inventory_code"/>
<result property="inventoryDate" column="inventory_date"/>
<result property="inventoryType" column="inventory_type"/>
<result property="linkCode" column="link_code"/>
<result property="handlerUserId" column="handler_user_id"/>
<result property="checkStatus" column="check_status"/>
<result property="checkUserId" column="check_user_id"/>
<result property="checkTime" column="check_time"/>
<result property="merchantId" column="merchant_id"/>
<result property="deptId" column="dept_id"/>
<result property="supplierId" column="supplier_id"/>
<result property="remark" column="remark"/>
<result property="orderType" column="order_type"/>
<result property="totalAmount" column="total_amount"/>
<result property="receiveAmount" column="receive_amount"/>
<result property="processInstanceId" column="process_instance_id"/>
<result property="checkReason" column="check_reason"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
<select id="selectPageDataByScope"
resultType="com.bsd.pjcloud.canteen.vo.erp.CanteenProductionRecordPageVO">
SELECT r.id, r.inventory_code,r.inventory_date, COALESCE(GROUP_CONCAT(m.name ORDER BY m.name SEPARATOR ','), '') AS product_name,r.remark,r.total_amount,s.supplier_name,
r.check_status FROM `canteen_inventory_records` r
LEFT JOIN canteen_inventory_records_item i
on r.id=i.inventory_id
LEFT JOIN canteen_erp_material m
on i.erp_material_id=m.id
LEFT JOIN canteen_supplier s
on i.supplier_id=s.supplier_id
<where>
r.del_flag = '0'
<if test="canteenInventoryRecords.inventoryCode != null and canteenInventoryRecords.inventoryCode != ''">
and r.inventory_code = #{canteenInventoryRecords.inventoryCode}
</if>
<if test="canteenInventoryRecords.inventoryDate != null and canteenInventoryRecords.inventoryDate != ''">
and cpr.production_time = #{inventoryDate}
</if>
</where>
GROUP BY r.id
order by r.create_time desc
</select>
</mapper>
Loaded 100 of 529 files, more files were not shown because too many files have changed in this diff. Show more