From 08b84d7cbf160787795d6544c8446db6b8ab0c5a Mon Sep 17 00:00:00 2001 From: zjf <1799650030@qq.com> Date: Mon, 12 May 2025 17:13:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A3=9F=E5=A0=82=E8=BF=9B=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canteen/vo/erp/CanteenSpuSimpleVO.java | 32 +++++ .../canteen/vo/erp/ProductTemplateVO.java | 54 ++++++++ .../vo/erp/ProductionTemplateDetailVO.java | 59 +++++++++ .../CanteenProductionTemplateController.java | 123 ++++++++++++++++++ ...eenProductionTemplateDetailController.java | 119 +++++++++++++++++ .../controller/CanteenSpuController.java | 14 ++ ...CanteenProductionTemplateDetailEntity.java | 103 +++++++++++++++ .../CanteenProductionTemplateEntity.java | 104 +++++++++++++++ ...CanteenProductionTemplateDetailMapper.java | 11 ++ .../CanteenProductionTemplateMapper.java | 11 ++ ...anteenProductionTemplateDetailService.java | 8 ++ .../CanteenProductionTemplateService.java | 20 +++ .../canteen/service/CanteenSpuService.java | 3 + ...enProductionTemplateDetailServiceImpl.java | 16 +++ .../CanteenProductionTemplateServiceImpl.java | 99 ++++++++++++++ .../service/impl/CanteenSpuServiceImpl.java | 16 +++ .../CanteenProductionTemplateDetailMapper.xml | 20 +++ .../CanteenProductionTemplateMapper.xml | 19 +++ 18 files changed, 831 insertions(+) create mode 100644 pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/erp/CanteenSpuSimpleVO.java create mode 100644 pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/erp/ProductTemplateVO.java create mode 100644 pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/erp/ProductionTemplateDetailVO.java create mode 100644 pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenProductionTemplateController.java create mode 100644 pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenProductionTemplateDetailController.java create mode 100644 pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenProductionTemplateDetailEntity.java create mode 100644 pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenProductionTemplateEntity.java create mode 100644 pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/mapper/CanteenProductionTemplateDetailMapper.java create mode 100644 pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/mapper/CanteenProductionTemplateMapper.java create mode 100644 pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenProductionTemplateDetailService.java create mode 100644 pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenProductionTemplateService.java create mode 100644 pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenProductionTemplateDetailServiceImpl.java create mode 100644 pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenProductionTemplateServiceImpl.java create mode 100644 pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenProductionTemplateDetailMapper.xml create mode 100644 pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenProductionTemplateMapper.xml diff --git a/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/erp/CanteenSpuSimpleVO.java b/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/erp/CanteenSpuSimpleVO.java new file mode 100644 index 000000000..e6b435585 --- /dev/null +++ b/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/erp/CanteenSpuSimpleVO.java @@ -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; + + +} diff --git a/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/erp/ProductTemplateVO.java b/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/erp/ProductTemplateVO.java new file mode 100644 index 000000000..3bf633e09 --- /dev/null +++ b/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/erp/ProductTemplateVO.java @@ -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 canteenProductionTemplateDetailList; +} diff --git a/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/erp/ProductionTemplateDetailVO.java b/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/erp/ProductionTemplateDetailVO.java new file mode 100644 index 000000000..55e194998 --- /dev/null +++ b/pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/vo/erp/ProductionTemplateDetailVO.java @@ -0,0 +1,59 @@ +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; + +} \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenProductionTemplateController.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenProductionTemplateController.java new file mode 100644 index 000000000..f5ee6e088 --- /dev/null +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenProductionTemplateController.java @@ -0,0 +1,123 @@ +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 wrapper = Wrappers.lambdaQuery(); + wrapper.eq(StrUtil.isNotBlank(canteenProductionTemplate.getTemplateName()),CanteenProductionTemplateEntity::getTemplateName,canteenProductionTemplate.getTemplateName()); + return R.ok(canteenProductionTemplateService.page(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 export(CanteenProductionTemplateEntity canteenProductionTemplate,Long[] ids) { + return canteenProductionTemplateService.list(Wrappers.lambdaQuery(canteenProductionTemplate).in(ArrayUtil.isNotEmpty(ids), CanteenProductionTemplateEntity::getId, ids)); + } +} \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenProductionTemplateDetailController.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenProductionTemplateDetailController.java new file mode 100644 index 000000000..39f8d2c66 --- /dev/null +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenProductionTemplateDetailController.java @@ -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 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 export(CanteenProductionTemplateDetailEntity canteenProductionTemplateDetail,Long[] ids) { + return canteenProductionTemplateDetailService.list(Wrappers.lambdaQuery(canteenProductionTemplateDetail).in(ArrayUtil.isNotEmpty(ids), CanteenProductionTemplateDetailEntity::getId, ids)); + } +} \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenSpuController.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenSpuController.java index bc238cb9f..f6fb3872a 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenSpuController.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenSpuController.java @@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.bsd.pjcloud.canteen.dto.CanteenDailySpuDTO; import com.bsd.pjcloud.canteen.dto.CanteenSpuUpdateStockReqDTO; import com.bsd.pjcloud.canteen.entity.CanteenOnlineSpuEntity; +import com.bsd.pjcloud.canteen.vo.erp.CanteenSpuSimpleVO; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.log.annotation.SysLog; import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity; @@ -58,6 +59,19 @@ public class CanteenSpuController { } + /** + * 选择菜品分页查询 + * 1.生产加工模版选择菜品 + * @param page + * @param canteenSpu + * @return + */ + @Operation(summary = "生产加工模版选择菜品分页查询", description = "生产加工模版选择菜品分页查询") + @GetMapping("/getCanteenSpuSimplePage") + public R> getCanteenSpuSimplePage(@ParameterObject Page page, @ParameterObject CanteenSpuEntity canteenSpu) { + return R.ok(canteenSpuService.getCanteenSpuSimplePageScope(page, canteenSpu)); + } + /** * 每日分页查询 * diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenProductionTemplateDetailEntity.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenProductionTemplateDetailEntity.java new file mode 100644 index 000000000..41d737648 --- /dev/null +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenProductionTemplateDetailEntity.java @@ -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 { + + + /** + * 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; +} \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenProductionTemplateEntity.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenProductionTemplateEntity.java new file mode 100644 index 000000000..966d0a622 --- /dev/null +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenProductionTemplateEntity.java @@ -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 { + + + /** + * 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 canteenProductionTemplateDetailList; +} \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/mapper/CanteenProductionTemplateDetailMapper.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/mapper/CanteenProductionTemplateDetailMapper.java new file mode 100644 index 000000000..96bf755d3 --- /dev/null +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/mapper/CanteenProductionTemplateDetailMapper.java @@ -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 { + + +} \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/mapper/CanteenProductionTemplateMapper.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/mapper/CanteenProductionTemplateMapper.java new file mode 100644 index 000000000..a0758785f --- /dev/null +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/mapper/CanteenProductionTemplateMapper.java @@ -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 { + + +} \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenProductionTemplateDetailService.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenProductionTemplateDetailService.java new file mode 100644 index 000000000..6895ffc94 --- /dev/null +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenProductionTemplateDetailService.java @@ -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 { + +} \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenProductionTemplateService.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenProductionTemplateService.java new file mode 100644 index 000000000..e2a9b9a72 --- /dev/null +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenProductionTemplateService.java @@ -0,0 +1,20 @@ +package com.bsd.pjcloud.canteen.service; + +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 { + Boolean saveDeep(CanteenProductionTemplateEntity canteenProductionTemplate); + + Boolean updateDeep(CanteenProductionTemplateEntity canteenProductionTemplate); + + Boolean removeDeep(Long[] ids); + + Boolean removeChild(Long[] ids); + + + + ProductTemplateVO getDetailById(Long id); +} \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenSpuService.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenSpuService.java index 613151372..76f07d374 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenSpuService.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenSpuService.java @@ -6,6 +6,7 @@ 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.common.core.util.R; public interface CanteenSpuService extends IService { @@ -51,4 +52,6 @@ public interface CanteenSpuService extends IService { * @return */ Object pageDailyScope(Page page, CanteenDailySpuDTO canteenDailySpuDTO); + + Page getCanteenSpuSimplePageScope(Page page, CanteenSpuEntity canteenSpu); } \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenProductionTemplateDetailServiceImpl.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenProductionTemplateDetailServiceImpl.java new file mode 100644 index 000000000..b162c1482 --- /dev/null +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenProductionTemplateDetailServiceImpl.java @@ -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 implements CanteenProductionTemplateDetailService { +} \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenProductionTemplateServiceImpl.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenProductionTemplateServiceImpl.java new file mode 100644 index 000000000..22ae8e8db --- /dev/null +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenProductionTemplateServiceImpl.java @@ -0,0 +1,99 @@ +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.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 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.List; +import java.util.Objects; +/** + * 加工模版表 + * + * @author zjf + * @date 2025-05-12 13:41:26 + */ +@Service +@RequiredArgsConstructor +public class CanteenProductionTemplateServiceImpl extends ServiceImpl 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.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 canteenProductionTemplateDetailEntityLambdaQueryWrapper = new LambdaQueryWrapper<>(); + canteenProductionTemplateDetailEntityLambdaQueryWrapper.eq(CanteenProductionTemplateDetailEntity::getTemplateId, id); + List canteenProductionTemplateDetailEntities = canteenProductionTemplateDetailMapper.selectList(canteenProductionTemplateDetailEntityLambdaQueryWrapper); + ProductTemplateVO bean = BeanUtils.toBean(canteenProductionTemplateEntity, ProductTemplateVO.class); + bean.setDishName(canteenSpuEntity.getName()); + List productionTemplateDetailVOList= BeanUtils.toBean(canteenProductionTemplateDetailEntities, ProductionTemplateDetailVO.class); + for (ProductionTemplateDetailVO productionTemplateDetailVO : productionTemplateDetailVOList) { + Long materialId = productionTemplateDetailVO.getMaterialId(); + CanteenErpMaterialEntity canteenErpMaterialEntity = canteenErpMaterialMapper.selectById(materialId); + productionTemplateDetailVO.setMaterialName(canteenErpMaterialEntity.getName()); + } + bean.setCanteenProductionTemplateDetailList(productionTemplateDetailVOList); + return bean; + } +} \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenSpuServiceImpl.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenSpuServiceImpl.java index 55482a806..fb6cd69a3 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenSpuServiceImpl.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenSpuServiceImpl.java @@ -17,6 +17,7 @@ import com.bsd.pjcloud.canteen.mapper.CanteenSpuMapper; import com.bsd.pjcloud.canteen.service.CanteenDailyMenuService; import com.bsd.pjcloud.canteen.service.CanteenSpuService; import com.bsd.pjcloud.canteen.vo.ADCanteenSpuListVO; +import com.bsd.pjcloud.canteen.vo.erp.CanteenSpuSimpleVO; import com.bsd.pjcloud.common.core.util.BeanUtils; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.data.datascope.DataScope; @@ -133,5 +134,20 @@ public class CanteenSpuServiceImpl extends ServiceImpl getCanteenSpuSimplePageScope(Page page, CanteenSpuEntity canteenSpu) { + LambdaQueryWrapper 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 pageData = baseMapper.selectPageByScope(page, wrapper, DataScope.of()); + List canteenSpuSimpleVOList = BeanUtils.toBean(pageData.getRecords(), CanteenSpuSimpleVO.class); + Page canteenSpuSimpleVOPage = new Page<>(); + canteenSpuSimpleVOPage.setRecords(canteenSpuSimpleVOList); + org.springframework.beans.BeanUtils.copyProperties(pageData, pageData, "records"); // 复制分页参数 + return canteenSpuSimpleVOPage; + } + } \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenProductionTemplateDetailMapper.xml b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenProductionTemplateDetailMapper.xml new file mode 100644 index 000000000..c7d65b365 --- /dev/null +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenProductionTemplateDetailMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenProductionTemplateMapper.xml b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenProductionTemplateMapper.xml new file mode 100644 index 000000000..fee5abfc2 --- /dev/null +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenProductionTemplateMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file