Merge branch 'master' of https://gitea.zianxin.com/zax/biz-api-cloud-zax
This commit is contained in:
commit
5e97b3a4d4
22 files changed
+2004
No files matched your search
+30
@@ -0,0 +1,30 @@
|
||||
package com.bsd.pjcloud.canteen.constants;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 报餐状态
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CanteenOrderingFoodStatus {
|
||||
BOOKED(0, "已报餐"),
|
||||
CANCELLED(1, "已取消"),
|
||||
VERIFIED(2, "已核销");
|
||||
|
||||
private final int code;
|
||||
private final String label;
|
||||
|
||||
public static CanteenOrderingFoodStatus ofCode(Integer code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
for (CanteenOrderingFoodStatus s : values()) {
|
||||
if (s.code == code) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.bsd.pjcloud.canteen.dto.ordering;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@Schema(description = "报餐日期餐段选择")
|
||||
public class OrderingFoodSelectionDTO {
|
||||
|
||||
@NotNull(message = "就餐日期不能为空")
|
||||
@Schema(description = "就餐日期 yyyy-MM-dd")
|
||||
private LocalDate diningDate;
|
||||
|
||||
@NotNull(message = "餐段不能为空")
|
||||
@Schema(description = "餐段序号(对应 meal-segments 返回的 segmentIndex)")
|
||||
private Integer segmentIndex;
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.bsd.pjcloud.canteen.dto.ordering;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@Schema(description = "报餐明细项(一次提交内的一条日期+餐段)")
|
||||
public class OrderingFoodSelectionItemDTO {
|
||||
|
||||
@Schema(description = "就餐日期")
|
||||
private LocalDate diningDate;
|
||||
|
||||
@Schema(description = "餐段序号")
|
||||
private Integer segmentIndex;
|
||||
|
||||
@Schema(description = "餐段类型 1早餐 2午餐 3晚餐 4宵夜")
|
||||
private Integer mealSegmentType;
|
||||
|
||||
@Schema(description = "餐段名称")
|
||||
private String mealSegmentName;
|
||||
|
||||
@Schema(description = "餐段开始 HH:mm")
|
||||
private String segmentStartTime;
|
||||
|
||||
@Schema(description = "餐段结束 HH:mm")
|
||||
private String segmentEndTime;
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.bsd.pjcloud.canteen.dto.ordering;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "报餐所选菜品项")
|
||||
public class OrderingFoodSpuItemDTO {
|
||||
|
||||
@NotNull(message = "菜品ID不能为空")
|
||||
@Schema(description = "线上菜品ID")
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "菜品名称不能为空")
|
||||
@Schema(description = "菜品名称")
|
||||
private String name;
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.bsd.pjcloud.canteen.dto.ordering;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "提交报餐")
|
||||
public class OrderingFoodSubmitDTO {
|
||||
|
||||
@NotBlank
|
||||
@Schema(description = "商户ID")
|
||||
private String merchantId;
|
||||
|
||||
@NotNull(message = "请填写报餐人数")
|
||||
@Min(value = 1, message = "报餐人数至少为1")
|
||||
@Schema(description = "报餐人数")
|
||||
private Integer peopleCount;
|
||||
|
||||
@Schema(description = "备注(选填)")
|
||||
private String remark;
|
||||
|
||||
@NotEmpty(message = "请选择报餐菜品")
|
||||
@Valid
|
||||
@Schema(description = "所选菜品(至少一项)")
|
||||
private List<OrderingFoodSpuItemDTO> spuItems;
|
||||
|
||||
@NotEmpty(message = "请选择报餐日期与餐段")
|
||||
@Valid
|
||||
@Schema(description = "报餐选择(支持未来7天多餐段批量)")
|
||||
private List<OrderingFoodSelectionDTO> selections;
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package com.bsd.pjcloud.canteen.entity;
|
||||
|
||||
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.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("canteen_ordering_food")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "食堂报餐记录")
|
||||
public class CanteenOrderingFoodEntity extends Model<CanteenOrderingFoodEntity> {
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
private Long tenantId;
|
||||
private Long deptId;
|
||||
private String merchantId;
|
||||
private String merchantName;
|
||||
private Long userId;
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "就餐开始日期(多选时取最早)")
|
||||
private LocalDate diningDate;
|
||||
|
||||
@Schema(description = "就餐结束日期(多选时取最晚,单日与 diningDate 相同)")
|
||||
private LocalDate diningDateEnd;
|
||||
|
||||
@Schema(description = "本单日期餐段条数")
|
||||
private Integer selectionCount;
|
||||
|
||||
@Schema(description = "报餐明细JSON")
|
||||
private String selectionsJson;
|
||||
|
||||
@Schema(description = "就餐摘要")
|
||||
private String summaryText;
|
||||
|
||||
@Schema(description = "餐段序号(兼容旧数据单条)")
|
||||
private Integer mealSegmentIndex;
|
||||
|
||||
@Schema(description = "餐段类型 1早餐 2午餐 3晚餐 4宵夜")
|
||||
private Integer mealSegmentType;
|
||||
|
||||
private String mealSegmentName;
|
||||
private String segmentStartTime;
|
||||
private String segmentEndTime;
|
||||
|
||||
@Schema(description = "报餐人数")
|
||||
private Integer peopleCount;
|
||||
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "所选菜品JSON")
|
||||
private String spuItemsJson;
|
||||
|
||||
@Schema(description = "0已报餐 1已取消 2已核销")
|
||||
private Integer status;
|
||||
|
||||
private LocalDateTime cancelTime;
|
||||
private LocalDateTime verifyTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String delFlag;
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.bsd.pjcloud.canteen.vo.app;
|
||||
|
||||
import com.bsd.pjcloud.canteen.dto.ordering.OrderingFoodSelectionItemDTO;
|
||||
import com.bsd.pjcloud.canteen.dto.ordering.OrderingFoodSpuItemDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "报餐记录(App)")
|
||||
public class OrderingFoodAppVO {
|
||||
|
||||
private Long id;
|
||||
private String merchantId;
|
||||
private String merchantName;
|
||||
private Long userId;
|
||||
private String userName;
|
||||
private LocalDate diningDate;
|
||||
private LocalDate diningDateEnd;
|
||||
private Integer selectionCount;
|
||||
private String summaryText;
|
||||
private List<OrderingFoodSelectionItemDTO> selections;
|
||||
private Integer mealSegmentIndex;
|
||||
private Integer mealSegmentType;
|
||||
private String mealSegmentName;
|
||||
private String segmentStartTime;
|
||||
private String segmentEndTime;
|
||||
private Integer peopleCount;
|
||||
private String remark;
|
||||
private List<OrderingFoodSpuItemDTO> spuItems;
|
||||
private Integer status;
|
||||
private String statusLabel;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime cancelTime;
|
||||
private LocalDateTime verifyTime;
|
||||
private Boolean canCancel;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.bsd.pjcloud.canteen.vo.app;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "报餐餐段(来自商户营业时间)")
|
||||
public class OrderingFoodMealSegmentVO {
|
||||
|
||||
@Schema(description = "餐段序号(提交报餐时用)")
|
||||
private Integer segmentIndex;
|
||||
|
||||
@Schema(description = "餐段类型 1早餐 2午餐 3晚餐 4宵夜")
|
||||
private Integer mealSegmentType;
|
||||
|
||||
@Schema(description = "餐段名称")
|
||||
private String mealSegmentName;
|
||||
|
||||
@Schema(description = "开始时间 HH:mm")
|
||||
private String startTime;
|
||||
|
||||
@Schema(description = "结束时间 HH:mm")
|
||||
private String endTime;
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.bsd.pjcloud.canteen.vo.app;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "报餐统计-某日详情")
|
||||
public class OrderingFoodStatsDayDetailVO {
|
||||
|
||||
@Schema(description = "日期 yyyy-MM-dd")
|
||||
private String diningDate;
|
||||
|
||||
@Schema(description = "商户ID")
|
||||
private String merchantId;
|
||||
|
||||
@Schema(description = "商户名称")
|
||||
private String merchantName;
|
||||
|
||||
@Schema(description = "当日报餐人数合计")
|
||||
private Long totalPeopleCount;
|
||||
|
||||
@Schema(description = "各餐段明细")
|
||||
private List<OrderingFoodStatsSegmentDetailVO> segments;
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.bsd.pjcloud.canteen.vo.app;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "报餐统计-菜品份数")
|
||||
public class OrderingFoodStatsDishItemVO {
|
||||
|
||||
@Schema(description = "菜品ID")
|
||||
private Long spuId;
|
||||
|
||||
@Schema(description = "菜品名称")
|
||||
private String spuName;
|
||||
|
||||
@Schema(description = "份数(按报餐人数累计)")
|
||||
private Long portionCount;
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.bsd.pjcloud.canteen.vo.app;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "报餐统计导出-菜品合计")
|
||||
public class OrderingFoodStatsDishTotalExportVO {
|
||||
|
||||
@ExcelProperty("菜品名称")
|
||||
private String spuName;
|
||||
|
||||
@ExcelProperty("份数合计")
|
||||
private Long portionCount;
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.bsd.pjcloud.canteen.vo.app;
|
||||
|
||||
import com.bsd.pjcloud.canteen.dto.ordering.OrderingFoodSpuItemDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "报餐统计-明细记录")
|
||||
public class OrderingFoodStatsRecordBriefVO {
|
||||
|
||||
@Schema(description = "报餐记录ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "报餐人")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "报餐人数")
|
||||
private Integer peopleCount;
|
||||
|
||||
@Schema(description = "所选菜品")
|
||||
private List<OrderingFoodSpuItemDTO> spuItems;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.bsd.pjcloud.canteen.vo.app;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "报餐统计行(按日)")
|
||||
public class OrderingFoodStatsRowVO {
|
||||
|
||||
@ExcelProperty("日期")
|
||||
@Schema(description = "日期 yyyy-MM-dd")
|
||||
private String diningDate;
|
||||
|
||||
@ExcelIgnore
|
||||
@Schema(description = "各餐段人数(动态,来自商户 jobTime)")
|
||||
private List<OrderingFoodStatsSegmentCountVO> segmentCounts;
|
||||
|
||||
@ExcelProperty("早餐")
|
||||
private Long breakfastCount;
|
||||
|
||||
@ExcelProperty("午餐")
|
||||
private Long lunchCount;
|
||||
|
||||
@ExcelProperty("晚餐")
|
||||
private Long dinnerCount;
|
||||
|
||||
@ExcelProperty("宵夜")
|
||||
private Long midnightSnackCount;
|
||||
|
||||
@ExcelProperty("合计人数")
|
||||
private Long totalPeopleCount;
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.bsd.pjcloud.canteen.vo.app;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "报餐统计-餐段人数")
|
||||
public class OrderingFoodStatsSegmentCountVO {
|
||||
|
||||
@Schema(description = "餐段序号")
|
||||
private Integer segmentIndex;
|
||||
|
||||
@Schema(description = "餐段类型 1早餐 2午餐 3晚餐 4宵夜")
|
||||
private Integer mealSegmentType;
|
||||
|
||||
@Schema(description = "餐段名称")
|
||||
private String mealSegmentName;
|
||||
|
||||
@Schema(description = "报餐人数合计")
|
||||
private Long peopleCount;
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.bsd.pjcloud.canteen.vo.app;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "报餐统计-某日餐段明细")
|
||||
public class OrderingFoodStatsSegmentDetailVO {
|
||||
|
||||
@Schema(description = "餐段序号")
|
||||
private Integer segmentIndex;
|
||||
|
||||
@Schema(description = "餐段名称")
|
||||
private String mealSegmentName;
|
||||
|
||||
@Schema(description = "开始时间 HH:mm")
|
||||
private String startTime;
|
||||
|
||||
@Schema(description = "结束时间 HH:mm")
|
||||
private String endTime;
|
||||
|
||||
@Schema(description = "报餐人数合计")
|
||||
private Long peopleCount;
|
||||
|
||||
@Schema(description = "报餐笔数")
|
||||
private Long recordCount;
|
||||
|
||||
@Schema(description = "菜品份数汇总")
|
||||
private List<OrderingFoodStatsDishItemVO> dishes;
|
||||
|
||||
@Schema(description = "报餐明细")
|
||||
private List<OrderingFoodStatsRecordBriefVO> records;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.bsd.pjcloud.canteen.vo.app;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "报餐统计导出-餐段菜品明细")
|
||||
public class OrderingFoodStatsSegmentDishExportVO {
|
||||
|
||||
@ExcelProperty("日期")
|
||||
private String diningDate;
|
||||
|
||||
@ExcelProperty("餐段")
|
||||
private String mealSegmentName;
|
||||
|
||||
@ExcelProperty("时段")
|
||||
private String segmentTime;
|
||||
|
||||
@ExcelProperty("菜品名称")
|
||||
private String spuName;
|
||||
|
||||
@ExcelProperty("份数")
|
||||
private Long portionCount;
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.bsd.pjcloud.canteen.vo.app;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "报餐统计汇总")
|
||||
public class OrderingFoodStatsSummaryVO {
|
||||
|
||||
@Schema(description = "商户ID")
|
||||
private String merchantId;
|
||||
|
||||
@Schema(description = "商户名称")
|
||||
private String merchantName;
|
||||
|
||||
@Schema(description = "报餐记录条数(未取消)")
|
||||
private Long recordCount;
|
||||
|
||||
@Schema(description = "报餐人数合计(people_count求和)")
|
||||
private Long totalPeopleCount;
|
||||
|
||||
@Schema(description = "商户餐段配置(动态表头)")
|
||||
private List<OrderingFoodMealSegmentVO> segments;
|
||||
|
||||
@Schema(description = "按日统计行")
|
||||
private List<OrderingFoodStatsRowVO> rows;
|
||||
}
|
||||
+244
@@ -0,0 +1,244 @@
|
||||
package com.bsd.pjcloud.canteen.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.canteen.dto.ordering.OrderingFoodSubmitDTO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenOrderingFoodEntity;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenOrderingFoodService;
|
||||
import com.bsd.pjcloud.canteen.vo.app.OrderingFoodAppVO;
|
||||
import com.bsd.pjcloud.canteen.vo.app.OrderingFoodMealSegmentVO;
|
||||
import com.bsd.pjcloud.canteen.vo.app.OrderingFoodStatsDayDetailVO;
|
||||
import com.bsd.pjcloud.canteen.vo.app.OrderingFoodStatsRowVO;
|
||||
import com.bsd.pjcloud.canteen.vo.app.OrderingFoodStatsSummaryVO;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import com.bsd.pjcloud.common.excel.annotation.Sheet;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 食堂报餐(移动端)
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/canteenOrderingFood")
|
||||
@Tag(name = "食堂报餐")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class CanteenOrderingFoodController {
|
||||
|
||||
private final CanteenOrderingFoodService canteenOrderingFoodService;
|
||||
|
||||
@GetMapping("/app/meal-segments")
|
||||
@Operation(summary = "报餐餐段列表", description = "根据商户营业时间 jobTime 解析餐段(早餐/午餐/晚餐/宵夜)")
|
||||
public R<List<OrderingFoodMealSegmentVO>> mealSegments(@RequestParam String merchantId) {
|
||||
return canteenOrderingFoodService.listMealSegments(merchantId);
|
||||
}
|
||||
|
||||
@GetMapping("/app/next-seven-days")
|
||||
@Operation(summary = "可报餐日期", description = "从今天起连续7天 yyyy-MM-dd")
|
||||
public R<List<String>> nextSevenDays() {
|
||||
return canteenOrderingFoodService.listNextSevenDays();
|
||||
}
|
||||
|
||||
@SysLog("提交报餐")
|
||||
@PostMapping("/app/submit")
|
||||
@Operation(summary = "提交报餐", description = "支持批量选择未来7天内多个日期餐段")
|
||||
public R<Integer> submit(@Valid @RequestBody OrderingFoodSubmitDTO dto) {
|
||||
return canteenOrderingFoodService.submit(dto);
|
||||
}
|
||||
|
||||
@GetMapping("/app/my/page")
|
||||
@Operation(summary = "我的报餐记录", description = "分页:current、size;可选 startDate、endDate")
|
||||
public R<Page<OrderingFoodAppVO>> myPage(
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate,
|
||||
@ParameterObject Page<CanteenOrderingFoodEntity> page) {
|
||||
return canteenOrderingFoodService.pageMyRecords(startDate, endDate, page);
|
||||
}
|
||||
|
||||
@GetMapping("/app/my/{id}")
|
||||
@Operation(summary = "我的报餐详情")
|
||||
public R<OrderingFoodAppVO> myDetail(@PathVariable Long id) {
|
||||
return canteenOrderingFoodService.detailMyRecord(id);
|
||||
}
|
||||
|
||||
@SysLog("取消报餐")
|
||||
@PostMapping("/app/my/cancel/{id}")
|
||||
@Operation(summary = "取消报餐")
|
||||
public R<Void> cancel(@PathVariable Long id) {
|
||||
return canteenOrderingFoodService.cancelMyRecord(id);
|
||||
}
|
||||
|
||||
@GetMapping("/app/mch/stats")
|
||||
@Operation(summary = "商户报餐统计", description = "仅商户角色;按日汇总各餐段报餐人数")
|
||||
public R<OrderingFoodStatsSummaryVO> mchStats(
|
||||
@RequestParam(required = false) String merchantId,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate,
|
||||
@RequestParam(required = false) Long deptId,
|
||||
@RequestParam(required = false) Long userId) {
|
||||
return canteenOrderingFoodService.statsForMerchant(merchantId, startDate, endDate, deptId, userId);
|
||||
}
|
||||
|
||||
@ResponseExcel(name = "报餐统计", sheets = {
|
||||
@Sheet(sheetName = "每日统计"),
|
||||
@Sheet(sheetName = "菜品合计")
|
||||
})
|
||||
@GetMapping("/app/mch/stats/export")
|
||||
@Operation(summary = "商户报餐统计导出Excel", description = "Sheet1 每日餐段人数;Sheet2 筛选范围内各菜品份数合计")
|
||||
public List<List<?>> mchStatsExport(
|
||||
@RequestParam(required = false) String merchantId,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate,
|
||||
@RequestParam(required = false) Long deptId,
|
||||
@RequestParam(required = false) Long userId) {
|
||||
return canteenOrderingFoodService.exportStatsForMerchant(merchantId, startDate, endDate, deptId, userId);
|
||||
}
|
||||
|
||||
@GetMapping("/app/mch/stats/detail")
|
||||
@Operation(summary = "商户报餐统计-某日详情", description = "按餐段汇总人数与菜品份数;segmentIndex 可选,仅查看某一餐段")
|
||||
public R<OrderingFoodStatsDayDetailVO> mchStatsDetail(
|
||||
@RequestParam(required = false) String merchantId,
|
||||
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate diningDate,
|
||||
@RequestParam(required = false) Long deptId,
|
||||
@RequestParam(required = false) Long userId,
|
||||
@RequestParam(required = false) Integer segmentIndex) {
|
||||
return canteenOrderingFoodService.statsDayDetailForMerchant(merchantId, diningDate, deptId, userId, segmentIndex);
|
||||
}
|
||||
|
||||
@ResponseExcel(name = "报餐日详情", sheets = {
|
||||
@Sheet(sheetName = "餐段菜品"),
|
||||
@Sheet(sheetName = "菜品合计")
|
||||
})
|
||||
@GetMapping("/app/mch/stats/detail/export")
|
||||
@Operation(summary = "商户报餐统计-某日详情导出", description = "Sheet1 各餐段菜品份数;Sheet2 当日内各菜品份数合计")
|
||||
public List<List<?>> mchStatsDetailExport(
|
||||
@RequestParam(required = false) String merchantId,
|
||||
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate diningDate,
|
||||
@RequestParam(required = false) Long deptId,
|
||||
@RequestParam(required = false) Long userId,
|
||||
@RequestParam(required = false) Integer segmentIndex) {
|
||||
return canteenOrderingFoodService.exportStatsDayDetailForMerchant(merchantId, diningDate, deptId, userId, segmentIndex);
|
||||
}
|
||||
|
||||
@GetMapping("/app/mch/filter-depts")
|
||||
@Operation(summary = "统计筛选-部门列表")
|
||||
public R<List<SysDept>> filterDepts() {
|
||||
return canteenOrderingFoodService.filterDeptsForMerchant();
|
||||
}
|
||||
|
||||
@GetMapping("/app/mch/filter-users")
|
||||
@Operation(summary = "统计筛选-员工列表", description = "deptId 为空时取当前用户部门及下级全部用户")
|
||||
public R<List<SysUser>> filterUsers(@RequestParam(required = false) Long deptId) {
|
||||
return canteenOrderingFoodService.filterUsersForMerchant(deptId);
|
||||
}
|
||||
|
||||
// ---------- PC 后台 ----------
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "PC-报餐记录分页", description = "按商户、就餐日期、部门、员工、状态筛选;日期范围最多31天")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOrderingFoodRecord_view')")
|
||||
public R<Page<OrderingFoodAppVO>> adminPage(
|
||||
@RequestParam String merchantId,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate,
|
||||
@RequestParam(required = false) Long deptId,
|
||||
@RequestParam(required = false) Long userId,
|
||||
@RequestParam(required = false) String userName,
|
||||
@RequestParam(required = false) Integer status,
|
||||
@ParameterObject Page<CanteenOrderingFoodEntity> page) {
|
||||
return canteenOrderingFoodService.pageAdminRecords(merchantId, startDate, endDate, deptId, userId, userName,
|
||||
status, page);
|
||||
}
|
||||
|
||||
@GetMapping("/detail/{id}")
|
||||
@Operation(summary = "PC-报餐记录详情")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOrderingFoodRecord_view')")
|
||||
public R<OrderingFoodAppVO> adminDetail(@PathVariable Long id) {
|
||||
return canteenOrderingFoodService.adminRecordDetail(id);
|
||||
}
|
||||
|
||||
@GetMapping("/stats")
|
||||
@Operation(summary = "PC-报餐统计", description = "按日汇总各餐段人数;startDate/endDate 最多31天")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOrderingFoodStats_view')")
|
||||
public R<OrderingFoodStatsSummaryVO> adminStats(
|
||||
@RequestParam String merchantId,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate,
|
||||
@RequestParam(required = false) Long deptId,
|
||||
@RequestParam(required = false) Long userId) {
|
||||
return canteenOrderingFoodService.statsForAdmin(merchantId, startDate, endDate, deptId, userId);
|
||||
}
|
||||
|
||||
@ResponseExcel(name = "报餐统计", sheets = {
|
||||
@Sheet(sheetName = "每日统计"),
|
||||
@Sheet(sheetName = "菜品合计")
|
||||
})
|
||||
@GetMapping("/stats/export")
|
||||
@Operation(summary = "PC-报餐统计导出")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOrderingFoodStats_export')")
|
||||
public List<List<?>> adminStatsExport(
|
||||
@RequestParam String merchantId,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate,
|
||||
@RequestParam(required = false) Long deptId,
|
||||
@RequestParam(required = false) Long userId) {
|
||||
return canteenOrderingFoodService.exportStatsForAdmin(merchantId, startDate, endDate, deptId, userId);
|
||||
}
|
||||
|
||||
@GetMapping("/stats/detail")
|
||||
@Operation(summary = "PC-报餐统计某日详情")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOrderingFoodStats_view')")
|
||||
public R<OrderingFoodStatsDayDetailVO> adminStatsDetail(
|
||||
@RequestParam String merchantId,
|
||||
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate diningDate,
|
||||
@RequestParam(required = false) Long deptId,
|
||||
@RequestParam(required = false) Long userId,
|
||||
@RequestParam(required = false) Integer segmentIndex) {
|
||||
return canteenOrderingFoodService.statsDayDetailForAdmin(merchantId, diningDate, deptId, userId, segmentIndex);
|
||||
}
|
||||
|
||||
@ResponseExcel(name = "报餐日详情", sheets = {
|
||||
@Sheet(sheetName = "餐段菜品"),
|
||||
@Sheet(sheetName = "菜品合计")
|
||||
})
|
||||
@GetMapping("/stats/detail/export")
|
||||
@Operation(summary = "PC-报餐统计某日详情导出")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOrderingFoodStats_export')")
|
||||
public List<List<?>> adminStatsDetailExport(
|
||||
@RequestParam String merchantId,
|
||||
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate diningDate,
|
||||
@RequestParam(required = false) Long deptId,
|
||||
@RequestParam(required = false) Long userId,
|
||||
@RequestParam(required = false) Integer segmentIndex) {
|
||||
return canteenOrderingFoodService.exportStatsDayDetailForAdmin(merchantId, diningDate, deptId, userId,
|
||||
segmentIndex);
|
||||
}
|
||||
|
||||
@GetMapping("/filter-depts")
|
||||
@Operation(summary = "PC-筛选部门列表")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOrderingFoodRecord_view') or @pms.hasPermission('canteen_canteenOrderingFoodStats_view')")
|
||||
public R<List<SysDept>> adminFilterDepts() {
|
||||
return canteenOrderingFoodService.filterDeptsForAdmin();
|
||||
}
|
||||
|
||||
@GetMapping("/filter-users")
|
||||
@Operation(summary = "PC-筛选员工列表")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOrderingFoodRecord_view') or @pms.hasPermission('canteen_canteenOrderingFoodStats_view')")
|
||||
public R<List<SysUser>> adminFilterUsers(@RequestParam(required = false) Long deptId) {
|
||||
return canteenOrderingFoodService.filterUsersForAdmin(deptId);
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.bsd.pjcloud.canteen.mapper;
|
||||
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenOrderingFoodEntity;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CanteenOrderingFoodMapper extends PjcloudBaseMapper<CanteenOrderingFoodEntity> {
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
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.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.canteen.dto.ordering.OrderingFoodSubmitDTO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenOrderingFoodEntity;
|
||||
import com.bsd.pjcloud.canteen.vo.app.OrderingFoodAppVO;
|
||||
import com.bsd.pjcloud.canteen.vo.app.OrderingFoodMealSegmentVO;
|
||||
import com.bsd.pjcloud.canteen.vo.app.OrderingFoodStatsDayDetailVO;
|
||||
import com.bsd.pjcloud.canteen.vo.app.OrderingFoodStatsRowVO;
|
||||
import com.bsd.pjcloud.canteen.vo.app.OrderingFoodStatsSummaryVO;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
public interface CanteenOrderingFoodService extends IService<CanteenOrderingFoodEntity> {
|
||||
|
||||
R<List<OrderingFoodMealSegmentVO>> listMealSegments(String merchantId);
|
||||
|
||||
R<List<String>> listNextSevenDays();
|
||||
|
||||
R<Integer> submit(OrderingFoodSubmitDTO dto);
|
||||
|
||||
R<Page<OrderingFoodAppVO>> pageMyRecords(LocalDate startDate, LocalDate endDate, Page<CanteenOrderingFoodEntity> page);
|
||||
|
||||
R<OrderingFoodAppVO> detailMyRecord(Long id);
|
||||
|
||||
R<Void> cancelMyRecord(Long id);
|
||||
|
||||
R<OrderingFoodStatsSummaryVO> statsForMerchant(String merchantId, LocalDate startDate, LocalDate endDate,
|
||||
Long deptId, Long userId);
|
||||
|
||||
List<List<?>> exportStatsForMerchant(String merchantId, LocalDate startDate, LocalDate endDate,
|
||||
Long deptId, Long userId);
|
||||
|
||||
List<List<?>> exportStatsDayDetailForMerchant(String merchantId, LocalDate diningDate,
|
||||
Long deptId, Long userId, Integer segmentIndex);
|
||||
|
||||
R<OrderingFoodStatsDayDetailVO> statsDayDetailForMerchant(String merchantId, LocalDate diningDate,
|
||||
Long deptId, Long userId, Integer segmentIndex);
|
||||
|
||||
R<List<SysDept>> filterDeptsForMerchant();
|
||||
|
||||
R<List<SysUser>> filterUsersForMerchant(Long deptId);
|
||||
|
||||
/** PC 后台:报餐记录分页(本部门及下级商户范围) */
|
||||
R<Page<OrderingFoodAppVO>> pageAdminRecords(String merchantId, LocalDate startDate, LocalDate endDate,
|
||||
Long deptId, Long userId, String userName, Integer status,
|
||||
Page<CanteenOrderingFoodEntity> page);
|
||||
|
||||
R<OrderingFoodAppVO> adminRecordDetail(Long id);
|
||||
|
||||
R<OrderingFoodStatsSummaryVO> statsForAdmin(String merchantId, LocalDate startDate, LocalDate endDate,
|
||||
Long deptId, Long userId);
|
||||
|
||||
List<List<?>> exportStatsForAdmin(String merchantId, LocalDate startDate, LocalDate endDate,
|
||||
Long deptId, Long userId);
|
||||
|
||||
R<OrderingFoodStatsDayDetailVO> statsDayDetailForAdmin(String merchantId, LocalDate diningDate,
|
||||
Long deptId, Long userId, Integer segmentIndex);
|
||||
|
||||
List<List<?>> exportStatsDayDetailForAdmin(String merchantId, LocalDate diningDate,
|
||||
Long deptId, Long userId, Integer segmentIndex);
|
||||
|
||||
R<List<SysDept>> filterDeptsForAdmin();
|
||||
|
||||
R<List<SysUser>> filterUsersForAdmin(Long deptId);
|
||||
}
|
||||
+1157
File diff suppressed because it is too large.
Load diff
+6
@@ -35,4 +35,10 @@ public interface CommonRoleConstant {
|
||||
// 智能柜管理员
|
||||
String HARD_DOOR_ADMIN_USER = "HARD_DOOR_ADMIN";
|
||||
|
||||
/** 线上食堂商户(移动端:商品/商家/报餐统计) */
|
||||
String ONLINE_CANTEEN_MCH = "ONLINE_CANTEEN_MCH";
|
||||
|
||||
/** 食堂骑手(移动端配送) */
|
||||
String CANTEEN_RIDER = "CANTEEN_RIDER";
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user