Merge branch 'master' of http://gitea.zianxin.com/zianxin-tec/biz-api-cloud
This commit is contained in:
commit
61a16acef6
48 files changed
+1630
-48
No files matched your search
+30
@@ -0,0 +1,30 @@
|
||||
package com.bsd.pjcloud.canteen.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 入库类型编码前兆
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum InventoryTypeEnum {
|
||||
|
||||
CGRK("1", "CGRK"),
|
||||
;
|
||||
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 ""; // 如果没有找到对应的数字
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+22
@@ -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;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+10
@@ -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;
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
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;
|
||||
}
|
||||
+97
@@ -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;
|
||||
|
||||
}
|
||||
+73
@@ -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> canteenInventoryRecordsItemDTOS;
|
||||
|
||||
|
||||
}
|
||||
+35
@@ -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;
|
||||
|
||||
|
||||
}
|
||||
+3
@@ -88,4 +88,7 @@ public class CanteenErpMaterialEntity extends Model<CanteenErpMaterialEntity> {
|
||||
*/
|
||||
@Schema(description="租户编号")
|
||||
private Long tenantId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
File renamed without changes.
+1
-1
@@ -57,7 +57,7 @@ public class CanteenInventoryRecordsItemEntity extends Model<CanteenInventoryRec
|
||||
* 出入库数量
|
||||
*/
|
||||
@Schema(description="出入库数量")
|
||||
private Integer quantity;
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
+109
@@ -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;
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
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;
|
||||
}
|
||||
-6
@@ -53,12 +53,6 @@ public class CanteenStockEntity extends Model<CanteenStockEntity> {
|
||||
@Schema(description="乐观锁版本号")
|
||||
private Integer version;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@Schema(description="部门id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 库存上限
|
||||
*/
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
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-08 11:05:33
|
||||
*/
|
||||
@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 dishId;
|
||||
|
||||
/**
|
||||
* 记录item表id
|
||||
*/
|
||||
@Schema(description="记录item表id")
|
||||
private Long recordItemId;
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
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;
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 食材加工记录表
|
||||
*
|
||||
* @author zjf
|
||||
* @date 2025-05-08 11:02:09
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "食材加工记录表vo")
|
||||
public class CanteenProductionRecordPageVO {
|
||||
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
@@ -14,7 +14,18 @@
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.retry</groupId>
|
||||
<artifactId>spring-retry</artifactId>
|
||||
<version>1.3.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 分布式发号器-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-sequence</artifactId>
|
||||
<version>5.7.0</version>
|
||||
</dependency>
|
||||
<!-- 分布式任务-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
|
||||
+49
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+19
-12
@@ -5,6 +5,10 @@ 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;
|
||||
@@ -17,10 +21,10 @@ 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;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 原料表
|
||||
@@ -37,6 +41,8 @@ public class CanteenErpMaterialController {
|
||||
|
||||
private final CanteenErpMaterialService canteenErpMaterialService;
|
||||
|
||||
private final CanteenStockService canteenStockService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
@@ -47,8 +53,7 @@ public class CanteenErpMaterialController {
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenErpMaterial_view')" )
|
||||
public R getCanteenErpMaterialPage(@ParameterObject Page page, @ParameterObject CanteenErpMaterialEntity canteenErpMaterial) {
|
||||
LambdaQueryWrapper<CanteenErpMaterialEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(canteenErpMaterialService.page(page, wrapper));
|
||||
return R.ok(canteenErpMaterialService.pageScope(page, canteenErpMaterial));
|
||||
}
|
||||
|
||||
|
||||
@@ -61,33 +66,32 @@ public class CanteenErpMaterialController {
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenErpMaterial_view')" )
|
||||
public R getById(@PathVariable("id" ) Long id) {
|
||||
return R.ok(canteenErpMaterialService.getById(id));
|
||||
return R.ok(canteenErpMaterialService.getCanteenErpMaterialVOById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增原料表
|
||||
* @param canteenErpMaterial 原料表
|
||||
* @param
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增原料表" , description = "新增原料表" )
|
||||
@SysLog("新增原料表" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenErpMaterial_add')" )
|
||||
public R save(@RequestBody CanteenErpMaterialEntity canteenErpMaterial) {
|
||||
return R.ok(canteenErpMaterialService.save(canteenErpMaterial));
|
||||
public R save(@RequestBody CanteenErpMaterialSaveDTO canteenErpMaterialSaveDTO) {
|
||||
return R.ok(canteenErpMaterialService.saveCanteenErpMaterialDTO(canteenErpMaterialSaveDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改原料表
|
||||
* @param canteenErpMaterial 原料表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改原料表" , description = "修改原料表" )
|
||||
@SysLog("修改原料表" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenErpMaterial_edit')" )
|
||||
public R updateById(@RequestBody CanteenErpMaterialEntity canteenErpMaterial) {
|
||||
return R.ok(canteenErpMaterialService.updateById(canteenErpMaterial));
|
||||
public R updateById(@RequestBody CanteenErpMaterialEditorDTO canteenErpMaterialEditorDTO) {
|
||||
return R.ok(canteenErpMaterialService.updateById(canteenErpMaterialEditorDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,9 +102,12 @@ public class CanteenErpMaterialController {
|
||||
@Operation(summary = "通过id删除原料表" , description = "通过id删除原料表" )
|
||||
@SysLog("通过id删除原料表" )
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenErpMaterial_del')" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenErpMaterial_del')")
|
||||
@Transactional
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(canteenErpMaterialService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
boolean b = canteenErpMaterialService.removeBatchByIds(CollUtil.toList(ids));
|
||||
canteenStockService.remove(Wrappers.lambdaQuery(CanteenStockEntity.class).in(CanteenStockEntity::getItemId, ids));
|
||||
return R.ok(b);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+8
-7
@@ -6,6 +6,7 @@ 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.CanteenInventoryRecordsdDTO;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsEntity;
|
||||
@@ -48,10 +49,10 @@ public class CanteenInventoryRecordsController {
|
||||
@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.page(page, wrapper));
|
||||
// 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));
|
||||
}
|
||||
|
||||
|
||||
@@ -69,15 +70,15 @@ public class CanteenInventoryRecordsController {
|
||||
|
||||
/**
|
||||
* 新增采购记录表
|
||||
* @param canteenInventoryRecords 采购记录表
|
||||
* @param canteenInventoryRecordsdDTO 采购记录表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增采购记录表" , description = "新增采购记录表" )
|
||||
@SysLog("新增采购记录表" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecords_add')" )
|
||||
public R save(@RequestBody CanteenInventoryRecordsEntity canteenInventoryRecords) {
|
||||
return R.ok(canteenInventoryRecordsService.save(canteenInventoryRecords));
|
||||
public R save(@RequestBody CanteenInventoryRecordsdDTO canteenInventoryRecordsdDTO) {
|
||||
return R.ok(canteenInventoryRecordsService.saveCanteenInventoryRecordsdDTO(canteenInventoryRecordsdDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+122
@@ -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.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.page(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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增食材加工记录表
|
||||
* @param canteenProductionRecord 食材加工记录表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增食材加工记录表" , description = "新增食材加工记录表" )
|
||||
@SysLog("新增食材加工记录表" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenProductionRecord_add')" )
|
||||
public R save(@RequestBody CanteenProductionRecordEntity canteenProductionRecord) {
|
||||
return R.ok(canteenProductionRecordService.save(canteenProductionRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改食材加工记录表
|
||||
* @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));
|
||||
}
|
||||
}
|
||||
+119
@@ -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));
|
||||
}
|
||||
}
|
||||
+119
@@ -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-08 11:05:33
|
||||
*/
|
||||
@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));
|
||||
}
|
||||
}
|
||||
+6
@@ -1,11 +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);
|
||||
}
|
||||
+12
@@ -1,11 +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);
|
||||
}
|
||||
+11
@@ -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> {
|
||||
|
||||
|
||||
}
|
||||
+11
@@ -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> {
|
||||
|
||||
|
||||
}
|
||||
+3
@@ -1,9 +1,12 @@
|
||||
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> {
|
||||
|
||||
|
||||
+11
@@ -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> {
|
||||
|
||||
|
||||
}
|
||||
+29
@@ -1,8 +1,37 @@
|
||||
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);
|
||||
}
|
||||
+19
@@ -1,8 +1,27 @@
|
||||
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.CanteenInventoryRecordsdDTO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsEntity;
|
||||
import com.bsd.pjcloud.canteen.vo.erp.CanteenProductionRecordPageVO;
|
||||
|
||||
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);
|
||||
}
|
||||
+8
@@ -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> {
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.bsd.pjcloud.canteen.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenProductionRecordEntity;
|
||||
|
||||
public interface CanteenProductionRecordService extends IService<CanteenProductionRecordEntity> {
|
||||
|
||||
}
|
||||
+5
@@ -1,8 +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);
|
||||
}
|
||||
+8
@@ -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> {
|
||||
|
||||
}
|
||||
+84
@@ -1,10 +1,22 @@
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* 原料表
|
||||
*
|
||||
@@ -12,5 +24,77 @@ import org.springframework.stereotype.Service;
|
||||
* @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);
|
||||
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());
|
||||
|
||||
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());
|
||||
return canteenErpMaterialVO;
|
||||
}
|
||||
}
|
||||
+78
@@ -1,10 +1,32 @@
|
||||
package com.bsd.pjcloud.canteen.service.impl;
|
||||
|
||||
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.CanteenInventoryRecordsItemDTO;
|
||||
import com.bsd.pjcloud.canteen.dto.erp.CanteenInventoryRecordsdDTO;
|
||||
import com.bsd.pjcloud.canteen.dto.erp.UpdateStockDTO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsEntity;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsItemEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenInventoryRecordsItemMapper;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenInventoryRecordsMapper;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenProductionRecordItemMapper;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenStockMapper;
|
||||
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.common.core.util.BeanUtils;
|
||||
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.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 采购记录表
|
||||
*
|
||||
@@ -12,5 +34,61 @@ import org.springframework.stereotype.Service;
|
||||
* @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;
|
||||
@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.RESULT.getCode());
|
||||
baseMapper.insert(canteenInventoryRecordsEntity);
|
||||
Long id = canteenInventoryRecordsEntity.getId();
|
||||
|
||||
List<CanteenInventoryRecordsItemDTO> canteenInventoryRecordsItemDTOS = canteenInventoryRecordsdDTO.getCanteenInventoryRecordsItemDTOS();
|
||||
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(id);
|
||||
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());
|
||||
}
|
||||
}
|
||||
+16
@@ -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 {
|
||||
}
|
||||
+16
@@ -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.CanteenProductionRecordEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenProductionRecordMapper;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenProductionRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
* 食材加工记录表
|
||||
*
|
||||
* @author zjf
|
||||
* @date 2025-05-08 11:02:09
|
||||
*/
|
||||
@Service
|
||||
public class CanteenProductionRecordServiceImpl extends ServiceImpl<CanteenProductionRecordMapper, CanteenProductionRecordEntity> implements CanteenProductionRecordService {
|
||||
}
|
||||
+33
@@ -1,10 +1,18 @@
|
||||
package com.bsd.pjcloud.canteen.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.canteen.dto.erp.UpdateStockDTO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenStockEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenStockMapper;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenStockService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 库存表
|
||||
*
|
||||
@@ -13,4 +21,29 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class CanteenStockServiceImpl extends ServiceImpl<CanteenStockMapper, CanteenStockEntity> implements CanteenStockService {
|
||||
@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();
|
||||
updateSmErpStockEntity.setCurrentStock(smErpStockEntity.getCurrentStock()+item.getIncrCount());
|
||||
updateSmErpStockEntity.setVersion(smErpStockEntity.getVersion()+1);
|
||||
int update = baseMapper.update(updateSmErpStockEntity, updateStockWithLockWrapper);
|
||||
// 3. 检查更新结果
|
||||
if (update == 0) {
|
||||
throw new RuntimeException("库存更新冲突,请重试操作");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+16
@@ -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-08 11:05:33
|
||||
*/
|
||||
@Service
|
||||
public class ProductionRecordItemRelationServiceImpl extends ServiceImpl<ProductionRecordItemRelationMapper, ProductionRecordItemRelationEntity> implements ProductionRecordItemRelationService {
|
||||
}
|
||||
+19
@@ -15,4 +15,23 @@
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
<select id="selectPageDataByScope" resultType="com.bsd.pjcloud.canteen.vo.erp.CanteenErpMaterialVO">
|
||||
SELECT
|
||||
m.id,
|
||||
m.name,
|
||||
m.unit,
|
||||
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>
|
||||
+17
@@ -29,4 +29,21 @@
|
||||
<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
|
||||
cpr.id,
|
||||
cpr.production_time as productionTime,
|
||||
cpr.handler_user as handlerUser,
|
||||
cpr.record_id as recordId,
|
||||
cpr.record_code as recordCode,
|
||||
cpr.remark,
|
||||
cpr.create_by as createBy,
|
||||
cpr.create_time as createTime
|
||||
from canteen_production_record cpr
|
||||
where 1=1
|
||||
<if test="inventoryDate != null and inventoryDate != ''">
|
||||
and cpr.production_time = #{inventoryDate}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?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.CanteenProductionRecordItemMapper">
|
||||
|
||||
<resultMap id="canteenProductionRecordItemMap" type="com.bsd.pjcloud.canteen.entity.CanteenProductionRecordItemEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="itemRelationId" column="item_relation_id"/>
|
||||
<result property="materialId" column="material_id"/>
|
||||
<result property="inputQuantity" column="input_quantity"/>
|
||||
<result property="outputQuantity" column="output_quantity"/>
|
||||
<result property="recordId" column="record_id"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="lossRate" column="loss_rate"/>
|
||||
<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"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<?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.CanteenProductionRecordMapper">
|
||||
|
||||
<resultMap id="canteenProductionRecordMap" type="com.bsd.pjcloud.canteen.entity.CanteenProductionRecordEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="productionTime" column="production_time"/>
|
||||
<result property="handlerUser" column="handler_user"/>
|
||||
<result property="recordId" column="record_id"/>
|
||||
<result property="recordCode" column="record_code"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<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"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?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.ProductionRecordItemRelationMapper">
|
||||
|
||||
<resultMap id="productionRecordItemRelationMap" type="com.bsd.pjcloud.canteen.entity.ProductionRecordItemRelationEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="dishId" column="dish_id"/>
|
||||
<result property="recordItemId" column="record_item_id"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+20
-22
@@ -72,8 +72,6 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
Long deptId = SecurityUtils.getUser().getDeptId();
|
||||
SmErpInventoryRecordsEntity smErpCgDdEntity = BeanUtils.toBean(inventoryRecordSaveDTO, SmErpInventoryRecordsEntity.class);
|
||||
smErpCgDdEntity.setDeptId(deptId);
|
||||
smErpCgDdEntity.setCheckStatus("0");
|
||||
|
||||
List<InventoryRecordSaveItemDTO> items = inventoryRecordSaveDTO.getItems();
|
||||
//计算主表总金额
|
||||
int sum = items.stream().mapToInt(InventoryRecordSaveItemDTO::getTotalAmount).sum();
|
||||
@@ -202,17 +200,17 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
)
|
||||
));
|
||||
//查询代办任务的task
|
||||
TaskQueryParamDto taskQueryParamDto = new TaskQueryParamDto();
|
||||
taskQueryParamDto.setProcessInstanceIds(processInstanceIds);
|
||||
taskQueryParamDto.setCurrent(1);
|
||||
taskQueryParamDto.setSize(processInstanceIds.size());
|
||||
R<Page<TaskDto>> pageR = remoteFlowApiFlowService.queryMineTask(taskQueryParamDto);
|
||||
Page<TaskDto> data = pageR.getData();
|
||||
|
||||
final Map<String, TaskDto> processInstanceIdMap = (data != null && !ObjectUtil.isEmpty(data.getRecords()))
|
||||
? data.getRecords().stream()
|
||||
.collect(Collectors.toMap(TaskDto::getProcessInstanceId, taskDto -> taskDto))
|
||||
: Collections.emptyMap();
|
||||
// TaskQueryParamDto taskQueryParamDto = new TaskQueryParamDto();
|
||||
// taskQueryParamDto.setProcessInstanceIds(processInstanceIds);
|
||||
// taskQueryParamDto.setCurrent(1);
|
||||
// taskQueryParamDto.setSize(processInstanceIds.size());
|
||||
// R<Page<TaskDto>> pageR = remoteFlowApiFlowService.queryMineTask(taskQueryParamDto);
|
||||
// Page<TaskDto> data = pageR.getData();
|
||||
//
|
||||
// final Map<String, TaskDto> processInstanceIdMap = (data != null && !ObjectUtil.isEmpty(data.getRecords()))
|
||||
// ? data.getRecords().stream()
|
||||
// .collect(Collectors.toMap(TaskDto::getProcessInstanceId, taskDto -> taskDto))
|
||||
// : Collections.emptyMap();
|
||||
|
||||
// 设置商品名称到主表实体
|
||||
records.forEach(plan -> {
|
||||
@@ -226,15 +224,15 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
String supplierName = supplierMap.getOrDefault(plan.getSupplierId(), new SmErpSupplierEntity()).getSupplierName();
|
||||
plan.setSupplierName(supplierName);
|
||||
|
||||
if (!processInstanceIdMap.isEmpty()) {
|
||||
TaskDto taskDto = processInstanceIdMap.get(plan.getProcessInstanceId());
|
||||
if (taskDto != null) {
|
||||
plan.setTaskId(taskDto.getTaskId());
|
||||
plan.setFlowId(taskDto.getFlowId());
|
||||
plan.setParamMap(taskDto.getParamMap());
|
||||
plan.setNodeId(taskDto.getNodeId());
|
||||
}
|
||||
}
|
||||
// if (!processInstanceIdMap.isEmpty()) {
|
||||
// TaskDto taskDto = processInstanceIdMap.get(plan.getProcessInstanceId());
|
||||
// if (taskDto != null) {
|
||||
// plan.setTaskId(taskDto.getTaskId());
|
||||
// plan.setFlowId(taskDto.getFlowId());
|
||||
// plan.setParamMap(taskDto.getParamMap());
|
||||
// plan.setNodeId(taskDto.getNodeId());
|
||||
// }
|
||||
// }
|
||||
});
|
||||
return pageData;
|
||||
}
|
||||
|
||||
+1
@@ -51,6 +51,7 @@ public class SmErpStockServiceImpl extends ServiceImpl<SmErpStockMapper, SmErpSt
|
||||
updateStockWithLockWrapper.eq(SmErpStockEntity::getVersion,smErpStockEntity.getVersion());
|
||||
SmErpStockEntity updateSmErpStockEntity = new SmErpStockEntity();
|
||||
updateSmErpStockEntity.setCurrentStock(smErpStockEntity.getCurrentStock()+item.getIncrCount());
|
||||
updateSmErpStockEntity.setVersion(smErpStockEntity.getVersion()+1);
|
||||
int update = baseMapper.update(updateSmErpStockEntity, updateStockWithLockWrapper);
|
||||
// 3. 检查更新结果
|
||||
if (update == 0) {
|
||||
|
||||
Reference in new issue
Block a user