Compare commits
75 Commits
534afeded6
...
test
| Author | SHA1 | Date | |
|---|---|---|---|
| b854c9bc0f | |||
| 5e40f91bea | |||
| 1e172e75d2 | |||
| 03ad0e80cf | |||
| 5cdcd55cbb | |||
| 999b3b918c | |||
| c705265047 | |||
| 821f3c58e6 | |||
| c3fb4258d2 | |||
| f53fb1d916 | |||
| 46b4ee45d4 | |||
| dbab56b200 | |||
| 4239fba23e | |||
| 9b48d49904 | |||
| a2839952b4 | |||
| b51f8be25b | |||
| 9a6bacd3c7 | |||
| 5e8712a93b | |||
| 7511cb0ba8 | |||
| 75b2db320f | |||
| a9d35cb954 | |||
| cef7e5315a | |||
| 710cca65d6 | |||
| 2b3b76f6ef | |||
| ce2136b3cb | |||
| 45fbdd514e | |||
| 44f896168f | |||
| c37b4b3601 | |||
| c1c7cbba7b | |||
| 85bc610c10 | |||
| 3fd7a74356 | |||
| b547283358 | |||
| 5a23f37939 | |||
| b5b8e7c4a8 | |||
| a259855d01 | |||
| 3041ef94e1 | |||
| 74a49426a6 | |||
| 75f2eebf7e | |||
| ca83a3a8a2 | |||
| 6447e4218f | |||
| 69cdc8d5cb | |||
| e789edf637 | |||
| 48d05dda32 | |||
| 3fe532ee7d | |||
| 0e600d76f8 | |||
| c4b93b6a5b | |||
| 4948e6e7c8 | |||
| 9fb67730a9 | |||
| ae6caa85a0 | |||
| 060d493ebc | |||
| b65080926c | |||
| 98e11c02aa | |||
| 3b1fa812db | |||
| a0fffc8ccb | |||
| b0f0aec94b | |||
| 7e698eee0d | |||
| 799167a26b | |||
| 86fdcaf8a0 | |||
| a1fe1bac16 | |||
| 084baf89b1 | |||
| 3448331b31 | |||
| caec6b2d0f | |||
| 4116f7cc0d | |||
| fa33586aae | |||
| ff27979337 | |||
| 29681c0ae2 | |||
| be476453a4 | |||
| 49a15e33a9 | |||
| 2a9a9d0438 | |||
| 65bd5b7ed9 | |||
| 7b948b514a | |||
| be37a2d92b | |||
| bf8be19afd | |||
| 06fa5b4f0d | |||
| 3b15bc444b |
@@ -7,7 +7,6 @@ import com.czg.account.service.HandoverRecordService;
|
|||||||
import com.czg.account.vo.HandoverProductListVo;
|
import com.czg.account.vo.HandoverProductListVo;
|
||||||
import com.czg.account.vo.HandoverTotalVo;
|
import com.czg.account.vo.HandoverTotalVo;
|
||||||
import com.czg.annotation.SaAdminCheckPermission;
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
import com.czg.constants.SystemConstants;
|
|
||||||
import com.czg.excel.ExcelExportUtil;
|
import com.czg.excel.ExcelExportUtil;
|
||||||
import com.czg.log.annotation.OperationLog;
|
import com.czg.log.annotation.OperationLog;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
@@ -38,7 +37,6 @@ public class HandoverRecordController {
|
|||||||
* @param endDate 结束时间 格式:yyyy-MM-dd
|
* @param endDate 结束时间 格式:yyyy-MM-dd
|
||||||
*/
|
*/
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@OperationLog("交班记录-分页")
|
|
||||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:page", name = "交班记录-分页")
|
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:page", name = "交班记录-分页")
|
||||||
public CzgResult<Page<HandoverRecordDTO>> page(@RequestParam(required = false) String beginDate, @RequestParam(required = false) String endDate) {
|
public CzgResult<Page<HandoverRecordDTO>> page(@RequestParam(required = false) String beginDate, @RequestParam(required = false) String endDate) {
|
||||||
Page<HandoverRecordDTO> page = handoverRecordService.getHandoverRecordPage(beginDate, endDate);
|
Page<HandoverRecordDTO> page = handoverRecordService.getHandoverRecordPage(beginDate, endDate);
|
||||||
@@ -46,20 +44,33 @@ public class HandoverRecordController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 交班记录-查看
|
* 交班记录-详情
|
||||||
|
*
|
||||||
|
* @param id 交班记录ID
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail/{id}")
|
||||||
|
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:detail", name = "交班记录-详情")
|
||||||
|
public CzgResult<HandoverRecordDTO> detail(@PathVariable Long id) {
|
||||||
|
HandoverRecord entity = handoverRecordService.getById(id);
|
||||||
|
HandoverRecordDTO data = BeanUtil.copyProperties(entity, HandoverRecordDTO.class);
|
||||||
|
return CzgResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交班记录-商品详情
|
||||||
*
|
*
|
||||||
* @param id 交班记录ID
|
* @param id 交班记录ID
|
||||||
*/
|
*/
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
@OperationLog("交班记录-查看")
|
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:detail", name = "交班记录-详情")
|
||||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:info", name = "交班记录-查看")
|
|
||||||
public CzgResult<List<HandoverProductListVo>> info(@PathVariable Long id) {
|
public CzgResult<List<HandoverProductListVo>> info(@PathVariable Long id) {
|
||||||
List<HandoverProductListVo> data = handoverRecordService.getHandoverProductListById(id);
|
List<HandoverProductListVo> data = handoverRecordService.getHandoverProductListById(id);
|
||||||
return CzgResult.success(data);
|
return CzgResult.success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 交班记录-导出
|
* 交班记录-商品详情导出
|
||||||
*
|
*
|
||||||
* @param id 交班记录ID
|
* @param id 交班记录ID
|
||||||
*/
|
*/
|
||||||
@@ -71,13 +82,13 @@ public class HandoverRecordController {
|
|||||||
ExcelExportUtil.exportToResponse(list, HandoverProductListVo.class, "交班售出商品明细", response);
|
ExcelExportUtil.exportToResponse(list, HandoverProductListVo.class, "交班售出商品明细", response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收银机-交班数据统计
|
* 收银机-实时交班数据
|
||||||
*/
|
*/
|
||||||
@GetMapping("total")
|
@GetMapping("total")
|
||||||
@OperationLog("收银机-交班数据统计")
|
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:realTime", name = "收银机-实时交班数据")
|
||||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:total", name = "收银机-交班数据统计")
|
public CzgResult<HandoverTotalVo> realTime() {
|
||||||
public CzgResult<HandoverTotalVo> total() {
|
|
||||||
HandoverTotalVo data = handoverRecordService.totalHandoverData();
|
HandoverTotalVo data = handoverRecordService.totalHandoverData();
|
||||||
return CzgResult.success(data);
|
return CzgResult.success(data);
|
||||||
}
|
}
|
||||||
@@ -91,36 +102,8 @@ public class HandoverRecordController {
|
|||||||
@OperationLog("收银机-交班/关班")
|
@OperationLog("收银机-交班/关班")
|
||||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:handover", name = "收银机-交班/关班")
|
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:handover", name = "收银机-交班/关班")
|
||||||
public CzgResult<Long> handover(@RequestParam Integer isPrint) {
|
public CzgResult<Long> handover(@RequestParam Integer isPrint) {
|
||||||
Long id = handoverRecordService.handover();
|
HandoverRecord handoverRecord = handoverRecordService.handover();
|
||||||
return CzgResult.success(id);
|
handoverRecordService.printHandoverReceipt(handoverRecord, isPrint);
|
||||||
|
return CzgResult.success(handoverRecord.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 收银机-交班/关班-网络打印机打印交班小票
|
|
||||||
*
|
|
||||||
* @param id 交班记录id
|
|
||||||
*/
|
|
||||||
@PostMapping("/network/print/{id}")
|
|
||||||
@OperationLog("收银机-交班/关班-网络打印机打印交班小票")
|
|
||||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:networkPrint", name = "收银机-交班/关班-网络打印机打印交班小票")
|
|
||||||
public CzgResult<Void> handover(@PathVariable Long id) {
|
|
||||||
handoverRecordService.printHandoverReceipt(id, SystemConstants.OneZero.ONE);
|
|
||||||
return CzgResult.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班记录-详情
|
|
||||||
*
|
|
||||||
* @param id 交班记录ID
|
|
||||||
*/
|
|
||||||
@GetMapping("/detail/{id}")
|
|
||||||
@OperationLog("交班记录-详情")
|
|
||||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:detail", name = "交班记录-详情")
|
|
||||||
public CzgResult<HandoverRecordDTO> detail(@PathVariable Long id) {
|
|
||||||
HandoverRecord entity = handoverRecordService.getById(id);
|
|
||||||
HandoverRecordDTO data = BeanUtil.copyProperties(entity, HandoverRecordDTO.class);
|
|
||||||
return CzgResult.success(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
package com.czg.controller.admin;
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
|
||||||
import com.czg.account.dto.print.PrinterAddDTO;
|
|
||||||
import com.czg.account.dto.print.PrinterDelDTO;
|
import com.czg.account.dto.print.PrinterDelDTO;
|
||||||
import com.czg.account.dto.print.PrinterEditDTO;
|
|
||||||
import com.czg.account.dto.print.PrinterOrderDTO;
|
|
||||||
import com.czg.account.entity.PrintMachine;
|
import com.czg.account.entity.PrintMachine;
|
||||||
import com.czg.account.service.PrintMachineService;
|
import com.czg.account.service.PrintMachineService;
|
||||||
import com.czg.annotation.SaAdminCheckPermission;
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
@@ -48,15 +44,10 @@ public class PrintMachineController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(subType)) {
|
if (StrUtil.isNotBlank(subType)) {
|
||||||
queryWrapper.eq(PrintMachine::getSubType, subType);
|
queryWrapper.eq(PrintMachine::getPrintType, subType);
|
||||||
}
|
}
|
||||||
queryWrapper.orderBy(PrintMachine::getSort, true).orderBy(PrintMachine::getId, false);
|
queryWrapper.orderBy(PrintMachine::getSort, true).orderBy(PrintMachine::getId, false);
|
||||||
Page<PrintMachine> page = printMachineService.page(PageUtil.buildPage(), queryWrapper);
|
Page<PrintMachine> page = printMachineService.page(PageUtil.buildPage(), queryWrapper);
|
||||||
page.getRecords().forEach(item -> {
|
|
||||||
if (StrUtil.isNotBlank(item.getCategoryIds())) {
|
|
||||||
item.setCategoryList(JSONArray.parse(item.getCategoryIds()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return CzgResult.success(page);
|
return CzgResult.success(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,15 +64,10 @@ public class PrintMachineController {
|
|||||||
}
|
}
|
||||||
queryWrapper.in(PrintMachine::getConnectionType, "USB", "局域网");
|
queryWrapper.in(PrintMachine::getConnectionType, "USB", "局域网");
|
||||||
if (StrUtil.isNotBlank(subType)) {
|
if (StrUtil.isNotBlank(subType)) {
|
||||||
queryWrapper.eq(PrintMachine::getSubType, subType);
|
queryWrapper.eq(PrintMachine::getPrintType, subType);
|
||||||
}
|
}
|
||||||
queryWrapper.orderBy(PrintMachine::getSort, true).orderBy(PrintMachine::getId, false);
|
queryWrapper.orderBy(PrintMachine::getSort, true).orderBy(PrintMachine::getId, false);
|
||||||
Page<PrintMachine> page = printMachineService.page(PageUtil.buildPage(), queryWrapper);
|
Page<PrintMachine> page = printMachineService.page(PageUtil.buildPage(), queryWrapper);
|
||||||
page.getRecords().forEach(item -> {
|
|
||||||
if (StrUtil.isNotBlank(item.getCategoryIds())) {
|
|
||||||
item.setCategoryList(JSONArray.parse(item.getCategoryIds()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return CzgResult.success(page);
|
return CzgResult.success(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,9 +80,6 @@ public class PrintMachineController {
|
|||||||
@GetMapping("/detail")
|
@GetMapping("/detail")
|
||||||
public CzgResult<PrintMachine> detail(@RequestParam Integer id) {
|
public CzgResult<PrintMachine> detail(@RequestParam Integer id) {
|
||||||
PrintMachine printMachine = printMachineService.getOne(new QueryWrapper().eq(PrintMachine::getId, id).eq(PrintMachine::getShopId, StpKit.USER.getShopId()));
|
PrintMachine printMachine = printMachineService.getOne(new QueryWrapper().eq(PrintMachine::getId, id).eq(PrintMachine::getShopId, StpKit.USER.getShopId()));
|
||||||
if (printMachine != null && StrUtil.isNotBlank(printMachine.getCategoryIds())) {
|
|
||||||
printMachine.setCategoryList(JSONArray.parse(printMachine.getCategoryIds()));
|
|
||||||
}
|
|
||||||
return CzgResult.success(printMachine);
|
return CzgResult.success(printMachine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +90,7 @@ public class PrintMachineController {
|
|||||||
*/
|
*/
|
||||||
@SaAdminCheckPermission(parentName = "打印机管理", value = "printer:add", name = "打印机新增")
|
@SaAdminCheckPermission(parentName = "打印机管理", value = "printer:add", name = "打印机新增")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public CzgResult<Boolean> add(@RequestBody @Validated PrinterAddDTO printerAddDTO) {
|
public CzgResult<Boolean> add(@RequestBody @Validated PrintMachine printerAddDTO) {
|
||||||
return CzgResult.success(printMachineService.add(StpKit.USER.getShopId(), printerAddDTO));
|
return CzgResult.success(printMachineService.add(StpKit.USER.getShopId(), printerAddDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +100,7 @@ public class PrintMachineController {
|
|||||||
*/
|
*/
|
||||||
@SaAdminCheckPermission(parentName = "打印机管理", value = "printer:edit", name = "打印机编辑")
|
@SaAdminCheckPermission(parentName = "打印机管理", value = "printer:edit", name = "打印机编辑")
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public CzgResult<Boolean> edit(@RequestBody @Validated PrinterEditDTO printerEditDTO) {
|
public CzgResult<Boolean> edit(@RequestBody @Validated PrintMachine printerEditDTO) {
|
||||||
return CzgResult.success(printMachineService.edit(StpKit.USER.getShopId(), printerEditDTO));
|
return CzgResult.success(printMachineService.edit(StpKit.USER.getShopId(), printerEditDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.czg.controller.admin;
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
import com.czg.excel.ExcelExportUtil;
|
import com.czg.excel.ExcelExportUtil;
|
||||||
import com.czg.log.annotation.OperationLog;
|
|
||||||
import com.czg.order.entity.ShopProdStatistic;
|
import com.czg.order.entity.ShopProdStatistic;
|
||||||
import com.czg.order.param.SaleSummaryCountParam;
|
import com.czg.order.param.SaleSummaryCountParam;
|
||||||
import com.czg.order.service.ShopProdStatisticService;
|
import com.czg.order.service.ShopProdStatisticService;
|
||||||
@@ -36,7 +35,6 @@ public class SaleSummaryController {
|
|||||||
* 统计
|
* 统计
|
||||||
*/
|
*/
|
||||||
@GetMapping("count")
|
@GetMapping("count")
|
||||||
@OperationLog("统计")
|
|
||||||
//@SaAdminCheckPermission("saleSummary:count")
|
//@SaAdminCheckPermission("saleSummary:count")
|
||||||
public CzgResult<SaleSummaryCountVo> summaryCount(SaleSummaryCountParam param) {
|
public CzgResult<SaleSummaryCountVo> summaryCount(SaleSummaryCountParam param) {
|
||||||
if (param.getShopId() == null) {
|
if (param.getShopId() == null) {
|
||||||
@@ -50,7 +48,6 @@ public class SaleSummaryController {
|
|||||||
* 分页
|
* 分页
|
||||||
*/
|
*/
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@OperationLog("分页")
|
|
||||||
//@SaAdminCheckPermission("saleSummary:page")
|
//@SaAdminCheckPermission("saleSummary:page")
|
||||||
public CzgResult<List<ShopProdStatistic>> summaryPage(SaleSummaryCountParam param) {
|
public CzgResult<List<ShopProdStatistic>> summaryPage(SaleSummaryCountParam param) {
|
||||||
if (param.getShopId() == null) {
|
if (param.getShopId() == null) {
|
||||||
@@ -60,6 +57,9 @@ public class SaleSummaryController {
|
|||||||
return CzgResult.success(list);
|
return CzgResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品报表导出
|
||||||
|
*/
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
public void summaryExport(SaleSummaryCountParam param, HttpServletResponse response) {
|
public void summaryExport(SaleSummaryCountParam param, HttpServletResponse response) {
|
||||||
if (param.getShopId() == null) {
|
if (param.getShopId() == null) {
|
||||||
@@ -68,4 +68,16 @@ public class SaleSummaryController {
|
|||||||
ExcelExportUtil.exportToResponse(prodStatisticService.getArchiveTradeData(param), ShopProdStatistic.class, "销售统计明细", response);
|
ExcelExportUtil.exportToResponse(prodStatisticService.getArchiveTradeData(param), ShopProdStatistic.class, "销售统计明细", response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品报表打印
|
||||||
|
*/
|
||||||
|
@GetMapping("/print")
|
||||||
|
public CzgResult<Void> summaryPrint(SaleSummaryCountParam param) {
|
||||||
|
if (param.getShopId() == null) {
|
||||||
|
param.setShopId(StpKit.USER.getShopId());
|
||||||
|
}
|
||||||
|
prodStatisticService.summaryPrint(param);
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
|
|
||||||
|
import com.czg.order.entity.SysPrintData;
|
||||||
|
import com.czg.order.service.SysPrintDataService;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
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 ww
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/admin/printData")
|
||||||
|
public class SysPrintDataController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysPrintDataService sysPrintDataService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取打印数据
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public CzgResult<SysPrintData> getWareCount(@RequestParam Long shopId, @RequestParam Long dataId, @RequestParam String type) {
|
||||||
|
return CzgResult.success(sysPrintDataService.getOne(new QueryWrapper()
|
||||||
|
.eq(SysPrintData::getType, type)
|
||||||
|
.eq(SysPrintData::getShopId, shopId)
|
||||||
|
.eq(SysPrintData::getId, dataId)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,6 @@ package com.czg.mq;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.czg.config.RabbitConstants;
|
import com.czg.config.RabbitConstants;
|
||||||
import com.czg.order.entity.MqLog;
|
import com.czg.order.entity.MqLog;
|
||||||
@@ -71,10 +70,10 @@ public class OrderMqListener {
|
|||||||
public void orderStockRecover(String orderId) {
|
public void orderStockRecover(String orderId) {
|
||||||
long startTime = DateUtil.date().getTime();
|
long startTime = DateUtil.date().getTime();
|
||||||
log.info("接收到订单取消恢复库存消息:{}", orderId);
|
log.info("接收到订单取消恢复库存消息:{}", orderId);
|
||||||
MqLog mqLog = new MqLog().setQueue(RabbitConstants.Queue.ORDER_CANCEL_QUEUE).setMsg(orderId).setType("orderStockRecover").setPlat("java.order").setCreateTime(DateUtil.date().toLocalDateTime());
|
|
||||||
try {
|
try {
|
||||||
orderInfoRpcService.orderCancelCallback(Long.valueOf(orderId));
|
orderInfoRpcService.orderCancelCallback(Long.valueOf(orderId));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
MqLog mqLog = new MqLog().setQueue(RabbitConstants.Queue.ORDER_CANCEL_QUEUE).setMsg(orderId).setType("orderStockRecover").setPlat("java.order").setCreateTime(DateUtil.date().toLocalDateTime());
|
||||||
log.error("订单取消恢复库存失败", e);
|
log.error("订单取消恢复库存失败", e);
|
||||||
String errorInfo = ExceptionUtil.stacktraceToString(e);
|
String errorInfo = ExceptionUtil.stacktraceToString(e);
|
||||||
mqLog.setErrInfo(errorInfo);
|
mqLog.setErrInfo(errorInfo);
|
||||||
@@ -88,11 +87,10 @@ public class OrderMqListener {
|
|||||||
public void orderStockReturn(String jsonObjStr) {
|
public void orderStockReturn(String jsonObjStr) {
|
||||||
long startTime = DateUtil.date().getTime();
|
long startTime = DateUtil.date().getTime();
|
||||||
log.info("接收到订单退款返还库存消息:{}", jsonObjStr);
|
log.info("接收到订单退款返还库存消息:{}", jsonObjStr);
|
||||||
MqLog mqLog = new MqLog().setQueue(RabbitConstants.Queue.ORDER_REFUND_QUEUE).setMsg(jsonObjStr).setType("orderStockReturn").setPlat("java.order").setCreateTime(DateUtil.date().toLocalDateTime());
|
|
||||||
try {
|
try {
|
||||||
JSONObject data = JSON.parseObject(jsonObjStr);
|
orderInfoRpcService.orderRefundCallback(JSONObject.parseObject(jsonObjStr));
|
||||||
orderInfoRpcService.orderRefundCallback(data);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
MqLog mqLog = new MqLog().setQueue(RabbitConstants.Queue.ORDER_REFUND_QUEUE).setMsg(jsonObjStr).setType("orderStockReturn").setPlat("java.order").setCreateTime(DateUtil.date().toLocalDateTime());
|
||||||
log.error("订单退款返还库存失败", e);
|
log.error("订单退款返还库存失败", e);
|
||||||
String errorInfo = ExceptionUtil.stacktraceToString(e);
|
String errorInfo = ExceptionUtil.stacktraceToString(e);
|
||||||
mqLog.setErrInfo(errorInfo);
|
mqLog.setErrInfo(errorInfo);
|
||||||
|
|||||||
@@ -3,15 +3,18 @@ package com.czg.mq;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.czg.config.RabbitConstants;
|
import com.czg.config.RabbitConstants;
|
||||||
|
import com.czg.config.RabbitPublisher;
|
||||||
import com.czg.config.RedisCst;
|
import com.czg.config.RedisCst;
|
||||||
import com.czg.order.entity.MqLog;
|
import com.czg.order.entity.MqLog;
|
||||||
|
import com.czg.order.entity.SysPrintData;
|
||||||
import com.czg.order.service.MqLogService;
|
import com.czg.order.service.MqLogService;
|
||||||
|
import com.czg.order.service.SysPrintDataService;
|
||||||
import com.czg.service.RedisService;
|
import com.czg.service.RedisService;
|
||||||
|
import com.czg.service.order.print.PrintConfig;
|
||||||
import com.czg.service.order.print.PrinterHandler;
|
import com.czg.service.order.print.PrinterHandler;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@@ -28,9 +31,12 @@ public class PrintMqListener {
|
|||||||
private MqLogService mqLogService;
|
private MqLogService mqLogService;
|
||||||
@Resource
|
@Resource
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
@Lazy
|
|
||||||
@Resource
|
@Resource
|
||||||
private PrinterHandler printerHandler;
|
private PrintConfig printConfig;
|
||||||
|
@Resource
|
||||||
|
private RabbitPublisher rabbitPublisher;
|
||||||
|
@Resource
|
||||||
|
protected SysPrintDataService printDataService;
|
||||||
|
|
||||||
private <T> void invokeFun(String queue, String type, String plat, T data, Consumer<T> consumer) {
|
private <T> void invokeFun(String queue, String type, String plat, T data, Consumer<T> consumer) {
|
||||||
long startTime = DateUtil.date().getTime();
|
long startTime = DateUtil.date().getTime();
|
||||||
@@ -57,29 +63,36 @@ public class PrintMqListener {
|
|||||||
if (orderId == null) {
|
if (orderId == null) {
|
||||||
throw new RuntimeException("订单打印失败,未传递orderId");
|
throw new RuntimeException("订单打印失败,未传递orderId");
|
||||||
}
|
}
|
||||||
|
//该字段表示 网络打印机是否打印订单 本地传参来的
|
||||||
Boolean printOrder = jsonObject.getBoolean("printOrder");
|
Boolean printOrder = jsonObject.getBoolean("printOrder");
|
||||||
redisService.runFunAndCheckKey(() -> {
|
redisService.runFunAndCheckKey(() -> {
|
||||||
printerHandler.orderHandler(orderId, printOrder != null && !printOrder ? PrinterHandler.PrintTypeEnum.ONE : PrinterHandler.PrintTypeEnum.ONE_AND_ORDER, null);
|
if (printOrder) {
|
||||||
|
printConfig.orderHandler(orderId, PrinterHandler.PrintTypeEnum.ORDER, null);
|
||||||
|
}
|
||||||
|
//菜品打印 全是后端
|
||||||
|
printConfig.orderHandler(orderId, PrinterHandler.PrintTypeEnum.ONLY_KITCHEN, null);
|
||||||
|
printConfig.orderHandler(orderId, PrinterHandler.PrintTypeEnum.ALL_KITCHEN, null);
|
||||||
return null;
|
return null;
|
||||||
}, RedisCst.getLockKey("orderPrint", orderId));
|
}, RedisCst.getLockKey("orderPrint", orderId));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班打印
|
|
||||||
*/
|
|
||||||
@RabbitListener(queues = {"${spring.profiles.active}-" + RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE})
|
|
||||||
public void handoverPrint(String id) {
|
|
||||||
invokeFun(RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE, "handoverPrint", "java.order", id, (data) ->
|
|
||||||
printerHandler.handoverHandler(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
@RabbitListener(queues = {"${spring.profiles.active}-" + RabbitConstants.Queue.OTHER_PRINT_QUEUE})
|
||||||
* 叫号打印
|
public void otherPrint(String data) {
|
||||||
*/
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
||||||
@RabbitListener(queues = {"${spring.profiles.active}-" + RabbitConstants.Queue.CALL_TABLE_QUEUE})
|
Long shopId = jsonObject.getLong("shopId");
|
||||||
public void callTablePrint(String id) {
|
String printTypeEnum = jsonObject.getString("printTypeEnum");
|
||||||
invokeFun(RabbitConstants.Queue.CALL_TABLE_QUEUE, "callTable", "java.order", id, (data) ->
|
JSONObject data2 = jsonObject.getJSONObject("data");
|
||||||
printerHandler.callHandler(data));
|
PrinterHandler.PrintTypeEnum typeEnum = PrinterHandler.PrintTypeEnum.valueOf(printTypeEnum);
|
||||||
|
if (typeEnum != PrinterHandler.PrintTypeEnum.HANDOVER) {
|
||||||
|
SysPrintData sysPrintData = new SysPrintData();
|
||||||
|
sysPrintData.setShopId(shopId);
|
||||||
|
sysPrintData.setData(data2.toJSONString());
|
||||||
|
sysPrintData.setType(typeEnum.toString());
|
||||||
|
printDataService.save(sysPrintData);
|
||||||
|
rabbitPublisher.sendOtherPrintLocalMsg(shopId, printTypeEnum, sysPrintData.getId());
|
||||||
|
}
|
||||||
|
printConfig.otherHandler(shopId, data2, typeEnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.czg.product.param.ConsSubUnitParam;
|
|||||||
import com.czg.product.service.ConsInfoService;
|
import com.czg.product.service.ConsInfoService;
|
||||||
import com.czg.product.service.ShopSyncService;
|
import com.czg.product.service.ShopSyncService;
|
||||||
import com.czg.product.vo.ConsStatisticsVo;
|
import com.czg.product.vo.ConsStatisticsVo;
|
||||||
|
import com.czg.product.vo.ConsStockRecord;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.utils.AssertUtil;
|
import com.czg.utils.AssertUtil;
|
||||||
@@ -44,18 +45,25 @@ public class ConsInfoController {
|
|||||||
* 分页
|
* 分页
|
||||||
*/
|
*/
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@OperationLog("耗材信息-分页")
|
|
||||||
//@SaAdminCheckPermission("consInfo:page")
|
//@SaAdminCheckPermission("consInfo:page")
|
||||||
public CzgResult<Page<ConsInfoDTO>> getConsInfoPage(ConsInfoDTO param) {
|
public CzgResult<Page<ConsInfoDTO>> getConsInfoPage(ConsInfoDTO param) {
|
||||||
Page<ConsInfoDTO> data = consInfoService.getConsInfoPage(param);
|
Page<ConsInfoDTO> data = consInfoService.getConsInfoPage(param);
|
||||||
return CzgResult.success(data);
|
return CzgResult.success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
*/
|
||||||
|
@GetMapping("consStock")
|
||||||
|
public CzgResult<List<ConsStockRecord>> getConsStockList(Long shopId) {
|
||||||
|
return CzgResult.success(consInfoService.getConsStockList(shopId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
@OperationLog("耗材信息-列表")
|
|
||||||
//@SaAdminCheckPermission("consInfo:list")
|
//@SaAdminCheckPermission("consInfo:list")
|
||||||
public CzgResult<List<ConsInfoDTO>> getConsInfoList(ConsInfoDTO param) {
|
public CzgResult<List<ConsInfoDTO>> getConsInfoList(ConsInfoDTO param) {
|
||||||
List<ConsInfoDTO> data = consInfoService.getConsInfoList(param);
|
List<ConsInfoDTO> data = consInfoService.getConsInfoList(param);
|
||||||
@@ -68,7 +76,6 @@ public class ConsInfoController {
|
|||||||
* @param id 耗材信息id
|
* @param id 耗材信息id
|
||||||
*/
|
*/
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
@OperationLog("耗材信息-详情")
|
|
||||||
//@SaAdminCheckPermission("consInfo:info")
|
//@SaAdminCheckPermission("consInfo:info")
|
||||||
public CzgResult<ConsInfoDTO> getConsInfoById(@PathVariable("id") Long id) {
|
public CzgResult<ConsInfoDTO> getConsInfoById(@PathVariable("id") Long id) {
|
||||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||||
@@ -164,21 +171,6 @@ public class ConsInfoController {
|
|||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 退款退回开关
|
|
||||||
*
|
|
||||||
* @param id 耗材信息id
|
|
||||||
*/
|
|
||||||
@PostMapping("onOffIsRefundStock")
|
|
||||||
@OperationLog("耗材信息-退款退回开关")
|
|
||||||
//@SaAdminCheckPermission("consInfo:on-off")
|
|
||||||
public CzgResult<Void> onOffIsRefundStock(@RequestParam Long id, @RequestParam Integer isRefundStockConsInfo) {
|
|
||||||
//效验数据
|
|
||||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
|
||||||
AssertUtil.isNull(isRefundStockConsInfo, "退款退回开关值不能为空");
|
|
||||||
consInfoService.isRefundStockConsInfo(id, isRefundStockConsInfo);
|
|
||||||
return CzgResult.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑副单位
|
* 编辑副单位
|
||||||
@@ -200,7 +192,6 @@ public class ConsInfoController {
|
|||||||
* 统计
|
* 统计
|
||||||
*/
|
*/
|
||||||
@GetMapping("statistics")
|
@GetMapping("statistics")
|
||||||
@OperationLog("耗材信息-统计")
|
|
||||||
//@SaAdminCheckPermission("consInfo:info")
|
//@SaAdminCheckPermission("consInfo:info")
|
||||||
public CzgResult<ConsStatisticsVo> getConsInfoById(ConsInfoParam param) {
|
public CzgResult<ConsStatisticsVo> getConsInfoById(ConsInfoParam param) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import com.czg.product.param.*;
|
|||||||
import com.czg.product.service.ProdConsRelationService;
|
import com.czg.product.service.ProdConsRelationService;
|
||||||
import com.czg.product.service.ProductService;
|
import com.czg.product.service.ProductService;
|
||||||
import com.czg.product.service.ShopSyncService;
|
import com.czg.product.service.ShopSyncService;
|
||||||
import com.czg.product.service.UProductService;
|
|
||||||
import com.czg.product.vo.ProductStatisticsVo;
|
import com.czg.product.vo.ProductStatisticsVo;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
@@ -57,9 +56,6 @@ public class ProductController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ShopSyncService shopSyncService;
|
private ShopSyncService shopSyncService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private UProductService uProductService;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ShopInfoService shopInfoService;
|
private ShopInfoService shopInfoService;
|
||||||
|
|
||||||
@@ -72,12 +68,6 @@ public class ProductController {
|
|||||||
public CzgResult<Map<String, Object>> getProductPage(ProductDTO param) {
|
public CzgResult<Map<String, Object>> getProductPage(ProductDTO param) {
|
||||||
Page<ProductDTO> data = productService.getProductPage(param);
|
Page<ProductDTO> data = productService.getProductPage(param);
|
||||||
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(data), Map.class);
|
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(data), Map.class);
|
||||||
if (data.getRecords() != null && !data.getRecords().isEmpty()) {
|
|
||||||
ProductDTO first = data.getRecords().getFirst();
|
|
||||||
map.put("warnLine", first.getWarnLine());
|
|
||||||
} else {
|
|
||||||
map.put("warnLine", 0);
|
|
||||||
}
|
|
||||||
return CzgResult.success(map);
|
return CzgResult.success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,14 +84,8 @@ public class ProductController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
@OperationLog("商品-列表")
|
@OperationLog("商品-列表")
|
||||||
//@SaAdminCheckPermission("product:list")
|
public CzgResult<List<ProductDTO>> getProductList(@RequestParam(required = false) Long categoryId) {
|
||||||
public CzgResult<List<ProductDTO>> getProductList(ProductDTO param) {
|
return CzgResult.success(productService.getProductCacheList(StpKit.USER.getShopId(), categoryId));
|
||||||
Long shopId = StpKit.USER.getShopId();
|
|
||||||
param.setShopId(shopId);
|
|
||||||
List<ProductDTO> productList = productService.getProductCacheList(param);
|
|
||||||
productService.refreshProductStock(param, productList);
|
|
||||||
productList.forEach(prod -> prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getDays(), prod.getStartTime(), prod.getEndTime())));
|
|
||||||
return CzgResult.success(productList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -135,6 +119,17 @@ public class ProductController {
|
|||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品-库存变动记录
|
||||||
|
*/
|
||||||
|
@GetMapping("stockFlow")
|
||||||
|
@OperationLog("商品-库存变动记录")
|
||||||
|
//@SaAdminCheckPermission("consStockFlow:flow")
|
||||||
|
public CzgResult<Page<ProductStockFlow>> stockFlow(ProductStockFlowParam param) {
|
||||||
|
Page<ProductStockFlow> data = productService.findProductStockFlowPage(param);
|
||||||
|
return CzgResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品-修改
|
* 商品-修改
|
||||||
*/
|
*/
|
||||||
@@ -150,10 +145,6 @@ public class ProductController {
|
|||||||
if (dto.getGroupCategoryId() != null) {
|
if (dto.getGroupCategoryId() != null) {
|
||||||
StpKit.USER.checkStaffPermission("yun_xu_xiu_gai_fen_zu");
|
StpKit.USER.checkStaffPermission("yun_xu_xiu_gai_fen_zu");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dto.getStockNumber() != null) {
|
|
||||||
StpKit.USER.checkStaffPermission("yun_xu_xiu_gai_shang_pin_ku_cun");
|
|
||||||
}
|
|
||||||
Long shopId = StpKit.USER.getShopId();
|
Long shopId = StpKit.USER.getShopId();
|
||||||
dto.setShopId(shopId);
|
dto.setShopId(shopId);
|
||||||
productService.updateProduct(dto);
|
productService.updateProduct(dto);
|
||||||
@@ -162,18 +153,6 @@ public class ProductController {
|
|||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("modifyStock")
|
|
||||||
@OperationLog("商品-修改库存")
|
|
||||||
//@SaStaffCheckPermission("yun_xu_xiu_gai_shang_pin")
|
|
||||||
public CzgResult<Void> updateProductStock(@RequestBody ProductModifyStockParam param) {
|
|
||||||
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
|
||||||
Long shopId = StpKit.USER.getShopId();
|
|
||||||
param.setShopId(shopId);
|
|
||||||
productService.updateProductStock(param);
|
|
||||||
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)));
|
|
||||||
return CzgResult.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品-删除
|
* 商品-删除
|
||||||
*
|
*
|
||||||
@@ -223,6 +202,16 @@ public class ProductController {
|
|||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品-标记自动售罄
|
||||||
|
*/
|
||||||
|
@PostMapping("markIsAutoSoldOut")
|
||||||
|
public CzgResult<Void> markIsAutoSoldOut(@RequestBody @Validated({DefaultGroup.class}) ProductIsAutoSaleParam param) {
|
||||||
|
productService.markProductIsAutoSoldOut(StpKit.USER.getShopId(), param);
|
||||||
|
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(StpKit.USER.getShopId())));
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品-绑定耗材
|
* 商品-绑定耗材
|
||||||
*/
|
*/
|
||||||
@@ -230,13 +219,15 @@ public class ProductController {
|
|||||||
@OperationLog("商品-绑定耗材")
|
@OperationLog("商品-绑定耗材")
|
||||||
//@SaAdminCheckPermission("product:bind")
|
//@SaAdminCheckPermission("product:bind")
|
||||||
public CzgResult<Void> bindCons(@RequestBody @Validated({DefaultGroup.class}) ProdConsBindDTO param) {
|
public CzgResult<Void> bindCons(@RequestBody @Validated({DefaultGroup.class}) ProdConsBindDTO param) {
|
||||||
|
AssertUtil.isNull(param.getId(), "商品Id不能为空");
|
||||||
prodConsRelationService.saveProdConsRelation(param);
|
prodConsRelationService.saveProdConsRelation(param);
|
||||||
|
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(StpKit.USER.getShopId())));
|
||||||
asyncConsProToShop(param.getId());
|
asyncConsProToShop(param.getId());
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品-退款退至库存
|
* 商品-退款退至库存 开关
|
||||||
*/
|
*/
|
||||||
@PostMapping("refundToStock")
|
@PostMapping("refundToStock")
|
||||||
@OperationLog("商品-退款退至库存")
|
@OperationLog("商品-退款退至库存")
|
||||||
@@ -247,28 +238,11 @@ public class ProductController {
|
|||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品-库存预警设置
|
|
||||||
*/
|
|
||||||
@PostMapping("stockWarning")
|
|
||||||
@OperationLog("商品-库存预警设置")
|
|
||||||
//@SaAdminCheckPermission("product:stockWarning")
|
|
||||||
public CzgResult<Void> stockWarning(@RequestParam Integer warnLine) {
|
|
||||||
AssertUtil.isNull(warnLine, "{}不能为空", "warnLine");
|
|
||||||
if (warnLine < 0) {
|
|
||||||
throw new CzgException("预警值不能小于0");
|
|
||||||
}
|
|
||||||
productService.stockWarning(warnLine);
|
|
||||||
return CzgResult.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品-报损
|
* 商品-报损
|
||||||
*/
|
*/
|
||||||
@PostMapping("reportDamage")
|
@PostMapping("reportDamage")
|
||||||
@OperationLog("商品-报损")
|
@OperationLog("商品-报损")
|
||||||
//@SaStaffCheckPermission("yun_xu_ti_jiao_bao_sun")
|
|
||||||
//@SaAdminCheckPermission("product:reportDamage")
|
|
||||||
public CzgResult<Void> reportDamage(@RequestBody ProductReportDamageParam param) {
|
public CzgResult<Void> reportDamage(@RequestBody ProductReportDamageParam param) {
|
||||||
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
||||||
productService.reportDamage(param);
|
productService.reportDamage(param);
|
||||||
@@ -288,17 +262,6 @@ public class ProductController {
|
|||||||
return CzgResult.success(data);
|
return CzgResult.success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品-库存变动记录
|
|
||||||
*/
|
|
||||||
@GetMapping("stockFlow")
|
|
||||||
@OperationLog("商品-库存变动记录")
|
|
||||||
//@SaAdminCheckPermission("consStockFlow:flow")
|
|
||||||
public CzgResult<Page<ProductStockFlow>> stockFlow(ProductStockFlowParam param) {
|
|
||||||
Page<ProductStockFlow> data = productService.findProductStockFlowPage(param);
|
|
||||||
return CzgResult.success(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品-报损
|
* 商品-报损
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,24 +2,21 @@ package com.czg.controller.user;
|
|||||||
|
|
||||||
import com.czg.constants.SystemConstants;
|
import com.czg.constants.SystemConstants;
|
||||||
import com.czg.product.param.ShopProductSkuParam;
|
import com.czg.product.param.ShopProductSkuParam;
|
||||||
|
import com.czg.product.service.ConsInfoService;
|
||||||
import com.czg.product.service.UProductService;
|
import com.czg.product.service.UProductService;
|
||||||
import com.czg.product.vo.ShopGroupProductVo;
|
import com.czg.product.vo.*;
|
||||||
import com.czg.product.vo.ShopProductInfoVo;
|
|
||||||
import com.czg.product.vo.ShopProductSkuInfoVo;
|
|
||||||
import com.czg.product.vo.ShopProductVo;
|
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.utils.AssertUtil;
|
import com.czg.utils.AssertUtil;
|
||||||
import com.czg.validator.ValidatorUtil;
|
import com.czg.validator.ValidatorUtil;
|
||||||
import com.czg.validator.group.DefaultGroup;
|
import com.czg.validator.group.DefaultGroup;
|
||||||
import lombok.AllArgsConstructor;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,11 +25,13 @@ import java.util.Map;
|
|||||||
* @author Tankaikai tankaikai@aliyun.com
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
* @since 1.0 2025-02-16
|
* @since 1.0 2025-02-16
|
||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/user/product")
|
@RequestMapping("/user/product")
|
||||||
public class UProductController {
|
public class UProductController {
|
||||||
private final UProductService uProductService;
|
@Resource
|
||||||
|
private UProductService uProductService;
|
||||||
|
@Resource
|
||||||
|
private ConsInfoService consInfoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序点餐-热销商品列表
|
* 小程序点餐-热销商品列表
|
||||||
@@ -41,10 +40,9 @@ public class UProductController {
|
|||||||
public CzgResult<List<ShopProductVo>> queryHotsProductList() {
|
public CzgResult<List<ShopProductVo>> queryHotsProductList() {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
List<ShopProductVo> list = uProductService.queryHotsProductList(shopId);
|
List<ShopProductVo> list = uProductService.queryHotsProductList(shopId);
|
||||||
list.forEach(prod -> {
|
// list.forEach(prod -> {
|
||||||
prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getDays(), prod.getStartTime(), prod.getEndTime()));
|
// prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getDays(), prod.getStartTime(), prod.getEndTime()));
|
||||||
});
|
// });
|
||||||
uProductService.refreshProductStock(shopId, list);
|
|
||||||
return CzgResult.success(list);
|
return CzgResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,9 +53,7 @@ public class UProductController {
|
|||||||
public CzgResult<List<ShopGroupProductVo>> queryGroupProductList() {
|
public CzgResult<List<ShopGroupProductVo>> queryGroupProductList() {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
List<ShopGroupProductVo> list = uProductService.queryGroupProductList(shopId);
|
List<ShopGroupProductVo> list = uProductService.queryGroupProductList(shopId);
|
||||||
Map<Long, Integer> productStock = uProductService.findShopProductStock(shopId);
|
|
||||||
list.forEach(item -> {
|
list.forEach(item -> {
|
||||||
uProductService.refreshProductStock(productStock, item.getProductList());
|
|
||||||
item.getProductList().forEach(prod -> {
|
item.getProductList().forEach(prod -> {
|
||||||
prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getDays(), prod.getStartTime(), prod.getEndTime()));
|
prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getDays(), prod.getStartTime(), prod.getEndTime()));
|
||||||
prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getIsSaleTime(), item.getUseTime(), item.getSaleStartTime(), item.getSaleEndTime()));
|
prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getIsSaleTime(), item.getUseTime(), item.getSaleStartTime(), item.getSaleEndTime()));
|
||||||
@@ -70,6 +66,14 @@ public class UProductController {
|
|||||||
return CzgResult.success(list);
|
return CzgResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
*/
|
||||||
|
@GetMapping("consStock")
|
||||||
|
public CzgResult<List<ConsStockRecord>> getConsStockList(Long shopId) {
|
||||||
|
return CzgResult.success(consInfoService.getConsStockList(shopId));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序点餐-商品详情
|
* 小程序点餐-商品详情
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -70,26 +70,26 @@ public class RabbitConfig {
|
|||||||
return BindingBuilder.bind(orderMachinePrintQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE);
|
return BindingBuilder.bind(orderMachinePrintQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------交班打票
|
|
||||||
|
//------------------------------------------------------其它打印消息打票
|
||||||
@Bean
|
@Bean
|
||||||
public Queue handoverPrintQueue() {
|
public Queue otherPrintQueue() {
|
||||||
return new Queue(activeProfile + "-" + RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE, true, false, false);
|
return new Queue(activeProfile + "-" + RabbitConstants.Queue.OTHER_PRINT_QUEUE, true, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Binding bindingHandoverPrintExchange(Queue handoverPrintQueue, DirectExchange exchange) {
|
public Binding bindingOtherPrintExchange(Queue otherPrintQueue, DirectExchange exchange) {
|
||||||
return BindingBuilder.bind(handoverPrintQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE);
|
return BindingBuilder.bind(otherPrintQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.OTHER_PRINT_QUEUE);
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------叫号 打票
|
|
||||||
@Bean
|
|
||||||
public Queue callTablePrintQueue() {
|
|
||||||
return new Queue(activeProfile + "-" + RabbitConstants.Queue.CALL_TABLE_QUEUE, true, false, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Binding bindingCallTablePrintExchange(Queue callTablePrintQueue, DirectExchange exchange) {
|
public Queue otherPrintLocalQueue() {
|
||||||
return BindingBuilder.bind(callTablePrintQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.CALL_TABLE_QUEUE);
|
return new Queue(activeProfile + "-" + RabbitConstants.Queue.OTHER_PRINT_LOCAL_QUEUE, true, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Binding bindingOtherPrintLocalExchange(Queue otherPrintLocalQueue, DirectExchange exchange) {
|
||||||
|
return BindingBuilder.bind(otherPrintLocalQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.OTHER_PRINT_LOCAL_QUEUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------订单取消
|
//------------------------------------------------------订单取消
|
||||||
@@ -126,6 +126,17 @@ public class RabbitConfig {
|
|||||||
return BindingBuilder.bind(productInfoChangeQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.PRODUCT_INFO_CHANGE_QUEUE);
|
return BindingBuilder.bind(productInfoChangeQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.PRODUCT_INFO_CHANGE_QUEUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------ 耗材信息更新
|
||||||
|
@Bean
|
||||||
|
public Queue consInfoChangeQueue() {
|
||||||
|
return new Queue(activeProfile + "-" + RabbitConstants.Queue.CONS_INFO_CHANGE_QUEUE, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Binding bindingConsInfoChange(Queue consInfoChangeQueue, DirectExchange exchange) {
|
||||||
|
return BindingBuilder.bind(consInfoChangeQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.CONS_INFO_CHANGE_QUEUE);
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------ 订单退款
|
//------------------------------------------------------ 订单退款
|
||||||
@Bean
|
@Bean
|
||||||
public Queue orderRefundQueue() {
|
public Queue orderRefundQueue() {
|
||||||
|
|||||||
@@ -14,11 +14,14 @@ public interface RabbitConstants {
|
|||||||
public static final String ORDER_STOCK_QUEUE = "order.stock.queue";
|
public static final String ORDER_STOCK_QUEUE = "order.stock.queue";
|
||||||
public static final String ORDER_REFUND_QUEUE = "order.refund.queue";
|
public static final String ORDER_REFUND_QUEUE = "order.refund.queue";
|
||||||
public static final String ORDER_CANCEL_QUEUE = "order.cancel.queue";
|
public static final String ORDER_CANCEL_QUEUE = "order.cancel.queue";
|
||||||
|
|
||||||
public static final String ORDER_PRINT_QUEUE = "order.print.queue";
|
public static final String ORDER_PRINT_QUEUE = "order.print.queue";
|
||||||
public static final String ORDER_MACHINE_PRINT_QUEUE = "order.machine.print.queue";
|
public static final String ORDER_MACHINE_PRINT_QUEUE = "order.machine.print.queue";
|
||||||
public static final String ORDER_HANDOVER_PRINT_QUEUE = "order.handover.print.queue";
|
|
||||||
public static final String CALL_TABLE_QUEUE = "call.table.print.queue";
|
public static final String OTHER_PRINT_QUEUE = "other.print.queue";
|
||||||
|
public static final String OTHER_PRINT_LOCAL_QUEUE = "other.print.local.queue";
|
||||||
public static final String PRODUCT_INFO_CHANGE_QUEUE = "product.info.change.queue";
|
public static final String PRODUCT_INFO_CHANGE_QUEUE = "product.info.change.queue";
|
||||||
|
public static final String CONS_INFO_CHANGE_QUEUE = "cons.info.change.queue";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单商品状态队列
|
* 订单商品状态队列
|
||||||
|
|||||||
@@ -51,38 +51,28 @@ public class RabbitPublisher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单打印消息
|
* 后付费订单打印消息
|
||||||
*
|
*
|
||||||
* @param orderId 订单id
|
* @param orderId 订单id
|
||||||
* @param printOrder 是否打印结算单
|
|
||||||
*/
|
*/
|
||||||
public void sendOrderPrintMsg(String orderId, boolean printOrder, String source) {
|
public void sendOrderPrintMsg(String orderId, boolean printOrder, String source) {
|
||||||
log.info("开始发送打印mq消息, orderId: {}, printOrder: {}, source: {}", orderId, printOrder, source);
|
log.info("订单打印消息, orderId: {}, printOrder: {}, source: {}", orderId, printOrder, source);
|
||||||
//厨房票
|
//结算票 预结算单 客看单
|
||||||
sendMsg(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE, new JSONObject().fluentPut("orderId", orderId).fluentPut("printOrder", printOrder).toString());
|
|
||||||
//前台票
|
|
||||||
if (printOrder) {
|
if (printOrder) {
|
||||||
sendMsg(RabbitConstants.Queue.ORDER_PRINT_QUEUE, orderId);
|
sendMsg(RabbitConstants.Queue.ORDER_PRINT_QUEUE, orderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退款订单打印消息
|
* 厨房票打印消息
|
||||||
*
|
*
|
||||||
* @param orderId 订单id
|
* @param orderId 订单id
|
||||||
|
* @param printOrder 是否打印结算单
|
||||||
*/
|
*/
|
||||||
public void sendOrderReturnPrintMsg(String orderId) {
|
public void sendKitchenOrderPrintMsg(String orderId, boolean printOrder, String source) {
|
||||||
|
log.info("厨房菜品单打印消息, orderId: {}, printOrder: {}, source: {}", orderId, printOrder, source);
|
||||||
//厨房票
|
//厨房票
|
||||||
sendMsg(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE, new JSONObject().fluentPut("orderId", orderId).fluentPut("printOrder", true).toString());
|
sendMsg(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE, new JSONObject().fluentPut("orderId", orderId).fluentPut("printOrder", printOrder).toString());
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班小票打印消息
|
|
||||||
*
|
|
||||||
* @param handoverRecordId 交班记录id
|
|
||||||
*/
|
|
||||||
public void sendHandoverPrintMsg(String handoverRecordId) {
|
|
||||||
sendMsg(RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE, handoverRecordId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,12 +85,12 @@ public class RabbitPublisher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排队叫号小票打印
|
* 商品信息变动消息
|
||||||
*
|
*
|
||||||
* @param id 叫号队列id
|
* @param shopId 店铺id
|
||||||
*/
|
*/
|
||||||
public void printCallNumTicket(Long id) {
|
public void sendConsInfoChangeMsg(String shopId) {
|
||||||
sendMsg(RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE, id.toString());
|
sendMsg(RabbitConstants.Queue.CONS_INFO_CHANGE_QUEUE, shopId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -155,4 +145,36 @@ public class RabbitPublisher {
|
|||||||
rabbitTemplate.convertAndSend(activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE, activeProfile + "-" + queue, msg);
|
rabbitTemplate.convertAndSend(activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE, activeProfile + "-" + queue, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其它类型 打印消息
|
||||||
|
* STOCK 出入库
|
||||||
|
* DAY_REPORT 经营日报
|
||||||
|
* PRODUCT_REPORT 商品报表
|
||||||
|
* RECHARGE 储值单
|
||||||
|
* STOCK_CHECK 库存盘点
|
||||||
|
* HANDOVER 交班单
|
||||||
|
* CALL 排队取号
|
||||||
|
*
|
||||||
|
* @param printType {@link com.czg.service.order.print.PrinterHandler.PrintTypeEnum}
|
||||||
|
*/
|
||||||
|
public void sendOtherPrintMsg(Long shopId, Object data, String printType) {
|
||||||
|
String exchange = activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE;
|
||||||
|
String queueName = activeProfile + "-" + RabbitConstants.Queue.OTHER_PRINT_QUEUE;
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("shopId", shopId);
|
||||||
|
jsonObject.put("data", data);
|
||||||
|
jsonObject.put("printTypeEnum", printType);
|
||||||
|
rabbitTemplate.convertAndSend(exchange, queueName, jsonObject.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendOtherPrintLocalMsg(Long shopId, String printType, Long dataId) {
|
||||||
|
String exchange = activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE;
|
||||||
|
String queueName = activeProfile + "-" + RabbitConstants.Queue.OTHER_PRINT_LOCAL_QUEUE;
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("shopId", shopId);
|
||||||
|
jsonObject.put("dataId", dataId);
|
||||||
|
jsonObject.put("printType", printType);
|
||||||
|
rabbitTemplate.convertAndSend(exchange, queueName, jsonObject.toString());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.czg.config;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* key常量
|
* key常量
|
||||||
|
*
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
public interface RedisCst {
|
public interface RedisCst {
|
||||||
@@ -12,7 +13,6 @@ public interface RedisCst {
|
|||||||
String SYS_LOG_KEY = "sys:log:";
|
String SYS_LOG_KEY = "sys:log:";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* key过期监听
|
* key过期监听
|
||||||
*/
|
*/
|
||||||
@@ -50,11 +50,18 @@ public interface RedisCst {
|
|||||||
// 排队取号全局号码
|
// 排队取号全局号码
|
||||||
String TABLE_CALL_NUMBER = "table:call:number:";
|
String TABLE_CALL_NUMBER = "table:call:number:";
|
||||||
|
|
||||||
String PRINT_ORDER_DETAIL = "print:order:detail:";
|
|
||||||
|
|
||||||
// 点歌地址url
|
// 点歌地址url
|
||||||
String SONG_URL = "song:";
|
String SONG_URL = "song:";
|
||||||
|
|
||||||
|
class kitchen {
|
||||||
|
//后厨总单
|
||||||
|
public static final String ALL = "print:kitchen:all";
|
||||||
|
//菜品单
|
||||||
|
public static final String NORMAL = "print:kitchen:normal";
|
||||||
|
//退菜单
|
||||||
|
public static final String REFUND_ALL = "print:kitchen:refundAll";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static String getLockKey(String sign, Object... args) {
|
static String getLockKey(String sign, Object... args) {
|
||||||
StringBuilder key = new StringBuilder(LOCK_KEY + ":" + sign + ":");
|
StringBuilder key = new StringBuilder(LOCK_KEY + ":" + sign + ":");
|
||||||
@@ -70,9 +77,31 @@ public interface RedisCst {
|
|||||||
return TABLE_CALL_NUMBER + shopId + ":" + callTableId;
|
return TABLE_CALL_NUMBER + shopId + ":" + callTableId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后厨总单
|
||||||
|
*
|
||||||
|
* @param machineId 打印机设备id
|
||||||
|
*/
|
||||||
|
static String kitchenAll(Long orderId, Long machineId) {
|
||||||
|
return kitchen.ALL + orderId + ":" + machineId;
|
||||||
|
}
|
||||||
|
|
||||||
static String getPrintOrderDetailKey(Long orderId, Long detailId) {
|
/**
|
||||||
return PRINT_ORDER_DETAIL + orderId + ":" + detailId;
|
* 后厨单个菜品单
|
||||||
|
*
|
||||||
|
* @param machineId 打印机设备id
|
||||||
|
*/
|
||||||
|
static String kitchenNormal(Long orderId, Long machineId, Long detailId) {
|
||||||
|
return kitchen.NORMAL + orderId + ":" + machineId + ":" + detailId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后厨总单
|
||||||
|
*
|
||||||
|
* @param machineId 打印机设备id
|
||||||
|
*/
|
||||||
|
static String kitchenRefundAll(Long orderId, Long machineId) {
|
||||||
|
return kitchen.REFUND_ALL + orderId + ":" + machineId;
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getSongUrlKey(Long shopId) {
|
static String getSongUrlKey(Long shopId) {
|
||||||
|
|||||||
@@ -53,30 +53,64 @@ public class HandoverRecordDTO implements Serializable {
|
|||||||
* 员工姓名
|
* 员工姓名
|
||||||
*/
|
*/
|
||||||
private String staffName;
|
private String staffName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当班总收入
|
* 营业额
|
||||||
*/
|
*/
|
||||||
private BigDecimal handAmount;
|
private BigDecimal turnover;
|
||||||
/**
|
/**
|
||||||
* 现金收入
|
* 订单额
|
||||||
*/
|
*/
|
||||||
private BigDecimal cashAmount;
|
private BigDecimal orderTurnover;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信收入
|
* 现金收款 cash_pay
|
||||||
*/
|
*/
|
||||||
private BigDecimal wechatAmount;
|
private BigDecimal cash;
|
||||||
/**
|
/**
|
||||||
* 支付宝收入
|
* 微信支付金额 wechat_mini
|
||||||
*/
|
*/
|
||||||
private BigDecimal alipayAmount;
|
private BigDecimal wechat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员支付
|
* 支付宝支付金额 alipay_mini
|
||||||
*/
|
*/
|
||||||
private BigDecimal vipPay;
|
private BigDecimal alipay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员充值
|
* 二维码收款 main_scan
|
||||||
*/
|
*/
|
||||||
private BigDecimal vipRecharge;
|
private BigDecimal selfScan;
|
||||||
|
/**
|
||||||
|
* 扫码收款 back_scan
|
||||||
|
*/
|
||||||
|
private BigDecimal barScan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值
|
||||||
|
*/
|
||||||
|
private BigDecimal recharge;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 挂账 credit_pay
|
||||||
|
*/
|
||||||
|
private BigDecimal owed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额支付 vip_pay
|
||||||
|
*/
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal refundAmount;
|
||||||
|
/**
|
||||||
|
* 退菜数量
|
||||||
|
*/
|
||||||
|
private BigDecimal returnDishCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分类数据 json
|
* 分类数据 json
|
||||||
*/
|
*/
|
||||||
@@ -87,18 +121,7 @@ public class HandoverRecordDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@JSONField(serialize = false)
|
@JSONField(serialize = false)
|
||||||
private String productData;
|
private String productData;
|
||||||
/**
|
|
||||||
* 快捷收款金额
|
|
||||||
*/
|
|
||||||
private BigDecimal quickInAmount;
|
|
||||||
/**
|
|
||||||
* 退款金额
|
|
||||||
*/
|
|
||||||
private BigDecimal refundAmount;
|
|
||||||
/**
|
|
||||||
* 挂账金额
|
|
||||||
*/
|
|
||||||
private BigDecimal creditAmount;
|
|
||||||
/**
|
/**
|
||||||
* 订单数量
|
* 订单数量
|
||||||
*/
|
*/
|
||||||
@@ -124,11 +147,4 @@ public class HandoverRecordDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private List<HandoverProductListVo> productDataList;
|
private List<HandoverProductListVo> productDataList;
|
||||||
|
|
||||||
public List<HandoverCategoryListVo> getCategoryDataList() {
|
|
||||||
return JSON.parseArray(categoryData, HandoverCategoryListVo.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<HandoverProductListVo> getProductDataList() {
|
|
||||||
return JSON.parseArray(productData, HandoverProductListVo.class);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,89 +0,0 @@
|
|||||||
|
|
||||||
package com.czg.account.dto;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
|
||||||
import java.io.Serial;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品分类 实体类。
|
|
||||||
*
|
|
||||||
* @author zs
|
|
||||||
* @since 2025-02-20
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class ShopProdCategoryDTO implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分类名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 简称
|
|
||||||
*/
|
|
||||||
private String shortName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上级分类id-为0则表示是顶级
|
|
||||||
*/
|
|
||||||
private Long pid;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 图标
|
|
||||||
*/
|
|
||||||
private String pic;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 店铺Id
|
|
||||||
*/
|
|
||||||
private Long shopId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分类描述
|
|
||||||
*/
|
|
||||||
private String detail;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 排序
|
|
||||||
*/
|
|
||||||
private Integer sort;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关键词
|
|
||||||
*/
|
|
||||||
private String keyWord;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态 0-禁用 1-启用
|
|
||||||
*/
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime updateTime;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -288,6 +288,10 @@ public class ShopInfoEditDTO {
|
|||||||
* 数签子
|
* 数签子
|
||||||
*/
|
*/
|
||||||
private Integer isCountStick;
|
private Integer isCountStick;
|
||||||
|
/**
|
||||||
|
* 退菜退库存模式 1跟随商品分类 2 跟随单商品
|
||||||
|
*/
|
||||||
|
private Integer refundMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 企业id
|
* 企业id
|
||||||
|
|||||||
@@ -53,30 +53,69 @@ public class HandoverRecord implements Serializable {
|
|||||||
* 员工姓名
|
* 员工姓名
|
||||||
*/
|
*/
|
||||||
private String staffName;
|
private String staffName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当班总收入
|
* 营业额
|
||||||
*/
|
*/
|
||||||
private BigDecimal handAmount;
|
private BigDecimal turnover;
|
||||||
/**
|
/**
|
||||||
* 现金收入
|
* 订单额
|
||||||
*/
|
*/
|
||||||
private BigDecimal cashAmount;
|
private BigDecimal orderTurnover;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信收入
|
* 现金收款 cash_pay
|
||||||
*/
|
*/
|
||||||
private BigDecimal wechatAmount;
|
private BigDecimal cash;
|
||||||
/**
|
/**
|
||||||
* 支付宝收入
|
* 微信支付金额 wechat_mini
|
||||||
*/
|
*/
|
||||||
private BigDecimal alipayAmount;
|
private BigDecimal wechat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员支付
|
* 支付宝支付金额 alipay_mini
|
||||||
*/
|
*/
|
||||||
private BigDecimal vipPay;
|
private BigDecimal alipay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员充值
|
* 二维码收款 main_scan
|
||||||
*/
|
*/
|
||||||
private BigDecimal vipRecharge;
|
private BigDecimal selfScan;
|
||||||
|
/**
|
||||||
|
* 扫码收款 back_scan
|
||||||
|
*/
|
||||||
|
private BigDecimal barScan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 挂账 credit_pay
|
||||||
|
*/
|
||||||
|
private BigDecimal owed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额支付 vip_pay
|
||||||
|
*/
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值
|
||||||
|
*/
|
||||||
|
private BigDecimal recharge;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal refundAmount;
|
||||||
|
/**
|
||||||
|
* 退菜数量
|
||||||
|
*/
|
||||||
|
private BigDecimal returnDishCount;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单数量
|
||||||
|
*/
|
||||||
|
private Integer orderCount;
|
||||||
/**
|
/**
|
||||||
* 分类数据 json
|
* 分类数据 json
|
||||||
*/
|
*/
|
||||||
@@ -85,20 +124,4 @@ public class HandoverRecord implements Serializable {
|
|||||||
* 商品数据 json
|
* 商品数据 json
|
||||||
*/
|
*/
|
||||||
private String productData;
|
private String productData;
|
||||||
/**
|
|
||||||
* 快捷收款金额
|
|
||||||
*/
|
|
||||||
private BigDecimal quickInAmount;
|
|
||||||
/**
|
|
||||||
* 退款金额
|
|
||||||
*/
|
|
||||||
private BigDecimal refundAmount;
|
|
||||||
/**
|
|
||||||
* 挂账金额
|
|
||||||
*/
|
|
||||||
private BigDecimal creditAmount;
|
|
||||||
/**
|
|
||||||
* 订单数量
|
|
||||||
*/
|
|
||||||
private Integer orderCount;
|
|
||||||
}
|
}
|
||||||
@@ -4,16 +4,15 @@ import com.mybatisflex.annotation.Column;
|
|||||||
import com.mybatisflex.annotation.Id;
|
import com.mybatisflex.annotation.Id;
|
||||||
import com.mybatisflex.annotation.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
import com.mybatisflex.annotation.Table;
|
import com.mybatisflex.annotation.Table;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印机设备 实体类。
|
* 打印机设备 实体类。
|
||||||
*
|
*
|
||||||
@@ -21,7 +20,7 @@ import lombok.NoArgsConstructor;
|
|||||||
* @since 2025-02-20
|
* @since 2025-02-20
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Table("tb_print_machine")
|
@Table("tb_print_machine")
|
||||||
@@ -30,8 +29,16 @@ public class PrintMachine implements Serializable {
|
|||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
@Id(keyType = KeyType.Auto)
|
@Id(keyType = KeyType.Auto)
|
||||||
private Integer id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺Id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备名称
|
* 设备名称
|
||||||
@@ -39,12 +46,22 @@ public class PrintMachine implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 现在打印机支持USB 和 网络、蓝牙
|
* 连接方式 USB、云打印、局域网
|
||||||
*/
|
*/
|
||||||
private String connectionType;
|
private String connectionType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ip地址
|
* 打印类型 label标签 cash小票
|
||||||
|
*/
|
||||||
|
private String printType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印机品牌 飞鹅/云想印
|
||||||
|
*/
|
||||||
|
private String brand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ip地址/MAC地址
|
||||||
*/
|
*/
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
@@ -53,46 +70,6 @@ public class PrintMachine implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String port;
|
private String port;
|
||||||
|
|
||||||
/**
|
|
||||||
* 打印类型(分类)label标签cash小票kitchen出品
|
|
||||||
*/
|
|
||||||
private String subType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态 online
|
|
||||||
*/
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 店铺Id
|
|
||||||
*/
|
|
||||||
private Long shopId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分类Id
|
|
||||||
*/
|
|
||||||
private String categoryIds;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 现在打印机支持USB 和 网络两种
|
|
||||||
*/
|
|
||||||
private String contentType;
|
|
||||||
|
|
||||||
@Column(onInsertValue = "now()")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
|
||||||
private LocalDateTime updateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分类
|
|
||||||
*/
|
|
||||||
private List<Object> categoryList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 排序
|
|
||||||
*/
|
|
||||||
private Integer sort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小票尺寸 58mm 80mm
|
* 小票尺寸 58mm 80mm
|
||||||
@@ -100,31 +77,58 @@ public class PrintMachine implements Serializable {
|
|||||||
private String receiptSize;
|
private String receiptSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分类打印 0-所有 1-部分分类 2-部分商品
|
* 打印数量
|
||||||
|
*/
|
||||||
|
private Integer printNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印内容 数组
|
||||||
|
* GUEST_ORDER("客看单"),PRE_ORDER("预结算单"),ORDER("订单结算单"),RETURN_ORDER("退菜单"),REFUND_ORDER("退款单"),
|
||||||
|
* ALL_KITCHEN("后厨整单"),ONLY_KITCHEN("后厨分单"),REFUND_KITCHEN("后厨退菜单"),
|
||||||
|
* HANDOVER("交班单"),CALL("排队取号"),RECHARGE("储值单"),STOCK("出入库单"),STOCK_CHECK("盘点单"),
|
||||||
|
* PRODUCT_REPORT("商品报表"),DAY_REPORT("经营日报"),DAY_ORDER("日结单")
|
||||||
|
*/
|
||||||
|
private String printContentType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印模式(厨房打印菜品) all整单 /only单个
|
||||||
|
*/
|
||||||
|
private String kitchenPrintMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分类打印 0-所有 1-部分分类
|
||||||
*/
|
*/
|
||||||
private String classifyPrint;
|
private String classifyPrint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印数量 c1m1^2=顾客+商家[2张] m1^1=商家[1张] c1^1顾客[1张] c2m1^3顾客2+商家1[3张]
|
* 分类Id
|
||||||
*/
|
*/
|
||||||
private String printQty;
|
private String categoryIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印方式 all-全部打印 normal-仅打印结账单「前台」one-仅打印制作单「厨房」
|
* 0 禁用 1启用
|
||||||
*/
|
*/
|
||||||
private String printMethod;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印类型,JSON数组 refund-确认退款单 handover-交班单 queue-排队取号
|
* 媒体声音开关 0关1开
|
||||||
*/
|
|
||||||
private String printType;
|
|
||||||
/**
|
|
||||||
* 媒体音开关 0-关 1-开
|
|
||||||
*/
|
*/
|
||||||
private Integer volumeSwitch;
|
private Integer volumeSwitch;
|
||||||
/**
|
|
||||||
* 交班打印机开关 0-关 1-开
|
|
||||||
*/
|
|
||||||
private Integer handoverSwitch;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Column(onInsertValue = "now()")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@Column(onUpdateValue = "now()")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
}
|
}
|
||||||
@@ -135,6 +135,10 @@ public class ShopConfig implements Serializable {
|
|||||||
* 数签子
|
* 数签子
|
||||||
*/
|
*/
|
||||||
private Integer isCountStick;
|
private Integer isCountStick;
|
||||||
|
/**
|
||||||
|
* 退菜退库存模式 1跟随商品分类 2 跟随单商品
|
||||||
|
*/
|
||||||
|
private Integer refundMode;
|
||||||
|
|
||||||
|
|
||||||
private String dingAppKey;
|
private String dingAppKey;
|
||||||
|
|||||||
@@ -361,6 +361,11 @@ public class ShopInfo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Column(ignore = true)
|
@Column(ignore = true)
|
||||||
private Integer isCountStick;
|
private Integer isCountStick;
|
||||||
|
/**
|
||||||
|
* 退菜退库存模式 1跟随商品分类 2 跟随单商品
|
||||||
|
*/
|
||||||
|
@Column(ignore = true)
|
||||||
|
private Integer refundMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 运营端余额
|
* 运营端余额
|
||||||
|
|||||||
@@ -1,95 +0,0 @@
|
|||||||
package com.czg.account.entity;
|
|
||||||
|
|
||||||
import com.mybatisflex.annotation.Column;
|
|
||||||
import com.mybatisflex.annotation.Id;
|
|
||||||
import com.mybatisflex.annotation.KeyType;
|
|
||||||
import com.mybatisflex.annotation.Table;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品分类 实体类。
|
|
||||||
*
|
|
||||||
* @author zs
|
|
||||||
* @since 2025-02-20
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Table("tb_shop_prod_category")
|
|
||||||
public class ShopProdCategory implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
@Id(keyType = KeyType.Auto)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分类名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 简称
|
|
||||||
*/
|
|
||||||
private String shortName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上级分类id-为0则表示是顶级
|
|
||||||
*/
|
|
||||||
private Long pid;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 图标
|
|
||||||
*/
|
|
||||||
private String pic;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 店铺Id
|
|
||||||
*/
|
|
||||||
private Long shopId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分类描述
|
|
||||||
*/
|
|
||||||
private String detail;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 排序
|
|
||||||
*/
|
|
||||||
private Integer sort;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关键词
|
|
||||||
*/
|
|
||||||
private String keyWord;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态 0-禁用 1-启用
|
|
||||||
*/
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@Column(onInsertValue = "now()")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
|
||||||
private LocalDateTime updateTime;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -45,7 +45,7 @@ public class ShopUser implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 用户昵称
|
* 用户昵称
|
||||||
*/
|
*/
|
||||||
@ColumnMask(Masks.CHINESE_NAME)
|
// @ColumnMask(Masks.CHINESE_NAME)
|
||||||
private String nickName;
|
private String nickName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -51,14 +51,14 @@ public interface HandoverRecordService extends IService<HandoverRecord> {
|
|||||||
*
|
*
|
||||||
* @return 交班记录ID
|
* @return 交班记录ID
|
||||||
*/
|
*/
|
||||||
Long handover();
|
HandoverRecord handover();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 交班打印小票
|
* 交班打印小票
|
||||||
*
|
*
|
||||||
* @param handoverRecordId 交班记录id
|
* @param record 交班记录
|
||||||
* @param isPrint 是否打印 1-是 0-否
|
* @param isPrint 是否打印 1-是 0-否
|
||||||
*/
|
*/
|
||||||
void printHandoverReceipt(Long handoverRecordId, Integer isPrint);
|
void printHandoverReceipt(HandoverRecord record, Integer isPrint);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
package com.czg.account.service;
|
package com.czg.account.service;
|
||||||
|
|
||||||
import com.czg.account.dto.print.PrinterAddDTO;
|
|
||||||
import com.czg.account.dto.print.PrinterEditDTO;
|
|
||||||
import com.czg.account.dto.print.PrinterOrderDTO;
|
|
||||||
import com.mybatisflex.core.paginate.Page;
|
|
||||||
import com.mybatisflex.core.service.IService;
|
|
||||||
import com.czg.account.entity.PrintMachine;
|
import com.czg.account.entity.PrintMachine;
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印机设备 服务层。
|
* 打印机设备 服务层。
|
||||||
@@ -15,9 +11,9 @@ import com.czg.account.entity.PrintMachine;
|
|||||||
*/
|
*/
|
||||||
public interface PrintMachineService extends IService<PrintMachine> {
|
public interface PrintMachineService extends IService<PrintMachine> {
|
||||||
|
|
||||||
boolean add(Long shopId, PrinterAddDTO printerAddDTO);
|
boolean add(Long shopId, PrintMachine printMachine);
|
||||||
|
|
||||||
Boolean edit(Long shopId, PrinterEditDTO printerEditDTO);
|
Boolean edit(Long shopId, PrintMachine printMachine);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
package com.czg.account.service;
|
|
||||||
|
|
||||||
import com.mybatisflex.core.service.IService;
|
|
||||||
import com.czg.account.entity.ShopProdCategory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品分类 服务层。
|
|
||||||
*
|
|
||||||
* @author zs
|
|
||||||
* @since 2025-02-20
|
|
||||||
*/
|
|
||||||
public interface ShopProdCategoryService extends IService<ShopProdCategory> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -55,17 +55,62 @@ public class HandoverTotalVo implements Serializable {
|
|||||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime handoverTime;
|
private LocalDateTime handoverTime;
|
||||||
/**
|
/**
|
||||||
* 现金支付
|
* 营业额
|
||||||
*/
|
*/
|
||||||
private BigDecimal cashAmount;
|
private BigDecimal turnover;
|
||||||
|
/**
|
||||||
|
* 订单额
|
||||||
|
*/
|
||||||
|
private BigDecimal orderTurnover;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 现金收款 cash_pay
|
||||||
|
*/
|
||||||
|
private BigDecimal cash;
|
||||||
|
/**
|
||||||
|
* 微信支付金额 wechat_mini
|
||||||
|
*/
|
||||||
|
private BigDecimal wechat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付宝支付金额 alipay_mini
|
||||||
|
*/
|
||||||
|
private BigDecimal alipay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二维码收款 main_scan
|
||||||
|
*/
|
||||||
|
private BigDecimal selfScan;
|
||||||
|
/**
|
||||||
|
* 扫码收款 back_scan
|
||||||
|
*/
|
||||||
|
private BigDecimal barScan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值
|
||||||
|
*/
|
||||||
|
private BigDecimal recharge;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 挂账 credit_pay
|
||||||
|
*/
|
||||||
|
private BigDecimal owed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额支付 vip_pay
|
||||||
|
*/
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退款金额
|
* 退款金额
|
||||||
*/
|
*/
|
||||||
private BigDecimal refundAmount;
|
private BigDecimal refundAmount;
|
||||||
/**
|
/**
|
||||||
* 当班总收入(营业额)
|
* 退菜数量
|
||||||
*/
|
*/
|
||||||
private BigDecimal handAmount;
|
private BigDecimal returnDishCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单数量
|
* 订单数量
|
||||||
*/
|
*/
|
||||||
@@ -74,4 +119,8 @@ public class HandoverTotalVo implements Serializable {
|
|||||||
* 售出商品列表
|
* 售出商品列表
|
||||||
*/
|
*/
|
||||||
private List<HandoverProductListVo> detailList;
|
private List<HandoverProductListVo> detailList;
|
||||||
|
/**
|
||||||
|
* 售出商品分类列表
|
||||||
|
*/
|
||||||
|
private List<HandoverCategoryListVo> categoryList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import jakarta.validation.constraints.DecimalMin;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,11 +33,12 @@ public interface MkShopRechargeService extends IService<MkShopRecharge> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 充值
|
* 充值
|
||||||
|
*
|
||||||
* @param isNoJoin 是否没有执行 加入会员的方法
|
* @param isNoJoin 是否没有执行 加入会员的方法
|
||||||
* 会员如果是条件开通 则 需要统计
|
* 会员如果是条件开通 则 需要统计
|
||||||
*/
|
*/
|
||||||
void recharge(Long shopId, Long shopUserId, Long rechargeDetailId, BigDecimal amount, Long paymentId,
|
void recharge(Long shopId, Long shopUserId, Long rechargeDetailId, BigDecimal amount, Long paymentId,
|
||||||
String payType, ShopUserFlowBizEnum bizEnum, boolean isNoJoin);
|
String payType, LocalDateTime payTime, ShopUserFlowBizEnum bizEnum, boolean isNoJoin, String operator);
|
||||||
|
|
||||||
List<RechargeListVO> getList(long loginIdAsLong);
|
List<RechargeListVO> getList(long loginIdAsLong);
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,8 @@ public class OrderInfoPrintDTO implements Serializable {
|
|||||||
@NotNull(message = "id不为空")
|
@NotNull(message = "id不为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 0 菜品和结算单同时打印
|
|
||||||
* 1 预结算单
|
* 1 预结算单
|
||||||
* 2 结算单
|
* 2 结算单
|
||||||
* 3 退菜/退款
|
|
||||||
* 4 交班
|
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "打印类型不为空")
|
@NotNull(message = "打印类型不为空")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|||||||
@@ -50,6 +50,14 @@ public class OrderInfoRefundDTO implements Serializable {
|
|||||||
* 是否是现金退款
|
* 是否是现金退款
|
||||||
*/
|
*/
|
||||||
private boolean cash;
|
private boolean cash;
|
||||||
|
/**
|
||||||
|
* 是否打印退菜/退款票
|
||||||
|
*/
|
||||||
|
private boolean print;
|
||||||
|
/**
|
||||||
|
* 是否退库存
|
||||||
|
*/
|
||||||
|
private boolean refundStock;
|
||||||
|
|
||||||
private String refundReason;
|
private String refundReason;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
package com.czg.order.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import java.io.Serial;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据打印表 实体类。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-04-16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class SysPrintDataDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印数据 Json格式
|
||||||
|
*/
|
||||||
|
private String data;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -162,6 +162,8 @@ public class OrderDetail implements Serializable {
|
|||||||
* 是否等叫
|
* 是否等叫
|
||||||
*/
|
*/
|
||||||
private Integer isWaitCall;
|
private Integer isWaitCall;
|
||||||
|
@Column(ignore = true)
|
||||||
|
private Integer isAutoSoldStock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 套餐商品选择信息
|
* 套餐商品选择信息
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.czg.order.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据打印表 实体类。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-04-16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("sys_print_data")
|
||||||
|
public class SysPrintData implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印类型
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
* 打印数据 Json格式
|
||||||
|
*/
|
||||||
|
private String data;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -56,4 +56,9 @@ public class SaleSummaryCountParam implements Serializable {
|
|||||||
* 店铺id
|
* 店铺id
|
||||||
*/
|
*/
|
||||||
private Long shopId;
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人
|
||||||
|
*/
|
||||||
|
private String operator;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.czg.order.service;
|
|||||||
|
|
||||||
import cn.hutool.core.exceptions.ValidateException;
|
import cn.hutool.core.exceptions.ValidateException;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.czg.account.entity.ShopInfo;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.exception.OrderCancelException;
|
import com.czg.exception.OrderCancelException;
|
||||||
import com.czg.exception.OrderValidateException;
|
import com.czg.exception.OrderValidateException;
|
||||||
@@ -21,6 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单表 服务层。
|
* 订单表 服务层。
|
||||||
@@ -73,4 +75,9 @@ public interface OrderInfoCustomService {
|
|||||||
|
|
||||||
Boolean upOrderDetail(Long shopId, OrderDetailStatusDTO detailStatusDTO);
|
Boolean upOrderDetail(Long shopId, OrderDetailStatusDTO detailStatusDTO);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退单库存问题
|
||||||
|
*/
|
||||||
|
void refundStock(ShopInfo shopInfo, Long orderId, Map<Long,BigDecimal> products, boolean refundStock);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.czg.order.service;
|
package com.czg.order.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.czg.account.entity.HandoverRecord;
|
||||||
import com.czg.account.vo.HandoverCategoryListVo;
|
import com.czg.account.vo.HandoverCategoryListVo;
|
||||||
import com.czg.account.vo.HandoverProductListVo;
|
import com.czg.account.vo.HandoverProductListVo;
|
||||||
|
|
||||||
@@ -15,126 +16,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface OrderInfoRpcService {
|
public interface OrderInfoRpcService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班现金支付统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 现金支付总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverCashAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班微信支付统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 现金支付总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverWechatAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班支付宝支付统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 支付宝支付总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverAlipayAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班VIP支付统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return VIP支付总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverVipPayAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班VIP充值统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return VIP充值总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverVipChargeAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班快捷支付统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 快捷支付总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverQuickPayAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班退款统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 退款总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverRefundAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班挂账统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 挂账总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverCreditAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班营业额统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 营业额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverTotalAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班订单数统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 交班订单数
|
|
||||||
*/
|
|
||||||
int getHandoverOrderNum(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班售出商品明细
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 交班售出商品明细
|
|
||||||
*/
|
|
||||||
List<HandoverProductListVo> getHandoverDetailList(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班售出商品分类统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 售出商品分类统计
|
|
||||||
*/
|
|
||||||
List<HandoverCategoryListVo> getHandoverCategoryList(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单支付成功回调 扣减商品库存及耗材库存
|
* 订单支付成功回调 扣减商品库存及耗材库存
|
||||||
*
|
*
|
||||||
@@ -159,7 +40,47 @@ public interface OrderInfoRpcService {
|
|||||||
/**
|
/**
|
||||||
* 订单交班回调 发送答应交班小票消息至MQ
|
* 订单交班回调 发送答应交班小票消息至MQ
|
||||||
*
|
*
|
||||||
* @param handoverRecordId 交班记录id
|
* @param record 交班记录id
|
||||||
*/
|
*/
|
||||||
void sendHandoverReceiptPrintMsgToMq(Long handoverRecordId);
|
void sendHandoverReceiptPrintMsgToMq(Long shopId, HandoverRecord record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交班售出商品明细
|
||||||
|
*
|
||||||
|
* @param shopId 店铺id
|
||||||
|
* @param loginTime 上岗时间
|
||||||
|
* @param handoverTime 交班时间
|
||||||
|
* @return 交班售出商品明细
|
||||||
|
*/
|
||||||
|
List<HandoverProductListVo> getHandoverDetailList(Long shopId, String loginTime, String handoverTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交班售出商品分类统计
|
||||||
|
*
|
||||||
|
* @param shopId 店铺id
|
||||||
|
* @param loginTime 上岗时间
|
||||||
|
* @param handoverTime 交班时间
|
||||||
|
* @return 售出商品分类统计
|
||||||
|
*/
|
||||||
|
List<HandoverCategoryListVo> getHandoverCategoryList(Long shopId, String loginTime, String handoverTime);
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------->
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付金额统计
|
||||||
|
* 营业额为 订单收款额度 不包括充值
|
||||||
|
*/
|
||||||
|
HandoverRecord getOnlinePayTypeDate(Long shopId, String loginTime, String handoverTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单退菜数量
|
||||||
|
*/
|
||||||
|
BigDecimal countReturnDish(Long shopId, String loginTime, String handoverTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员充值金额 退款金额
|
||||||
|
*/
|
||||||
|
HandoverRecord countShopUserFlow(Long shopId, String loginTime, String handoverTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,22 +23,30 @@ public interface ShopProdStatisticService extends IService<ShopProdStatistic> {
|
|||||||
*/
|
*/
|
||||||
SaleSummaryCountVo summaryCount(SaleSummaryCountParam param);
|
SaleSummaryCountVo summaryCount(SaleSummaryCountParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印 商品交易数据
|
||||||
|
*/
|
||||||
|
void summaryPrint(SaleSummaryCountParam param);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某一段时间的商品交易数据
|
* 获取某一段时间的商品交易数据
|
||||||
* shopId 店铺id
|
* shopId 店铺id
|
||||||
* rangeType 时间范围类型
|
* rangeType 时间范围类型
|
||||||
* TODAY, // 今天
|
* TODAY, // 今天
|
||||||
* YESTERDAY, // 昨天
|
* YESTERDAY, // 昨天
|
||||||
* LAST_7_DAYS, // 最近7天
|
* LAST_7_DAYS, // 最近7天
|
||||||
* LAST_30_DAYS,// 最近30天
|
* LAST_30_DAYS,// 最近30天
|
||||||
* THIS_WEEK, // 本周
|
* THIS_WEEK, // 本周
|
||||||
* THIS_MONTH // 本月
|
* THIS_MONTH // 本月
|
||||||
* CUSTOM // 自定义时间范围
|
* CUSTOM // 自定义时间范围
|
||||||
* start 开始时间 格式yyyy-MM-dd 今天/昨天不用传
|
* start 开始时间 格式yyyy-MM-dd 今天/昨天不用传
|
||||||
* end 结束时间 格式yyyy-MM-dd 今天/昨天不用传
|
* end 结束时间 格式yyyy-MM-dd 今天/昨天不用传
|
||||||
|
*
|
||||||
* @return 商品数据
|
* @return 商品数据
|
||||||
*/
|
*/
|
||||||
List<ShopProdStatistic> getArchiveTradeData(SaleSummaryCountParam param);
|
List<ShopProdStatistic> getArchiveTradeData(SaleSummaryCountParam param);
|
||||||
|
|
||||||
List<ShopProdStatistic> getArchiveTradeDataBy10(Long shopId, Integer day);
|
List<ShopProdStatistic> getArchiveTradeDataBy10(Long shopId, Integer day);
|
||||||
|
|
||||||
//------------------------------------------------------------下列为 后台使用------------------------------------------------------------
|
//------------------------------------------------------------下列为 后台使用------------------------------------------------------------
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.order.service;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.czg.order.entity.SysPrintData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据打印表 服务层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-04-16
|
||||||
|
*/
|
||||||
|
public interface SysPrintDataService extends IService<SysPrintData> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@ public class OrderDetailSmallVO implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
private Long productId;
|
||||||
private String productImg;
|
private String productImg;
|
||||||
private String productName;
|
private String productName;
|
||||||
private String skuName;
|
private String skuName;
|
||||||
|
|||||||
@@ -0,0 +1,162 @@
|
|||||||
|
package com.czg.print;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经营日报
|
||||||
|
* @author Administrator
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class DayReportPrintDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
/**
|
||||||
|
* 店铺名称
|
||||||
|
*/
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人
|
||||||
|
*/
|
||||||
|
private String operator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计时间
|
||||||
|
*/
|
||||||
|
private String statisticsTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal refundAmount;
|
||||||
|
/**
|
||||||
|
* 退菜数量
|
||||||
|
*/
|
||||||
|
private Long returnDishCount;
|
||||||
|
/**
|
||||||
|
* 营业额
|
||||||
|
*/
|
||||||
|
private TurnoverSts turnover;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单
|
||||||
|
*/
|
||||||
|
private OrderSts order;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据统计
|
||||||
|
*/
|
||||||
|
private Sts sts;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业额 类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class TurnoverSts {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业额
|
||||||
|
*/
|
||||||
|
private BigDecimal turnover;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付金额
|
||||||
|
*/
|
||||||
|
private BigDecimal wechat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付宝支付金额
|
||||||
|
*/
|
||||||
|
private BigDecimal alipay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二维码收款
|
||||||
|
*/
|
||||||
|
private BigDecimal selfScan;
|
||||||
|
/**
|
||||||
|
* 扫码收款
|
||||||
|
*/
|
||||||
|
private BigDecimal barScan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 现金收款
|
||||||
|
*/
|
||||||
|
private BigDecimal cash;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值
|
||||||
|
*/
|
||||||
|
private BigDecimal recharge;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 挂账
|
||||||
|
*/
|
||||||
|
private BigDecimal owed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额支付
|
||||||
|
*/
|
||||||
|
private BigDecimal balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单 类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class OrderSts {
|
||||||
|
/**
|
||||||
|
* 订单金额
|
||||||
|
*/
|
||||||
|
private BigDecimal orderAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单总数
|
||||||
|
*/
|
||||||
|
private Long orderCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据统计 类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class Sts {
|
||||||
|
/**
|
||||||
|
* 就餐人数
|
||||||
|
*/
|
||||||
|
private Long customerCount;
|
||||||
|
/**
|
||||||
|
* 客单价
|
||||||
|
* 实付金额(包含现金支付 包含会员支付 包含挂账)/就餐人数
|
||||||
|
* 没有具体人数时,默认一桌按照1人计算
|
||||||
|
*/
|
||||||
|
private BigDecimal avgPayAmount;
|
||||||
|
/**
|
||||||
|
* 翻台率
|
||||||
|
* (订单数-桌台数)/桌台数*100%
|
||||||
|
*/
|
||||||
|
private BigDecimal turnoverRate;
|
||||||
|
/**
|
||||||
|
* 商品成本
|
||||||
|
*/
|
||||||
|
private BigDecimal productCostAmount;
|
||||||
|
/**
|
||||||
|
* 毛利率(订单实付金额-商品成本)/订单实付金额*100%
|
||||||
|
*/
|
||||||
|
private BigDecimal profitRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.czg.print;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单打印实体
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class OrderPrintDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
// 打印标题 结算单/客看单/预结算单 退菜单/退款单
|
||||||
|
private String printTitle;
|
||||||
|
private String shopName;
|
||||||
|
//打印类型 收银-堂食
|
||||||
|
private String printType;
|
||||||
|
//台桌区域-台桌号
|
||||||
|
private String pickupNum;
|
||||||
|
private String orderNo;
|
||||||
|
//结账时间
|
||||||
|
private String tradeDate;
|
||||||
|
//操作人名称
|
||||||
|
private String operator;
|
||||||
|
private String payAmount;
|
||||||
|
private String originalAmount;
|
||||||
|
private String payType;
|
||||||
|
private String remark;
|
||||||
|
//取餐码
|
||||||
|
private String outNumber;
|
||||||
|
private String discountAmount;
|
||||||
|
private String seatNum;
|
||||||
|
private String seatAmount;
|
||||||
|
private String packFee;
|
||||||
|
// 是否退款单
|
||||||
|
private boolean isReturn;
|
||||||
|
//退款单用
|
||||||
|
private String refundAmount;
|
||||||
|
//退款方式 现金退款/原路退回
|
||||||
|
private String refundType;
|
||||||
|
//退款原因
|
||||||
|
private String refundReason;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
package com.czg.print;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品报表打印实体
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class ProductReportPrintDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
/**
|
||||||
|
* 店铺名称
|
||||||
|
*/
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印时间
|
||||||
|
*/
|
||||||
|
private String printTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人
|
||||||
|
*/
|
||||||
|
private String operator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计时间
|
||||||
|
*/
|
||||||
|
private String statisticsTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总计商品数量
|
||||||
|
*/
|
||||||
|
private BigDecimal totalProductCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总计实收金额
|
||||||
|
*/
|
||||||
|
private BigDecimal totalActualAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品明细列表
|
||||||
|
* 分类名称,商品集合
|
||||||
|
*/
|
||||||
|
private List<CategoryItem> items;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class CategoryItem {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品名称(第二列商品名称)
|
||||||
|
*/
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量(第三列数量)
|
||||||
|
*/
|
||||||
|
private BigDecimal number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实收(第四列)
|
||||||
|
*/
|
||||||
|
private BigDecimal actualAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售额(第五列)
|
||||||
|
*/
|
||||||
|
private BigDecimal salesAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品明细列表
|
||||||
|
*/
|
||||||
|
private List<ProductItem> productItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProductItem createProductItem(String productName, BigDecimal number, BigDecimal actualAmount, BigDecimal salesAmount) {
|
||||||
|
ProductItem item = new ProductItem();
|
||||||
|
item.setProductName(productName);
|
||||||
|
item.setNumber(number);
|
||||||
|
item.setActualAmount(actualAmount);
|
||||||
|
item.setSalesAmount(salesAmount);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品明细项
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class ProductItem {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品名称(第二列商品名称)
|
||||||
|
*/
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量(第三列数量)
|
||||||
|
*/
|
||||||
|
private BigDecimal number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实收(第四列)
|
||||||
|
*/
|
||||||
|
private BigDecimal actualAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售额(第五列)
|
||||||
|
*/
|
||||||
|
private BigDecimal salesAmount;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.czg.print;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 储值单
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class RechargePrintDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
//店铺名称
|
||||||
|
private String shopName;
|
||||||
|
private Long userId;
|
||||||
|
private String userName;
|
||||||
|
private String userPhone;
|
||||||
|
//支付时间
|
||||||
|
private LocalDateTime payTime;
|
||||||
|
|
||||||
|
//充值金额
|
||||||
|
private BigDecimal rechargeAmount;
|
||||||
|
//赠送金额
|
||||||
|
private BigDecimal giftAmount;
|
||||||
|
//赠送积分
|
||||||
|
private BigDecimal giftPoints;
|
||||||
|
//赠送优惠券 张
|
||||||
|
private Integer giftCoupon;
|
||||||
|
//充值后余额
|
||||||
|
private BigDecimal balance;
|
||||||
|
//已付金额
|
||||||
|
// private BigDecimal payAmount;
|
||||||
|
//支付方式
|
||||||
|
private String payType;
|
||||||
|
//操作员
|
||||||
|
private String operator;
|
||||||
|
//充值编号
|
||||||
|
private String rechargeId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package com.czg.print;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 盘点单打印实体
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class StockCheckPrintDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺名称
|
||||||
|
*/
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 耗材明细列表
|
||||||
|
*/
|
||||||
|
private List<StockCheckItem> items;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账存数量
|
||||||
|
*/
|
||||||
|
private Integer winLossNumberCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 盈亏金额
|
||||||
|
*/
|
||||||
|
private BigDecimal winLossAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作员
|
||||||
|
*/
|
||||||
|
private String operator;
|
||||||
|
|
||||||
|
public StockCheckItem createStockCheckItem(String consName, BigDecimal price, String unit, BigDecimal actualNumber, BigDecimal winLossNumber) {
|
||||||
|
return new StockCheckItem(consName, price, unit, actualNumber, winLossNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库耗材明细
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class StockCheckItem {
|
||||||
|
/**
|
||||||
|
* 耗材名称
|
||||||
|
*/
|
||||||
|
private String consName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单价
|
||||||
|
*/
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实际数
|
||||||
|
*/
|
||||||
|
private BigDecimal actualNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 盈亏数
|
||||||
|
*/
|
||||||
|
private BigDecimal winLossNumber;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
package com.czg.print;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库打印单
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class StockPrintDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
//IN OUT
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
* 店铺名称
|
||||||
|
*/
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出入库时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime inStockTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出入库耗材明细列表
|
||||||
|
*/
|
||||||
|
private List<InStockItem> items;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 耗材总种类数
|
||||||
|
*/
|
||||||
|
private Integer consCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出入库总数量
|
||||||
|
*/
|
||||||
|
private BigDecimal stockNumberCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总金额
|
||||||
|
*/
|
||||||
|
private BigDecimal amountCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作员
|
||||||
|
*/
|
||||||
|
private String operator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime printTime;
|
||||||
|
|
||||||
|
|
||||||
|
public InStockItem createInStockItem(String consName, String unit, BigDecimal stockNumber, BigDecimal amount) {
|
||||||
|
InStockItem item = new InStockItem();
|
||||||
|
item.setConsName(consName);
|
||||||
|
item.setUnit(unit);
|
||||||
|
item.setStockNumber(stockNumber);
|
||||||
|
item.setAmount(amount);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库耗材明细
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class InStockItem {
|
||||||
|
/**
|
||||||
|
* 耗材名称
|
||||||
|
*/
|
||||||
|
private String consName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存单位
|
||||||
|
*/
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出入数量
|
||||||
|
*/
|
||||||
|
private BigDecimal stockNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 金额
|
||||||
|
*/
|
||||||
|
private BigDecimal amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -76,10 +76,6 @@ public class ConsInfoDTO implements Serializable {
|
|||||||
* 是否检测耗材: 1 检测 0 不检测
|
* 是否检测耗材: 1 检测 0 不检测
|
||||||
*/
|
*/
|
||||||
private Integer isStock;
|
private Integer isStock;
|
||||||
/**
|
|
||||||
* 是否退款退回: 1 退回 0 不退回
|
|
||||||
*/
|
|
||||||
private Integer isRefundStock;
|
|
||||||
/**
|
/**
|
||||||
* 第二单位
|
* 第二单位
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class ProdConsRelationDTO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 商品id
|
* 商品id
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "商品id不能为空", groups = DefaultGroup.class)
|
// @NotNull(message = "商品id不能为空", groups = DefaultGroup.class)
|
||||||
private Long productId;
|
private Long productId;
|
||||||
/**
|
/**
|
||||||
* 耗材id
|
* 耗材id
|
||||||
@@ -41,6 +41,10 @@ public class ProdConsRelationDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@NotNull(message = "使用数量不能为空", groups = DefaultGroup.class)
|
@NotNull(message = "使用数量不能为空", groups = DefaultGroup.class)
|
||||||
private BigDecimal surplusStock;
|
private BigDecimal surplusStock;
|
||||||
|
/**
|
||||||
|
* 耗材预警值
|
||||||
|
*/
|
||||||
|
private BigDecimal conWarning;
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -108,10 +108,6 @@ public class ProductDTO implements Serializable {
|
|||||||
* 套餐内容
|
* 套餐内容
|
||||||
*/
|
*/
|
||||||
private Object groupSnap;
|
private Object groupSnap;
|
||||||
/**
|
|
||||||
* 库存警戒线
|
|
||||||
*/
|
|
||||||
private Integer warnLine;
|
|
||||||
/**
|
/**
|
||||||
* 称重 价格/千克
|
* 称重 价格/千克
|
||||||
*/
|
*/
|
||||||
@@ -155,23 +151,22 @@ public class ProductDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@NotNull(message = "是否推荐不能为空", groups = DefaultGroup.class)
|
@NotNull(message = "是否推荐不能为空", groups = DefaultGroup.class)
|
||||||
private Integer isHot;
|
private Integer isHot;
|
||||||
/**
|
|
||||||
* 是否开启库存
|
|
||||||
*/
|
|
||||||
@NotNull(message = "库存开关不能为空", groups = DefaultGroup.class)
|
|
||||||
private Integer isStock;
|
|
||||||
/**
|
/**
|
||||||
* 是否售罄
|
* 是否售罄
|
||||||
*/
|
*/
|
||||||
private Integer isSoldStock;
|
private Integer isSoldStock;
|
||||||
|
/**
|
||||||
|
* 是否自动售罄
|
||||||
|
*/
|
||||||
|
private Integer isAutoSoldStock;
|
||||||
|
/**
|
||||||
|
* 退菜是否退库存 1退菜退库存 2仅退菜不退库存 3每次询问-退菜后弹窗提示
|
||||||
|
*/
|
||||||
|
private Integer refundMode;
|
||||||
/**
|
/**
|
||||||
* 团购卷分类,可有多个分类
|
* 团购卷分类,可有多个分类
|
||||||
*/
|
*/
|
||||||
private String groupCategoryId;
|
private String groupCategoryId;
|
||||||
/**
|
|
||||||
* 商品级库存数量
|
|
||||||
*/
|
|
||||||
private Integer stockNumber;
|
|
||||||
/**
|
/**
|
||||||
* 是否上架
|
* 是否上架
|
||||||
*/
|
*/
|
||||||
@@ -249,13 +244,6 @@ public class ProductDTO implements Serializable {
|
|||||||
return JSON.parseArray(Convert.toStr(images, "[]"));
|
return JSON.parseArray(Convert.toStr(images, "[]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {"口味":[{"甜度":["少甜","中甜","多甜"]},{"辣度":["微辣","重辣","变态辣"]},{"小料":["葱花","香菜","折耳根"]}]}
|
|
||||||
*/
|
|
||||||
public Object getSelectSpecInfo() {
|
|
||||||
return JSON.parseObject(Convert.toStr(selectSpecInfo, "{}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getGroupSnap() {
|
public Object getGroupSnap() {
|
||||||
return JSON.parseArray(Convert.toStr(groupSnap, "[]"));
|
return JSON.parseArray(Convert.toStr(groupSnap, "[]"));
|
||||||
}
|
}
|
||||||
@@ -271,4 +259,10 @@ public class ProductDTO implements Serializable {
|
|||||||
|
|
||||||
return "[]";
|
return "[]";
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* {"口味":[{"甜度":["少甜","中甜","多甜"]},{"辣度":["微辣","重辣","变态辣"]},{"小料":["葱花","香菜","折耳根"]}]}
|
||||||
|
*/
|
||||||
|
public Object getSelectSpecInfo() {
|
||||||
|
return JSON.parseObject(Convert.toStr(selectSpecInfo, "{}"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -80,4 +80,8 @@ public class ShopProdCategoryDTO implements Serializable {
|
|||||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退菜是否退库存 1退菜退库存 2仅退菜不退库存 3每次询问-退菜后弹窗提示
|
||||||
|
*/
|
||||||
|
private Integer refundMode;
|
||||||
}
|
}
|
||||||
@@ -69,10 +69,6 @@ public class ConsInfo implements Serializable {
|
|||||||
* 是否检测耗材: 1 检测 0 不检测
|
* 是否检测耗材: 1 检测 0 不检测
|
||||||
*/
|
*/
|
||||||
private Integer isStock;
|
private Integer isStock;
|
||||||
/**
|
|
||||||
* 是否退款退回: 1 退回 0 不退回
|
|
||||||
*/
|
|
||||||
private Integer isRefundStock;
|
|
||||||
/**
|
/**
|
||||||
* 第二单位
|
* 第二单位
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -39,10 +39,12 @@ public class ConsStockFlow implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long vendorId;
|
private Long vendorId;
|
||||||
/**
|
/**
|
||||||
|
* {@link com.czg.product.enums.InOutTypeEnum}
|
||||||
* 出入库类型 in-入库 out-出库
|
* 出入库类型 in-入库 out-出库
|
||||||
*/
|
*/
|
||||||
private String inOutType;
|
private String inOutType;
|
||||||
/**
|
/**
|
||||||
|
* {@link com.czg.product.enums.InOutItemEnum}
|
||||||
* 出入库名目 manual-in:手动入库 manual-out:手动出库 win-in:盘盈入库 loss-out:盘亏出库 order-in:订单退款入库 order-out:订单消费出库 damage-out:损耗出库
|
* 出入库名目 manual-in:手动入库 manual-out:手动出库 win-in:盘盈入库 loss-out:盘亏出库 order-in:订单退款入库 order-out:订单消费出库 damage-out:损耗出库
|
||||||
*/
|
*/
|
||||||
private String inOutItem;
|
private String inOutItem;
|
||||||
|
|||||||
@@ -83,10 +83,6 @@ public class Product implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String groupSnap;
|
private String groupSnap;
|
||||||
/**
|
/**
|
||||||
* 库存警戒线
|
|
||||||
*/
|
|
||||||
private Integer warnLine;
|
|
||||||
/**
|
|
||||||
* 称重 价格/千克
|
* 称重 价格/千克
|
||||||
*/
|
*/
|
||||||
private BigDecimal weight;
|
private BigDecimal weight;
|
||||||
@@ -119,9 +115,13 @@ public class Product implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer isHot;
|
private Integer isHot;
|
||||||
/**
|
/**
|
||||||
* 是否开启库存
|
* 是否自动售罄
|
||||||
*/
|
*/
|
||||||
private Integer isStock;
|
private Integer isAutoSoldStock;
|
||||||
|
/**
|
||||||
|
* 退菜是否退库存 1退菜退库存 2仅退菜不退库存 3每次询问-退菜后弹窗提示
|
||||||
|
*/
|
||||||
|
private Integer refundMode;
|
||||||
/**
|
/**
|
||||||
* 是否售罄
|
* 是否售罄
|
||||||
*/
|
*/
|
||||||
@@ -131,10 +131,6 @@ public class Product implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String groupCategoryId;
|
private String groupCategoryId;
|
||||||
/**
|
/**
|
||||||
* 商品库存数量
|
|
||||||
*/
|
|
||||||
private Integer stockNumber;
|
|
||||||
/**
|
|
||||||
* 是否上架
|
* 是否上架
|
||||||
*/
|
*/
|
||||||
private Integer isSale;
|
private Integer isSale;
|
||||||
|
|||||||
@@ -68,6 +68,10 @@ public class ShopProdCategory implements Serializable {
|
|||||||
* 状态 0-禁用 1-启用
|
* 状态 0-禁用 1-启用
|
||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 退菜是否退库存 1退菜退库存 2仅退菜不退库存 3每次询问-退菜后弹窗提示
|
||||||
|
*/
|
||||||
|
private Integer refundMode;
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ public class ConsCheckStockParam implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@NotBlank(message = "耗材名称不能为空", groups = DefaultGroup.class)
|
@NotBlank(message = "耗材名称不能为空", groups = DefaultGroup.class)
|
||||||
private String conName;
|
private String conName;
|
||||||
|
private String operator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账存数量
|
* 账存数量
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -69,4 +69,9 @@ public class ConsInOutStockHeadParam implements Serializable {
|
|||||||
* 未入库信息
|
* 未入库信息
|
||||||
*/
|
*/
|
||||||
private List<SaleOrderDTO.Item> unInCons;
|
private List<SaleOrderDTO.Item> unInCons;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作员
|
||||||
|
*/
|
||||||
|
private String operator;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.czg.product.param;
|
||||||
|
|
||||||
|
import com.czg.validator.group.DefaultGroup;
|
||||||
|
import jakarta.validation.constraints.Max;
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品上下架参数
|
||||||
|
*
|
||||||
|
* @author tankaikai
|
||||||
|
* @since 2025-02-18 17:46
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ProductIsAutoSaleParam implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "商品id能为空", groups = DefaultGroup.class)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否上下架 1-上架,0-下架
|
||||||
|
*/
|
||||||
|
@NotNull(message = "自动售罄不能为空", groups = DefaultGroup.class)
|
||||||
|
@Min(value = 0, message = "自动售罄必须是0或1", groups = DefaultGroup.class)
|
||||||
|
@Max(value = 1, message = "自动售罄必须是0或1", groups = DefaultGroup.class)
|
||||||
|
private Integer isAutoSoldStock;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
package com.czg.product.param;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
|
||||||
import com.czg.validator.group.DefaultGroup;
|
|
||||||
import jakarta.validation.constraints.Max;
|
|
||||||
import jakarta.validation.constraints.Min;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品修改库存
|
|
||||||
*
|
|
||||||
* @author Tankaikai tankaikai@aliyun.com
|
|
||||||
* @since 1.0 2025-02-16
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ProductModifyStockParam implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "ID不能为空", groups = DefaultGroup.class)
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 库存数量
|
|
||||||
*/
|
|
||||||
@NotNull(message = "库存数量不能为空", groups = DefaultGroup.class)
|
|
||||||
@Min(value = 0, message = "库存数量不能小于0", groups = DefaultGroup.class)
|
|
||||||
@Max(value = Integer.MAX_VALUE, message = "库存数量不能大于" + Integer.MAX_VALUE, groups = DefaultGroup.class)
|
|
||||||
private Integer stockNumber;
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
/**
|
|
||||||
* 店铺id
|
|
||||||
*/
|
|
||||||
@JSONField(serialize = false)
|
|
||||||
private Long shopId;
|
|
||||||
}
|
|
||||||
@@ -5,6 +5,7 @@ import com.czg.product.entity.ConsInfo;
|
|||||||
import com.czg.product.param.ConsInfoParam;
|
import com.czg.product.param.ConsInfoParam;
|
||||||
import com.czg.product.param.ConsSubUnitParam;
|
import com.czg.product.param.ConsSubUnitParam;
|
||||||
import com.czg.product.vo.ConsStatisticsVo;
|
import com.czg.product.vo.ConsStatisticsVo;
|
||||||
|
import com.czg.product.vo.ConsStockRecord;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
|
|
||||||
@@ -33,6 +34,9 @@ public interface ConsInfoService extends IService<ConsInfo> {
|
|||||||
*/
|
*/
|
||||||
List<ConsInfoDTO> getConsInfoList(ConsInfoDTO param);
|
List<ConsInfoDTO> getConsInfoList(ConsInfoDTO param);
|
||||||
|
|
||||||
|
|
||||||
|
List<ConsStockRecord> getConsStockList(Long shopId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取耗材信息详情
|
* 获取耗材信息详情
|
||||||
*
|
*
|
||||||
@@ -87,10 +91,6 @@ public interface ConsInfoService extends IService<ConsInfo> {
|
|||||||
*/
|
*/
|
||||||
void onOffConsInfo(Long id, Integer isStock);
|
void onOffConsInfo(Long id, Integer isStock);
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否退款退回
|
|
||||||
*/
|
|
||||||
void isRefundStockConsInfo(Long id, Integer isRefundStock);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改耗材单位
|
* 修改耗材单位
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.czg.product.vo.ConsCheckStockRecordVo;
|
|||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,6 +67,7 @@ public interface ConsStockFlowService extends IService<ConsStockFlow> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取耗材库存变动记录
|
* 获取耗材库存变动记录
|
||||||
|
*
|
||||||
* @param param 查询参数
|
* @param param 查询参数
|
||||||
* @return 分页数据
|
* @return 分页数据
|
||||||
*/
|
*/
|
||||||
@@ -73,7 +75,16 @@ public interface ConsStockFlowService extends IService<ConsStockFlow> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存库存变动记录
|
* 保存库存变动记录
|
||||||
|
*
|
||||||
* @param entity 库存变动记录实体
|
* @param entity 库存变动记录实体
|
||||||
*/
|
*/
|
||||||
void saveFlow(ConsStockFlow entity);
|
void saveFlow(ConsStockFlow entity, BigDecimal conWarning);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送库存消息
|
||||||
|
*
|
||||||
|
* @param entity 库存变动记录实体
|
||||||
|
* @param warning 警戒值
|
||||||
|
*/
|
||||||
|
boolean sendStockMsg(ConsStockFlow entity, BigDecimal warning);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,10 @@ public interface ProdConsRelationService extends IService<ProdConsRelation> {
|
|||||||
* 保存商品耗材绑定关系
|
* 保存商品耗材绑定关系
|
||||||
*
|
*
|
||||||
* @param dto 商品耗材绑定关系DTO
|
* @param dto 商品耗材绑定关系DTO
|
||||||
* @return 保存结果
|
|
||||||
*/
|
*/
|
||||||
void saveProdConsRelation(ProdConsBindDTO dto);
|
void saveProdConsRelation(ProdConsBindDTO dto);
|
||||||
|
|
||||||
|
List<ProdConsRelationDTO> selectListByProdId(Long prodId);
|
||||||
|
|
||||||
|
List<ProdConsRelationDTO> selectStockByProdId(Long prodId);
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.czg.product.service;
|
package com.czg.product.service;
|
||||||
|
|
||||||
|
import com.czg.product.vo.ProductStockVO;
|
||||||
import com.czg.product.vo.ProductVO;
|
import com.czg.product.vo.ProductVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品RPC远程调用服务接口
|
* 商品RPC远程调用服务接口
|
||||||
@@ -20,24 +20,23 @@ public interface ProductRpcService {
|
|||||||
* @param orderId 订单ID
|
* @param orderId 订单ID
|
||||||
* @param dataList 库存扣减数据
|
* @param dataList 库存扣减数据
|
||||||
*/
|
*/
|
||||||
void paySuccessSubtractStock(Long shopId, Long orderId, List<Map<String, Object>> dataList);
|
void paySuccessSubtractStock(Long shopId, Long orderId, List<ProductStockVO> dataList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单取消后恢复库存
|
* 订单取消后恢复库存
|
||||||
*
|
*
|
||||||
* @param shopId 店铺id
|
* @param shopId 店铺id
|
||||||
* @param orderId 订单ID
|
* @param orderId 订单ID
|
||||||
* @param dataList 库存恢复数据
|
|
||||||
*/
|
*/
|
||||||
void orderCancelRecoverStock(Long shopId, Long orderId, List<Map<String, Object>> dataList);
|
void orderCancelRecoverStock(Long shopId, Long orderId, List<ProductStockVO> list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单退菜或退款后回退库存
|
* 订单退菜或退款后回退库存
|
||||||
* @param shopId 店铺id
|
* @param shopId 店铺id
|
||||||
* @param orderId 订单ID
|
* @param orderId 订单ID
|
||||||
* @param dataList 库存恢复数据
|
* @param list 库存恢复数据
|
||||||
*/
|
*/
|
||||||
void orderRefundReturnStock(Long shopId, Long orderId, List<Map<String, Object>> dataList);
|
void orderRefundReturnStock(Long shopId, Long orderId, List<ProductStockVO> list);
|
||||||
|
|
||||||
List<ProductVO> listAndLowPrice(Long shopId, List<Long> productIds);
|
List<ProductVO> listAndLowPrice(Long shopId, List<Long> productIds);
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,11 @@ package com.czg.product.service;
|
|||||||
import com.czg.product.dto.ProductDTO;
|
import com.czg.product.dto.ProductDTO;
|
||||||
import com.czg.product.entity.Product;
|
import com.czg.product.entity.Product;
|
||||||
import com.czg.product.entity.ProductStockFlow;
|
import com.czg.product.entity.ProductStockFlow;
|
||||||
|
import com.czg.product.enums.InOutItemEnum;
|
||||||
|
import com.czg.product.enums.InOutTypeEnum;
|
||||||
import com.czg.product.param.*;
|
import com.czg.product.param.*;
|
||||||
import com.czg.product.vo.ProductStatisticsVo;
|
import com.czg.product.vo.ProductStatisticsVo;
|
||||||
|
import com.czg.product.vo.ProductStockVO;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
@@ -39,10 +42,11 @@ public interface ProductService extends IService<Product> {
|
|||||||
/**
|
/**
|
||||||
* 从缓存里面获取商品列表
|
* 从缓存里面获取商品列表
|
||||||
*
|
*
|
||||||
* @param param 查询参数
|
* @param shopId 店铺ID
|
||||||
|
* @param categoryId 商品分类ID
|
||||||
* @return 商品列表数据
|
* @return 商品列表数据
|
||||||
*/
|
*/
|
||||||
List<ProductDTO> getProductCacheList(ProductDTO param);
|
List<ProductDTO> getProductCacheList(Long shopId, Long categoryId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清除某个商品分类的缓存
|
* 清除某个商品分类的缓存
|
||||||
@@ -71,13 +75,6 @@ public interface ProductService extends IService<Product> {
|
|||||||
*/
|
*/
|
||||||
void updateProduct(ProductDTO dto);
|
void updateProduct(ProductDTO dto);
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品库存数量
|
|
||||||
*
|
|
||||||
* @param param 商品id及库存数量
|
|
||||||
*/
|
|
||||||
void updateProductStock(ProductModifyStockParam param);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除商品
|
* 删除商品
|
||||||
*
|
*
|
||||||
@@ -100,6 +97,13 @@ public interface ProductService extends IService<Product> {
|
|||||||
*/
|
*/
|
||||||
void markProductIsSoldOut(ProductIsSoldOutParam param);
|
void markProductIsSoldOut(ProductIsSoldOutParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标记商品自动售罄
|
||||||
|
*
|
||||||
|
* @param param 入参
|
||||||
|
*/
|
||||||
|
void markProductIsAutoSoldOut(Long shopId, ProductIsAutoSaleParam param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退货到库存
|
* 退货到库存
|
||||||
*
|
*
|
||||||
@@ -107,12 +111,6 @@ public interface ProductService extends IService<Product> {
|
|||||||
*/
|
*/
|
||||||
void refundToStock(ProdRefundToStockParam param);
|
void refundToStock(ProdRefundToStockParam param);
|
||||||
|
|
||||||
/**
|
|
||||||
* 库存预警
|
|
||||||
*
|
|
||||||
* @param warnLine 预警线
|
|
||||||
*/
|
|
||||||
void stockWarning(Integer warnLine);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品报损
|
* 商品报损
|
||||||
@@ -137,11 +135,7 @@ public interface ProductService extends IService<Product> {
|
|||||||
Page<ProductStockFlow> findProductStockFlowPage(ProductStockFlowParam param);
|
Page<ProductStockFlow> findProductStockFlowPage(ProductStockFlowParam param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新商品库存
|
* 通过商品 进行耗材库存增减
|
||||||
*
|
|
||||||
* @param param 查询条件
|
|
||||||
* @param records 商品数据集合
|
|
||||||
*/
|
*/
|
||||||
void refreshProductStock(ProductDTO param, List<ProductDTO> records);
|
void consStockByProduct(Long shopId, InOutTypeEnum type, InOutItemEnum item, List<ProductStockVO> products, Long orderId, String remark);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,5 +12,4 @@ import com.mybatisflex.core.service.IService;
|
|||||||
*/
|
*/
|
||||||
public interface ProductStockFlowService extends IService<ProductStockFlow> {
|
public interface ProductStockFlowService extends IService<ProductStockFlow> {
|
||||||
|
|
||||||
void saveFlow(ProductStockFlow entity);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.mybatisflex.core.service.IService;
|
|||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店铺商品分类
|
* 店铺商品分类
|
||||||
@@ -26,15 +27,22 @@ public interface ShopProdCategoryService extends IService<ShopProdCategory> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取店铺商品分类列表
|
* 获取店铺商品分类列表
|
||||||
|
*
|
||||||
* @param param 查询参数
|
* @param param 查询参数
|
||||||
* @return 店铺商品分类列表
|
* @return 店铺商品分类列表
|
||||||
*/
|
*/
|
||||||
List<ShopProdCategoryDTO> getShopProdCategoryList(ShopProdCategoryDTO param);
|
List<ShopProdCategoryDTO> getShopProdCategoryList(ShopProdCategoryDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据店铺id获取分类id和名称的映射
|
||||||
|
*/
|
||||||
|
Map<Long, String> getCategoryIdNameMap(Long shopId);
|
||||||
|
|
||||||
void exportShopProdCategory(ShopProdCategoryDTO param, HttpServletResponse response);
|
void exportShopProdCategory(ShopProdCategoryDTO param, HttpServletResponse response);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取店铺商品分类详情
|
* 获取店铺商品分类详情
|
||||||
|
*
|
||||||
* @param id id
|
* @param id id
|
||||||
* @return 店铺商品分类详情
|
* @return 店铺商品分类详情
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import com.mybatisflex.core.service.IService;
|
|||||||
|
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户端商品Service
|
* 用户端商品Service
|
||||||
@@ -52,28 +51,6 @@ public interface UProductService extends IService<Product> {
|
|||||||
*/
|
*/
|
||||||
ShopProductSkuInfoVo getProductSkuInfo(ShopProductSkuParam param);
|
ShopProductSkuInfoVo getProductSkuInfo(ShopProductSkuParam param);
|
||||||
|
|
||||||
/**
|
|
||||||
* 刷新商品库存
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
*/
|
|
||||||
Map<Long, Integer> findShopProductStock(Long shopId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 刷新商品库存
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param productList 商品列表
|
|
||||||
*/
|
|
||||||
void refreshProductStock(Long shopId, List<ShopProductVo> productList);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 刷新商品库存
|
|
||||||
*
|
|
||||||
* @param productStock 商品库存
|
|
||||||
* @param productList 商品列表
|
|
||||||
*/
|
|
||||||
void refreshProductStock(Map<Long, Integer> productStock, List<ShopProductVo> productList);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分组计算是否在可售时间内
|
* 分组计算是否在可售时间内
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.czg.product.vo;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ConsStockRecord {
|
||||||
|
@Column("id")
|
||||||
|
private Long consId;
|
||||||
|
//消耗值
|
||||||
|
private BigDecimal stockNumber;
|
||||||
|
private String conName;
|
||||||
|
//库存数
|
||||||
|
private BigDecimal currentStockNumber;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.czg.product.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品库存VO
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ProductStockVO implements Serializable {
|
||||||
|
|
||||||
|
private Long productId;
|
||||||
|
private BigDecimal number;
|
||||||
|
|
||||||
|
public ProductStockVO() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProductStockVO(Long productId, BigDecimal number) {
|
||||||
|
this.productId = productId;
|
||||||
|
this.number = number;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -67,27 +67,19 @@ public class ShopProductSkuInfoVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal realSalesNumber;
|
private BigDecimal realSalesNumber;
|
||||||
/**
|
/**
|
||||||
* 是否售罄(同isSoldStock)
|
* 是否售罄
|
||||||
*/
|
|
||||||
private Integer isPauseSale;
|
|
||||||
/**
|
|
||||||
* 商品库存
|
|
||||||
*/
|
|
||||||
private Integer stockNumber;
|
|
||||||
/**
|
|
||||||
* 是否售罄(isPauseSale)
|
|
||||||
*/
|
*/
|
||||||
private Integer isSoldStock;
|
private Integer isSoldStock;
|
||||||
|
/**
|
||||||
|
* 是否开启库存
|
||||||
|
*/
|
||||||
|
private Integer isAutoSoldStock;
|
||||||
|
/**
|
||||||
|
* 退菜是否退库存 1退菜退库存 2仅退菜不退库存 3每次询问-退菜后弹窗提示
|
||||||
|
*/
|
||||||
|
private Integer refundMode;
|
||||||
/**
|
/**
|
||||||
* 是否上架(同isGrounding)
|
* 是否上架(同isGrounding)
|
||||||
*/
|
*/
|
||||||
private Integer isSale;
|
private Integer isSale;
|
||||||
/**
|
|
||||||
* 是否开启库存
|
|
||||||
*/
|
|
||||||
private Integer isStock;
|
|
||||||
/**
|
|
||||||
* 是否上架(同isSale)
|
|
||||||
*/
|
|
||||||
private Integer isGrounding;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.czg.product.vo;
|
package com.czg.product.vo;
|
||||||
|
|
||||||
|
import com.czg.product.dto.ProdConsRelationDTO;
|
||||||
import com.czg.product.dto.ProdSkuDTO;
|
import com.czg.product.dto.ProdSkuDTO;
|
||||||
|
import com.czg.product.entity.ProdConsRelation;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
@@ -59,9 +61,9 @@ public class ShopProductVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer isSoldStock;
|
private Integer isSoldStock;
|
||||||
/**
|
/**
|
||||||
* 库存数量
|
* 是否自动售罄 1-是 0-否
|
||||||
*/
|
*/
|
||||||
private Integer stockNumber;
|
private Integer isAutoSoldStock;
|
||||||
/**
|
/**
|
||||||
* 商品类型 single-单规格商品 sku-多规格商品 package-套餐商品 weight-称重商品 coupon-团购券
|
* 商品类型 single-单规格商品 sku-多规格商品 package-套餐商品 weight-称重商品 coupon-团购券
|
||||||
*/
|
*/
|
||||||
@@ -90,6 +92,8 @@ public class ShopProductVo implements Serializable {
|
|||||||
* 商品规格列表
|
* 商品规格列表
|
||||||
*/
|
*/
|
||||||
private List<ProdSkuDTO> skuList;
|
private List<ProdSkuDTO> skuList;
|
||||||
|
private List<ProdConsRelation> consList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品每周销售日 如:Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday
|
* 商品每周销售日 如:Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday
|
||||||
*/
|
*/
|
||||||
@@ -114,8 +118,4 @@ public class ShopProductVo implements Serializable {
|
|||||||
* 店铺id
|
* 店铺id
|
||||||
*/
|
*/
|
||||||
private Long shopId;
|
private Long shopId;
|
||||||
/**
|
|
||||||
* 是否开启库存
|
|
||||||
*/
|
|
||||||
private Integer isStock;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,4 @@ public interface CacheConstant {
|
|||||||
* 点餐机PC端商品列表
|
* 点餐机PC端商品列表
|
||||||
*/
|
*/
|
||||||
String ADMIN_CLIENT_PRODUCT_LIST = ADMIN_CLIENT_PRODUCT_INFO + "list";
|
String ADMIN_CLIENT_PRODUCT_LIST = ADMIN_CLIENT_PRODUCT_INFO + "list";
|
||||||
/**
|
|
||||||
* 点餐机PC端商品列表
|
|
||||||
*/
|
|
||||||
String SHOP_PRODUCT_STOCK = "shop:{}:product-stock:{}";
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import lombok.Getter;
|
|||||||
@Getter
|
@Getter
|
||||||
public enum ShopUserFlowBizEnum {
|
public enum ShopUserFlowBizEnum {
|
||||||
// 会员充值
|
// 会员充值
|
||||||
CASH_IN("cashIn", "会员充值"),
|
CASH_IN("cashIn", "现金充值"),
|
||||||
CASHBACK("cashback", "消费返现"),
|
CASHBACK("cashback", "消费返现"),
|
||||||
CASHBACK_REFUND("cashback_refund", "消费返现扣减"),
|
CASHBACK_REFUND("cashbackRefund", "消费返现扣减"),
|
||||||
|
|
||||||
FREE_IN("freeIn", "霸王餐充值"),
|
FREE_IN("freeIn", "霸王餐充值"),
|
||||||
// 重置奖励
|
// 重置奖励
|
||||||
@@ -21,7 +21,7 @@ public enum ShopUserFlowBizEnum {
|
|||||||
// 支付宝小程序重置
|
// 支付宝小程序重置
|
||||||
ALIPAY_IN("alipayIn", "支付宝小程序充值"),
|
ALIPAY_IN("alipayIn", "支付宝小程序充值"),
|
||||||
// 订单支付奖励
|
// 订单支付奖励
|
||||||
ORDER_PAY("orderPay", "订单支付奖励"),
|
ORDER_PAY("orderPay", "订单支付"),
|
||||||
// 订单退款
|
// 订单退款
|
||||||
ORDER_REFUND("orderRefund", "订单退款"),
|
ORDER_REFUND("orderRefund", "订单退款"),
|
||||||
// 充值退款
|
// 充值退款
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
package com.czg.service.account.mapper;
|
|
||||||
|
|
||||||
import com.mybatisflex.core.BaseMapper;
|
|
||||||
import com.czg.account.entity.ShopProdCategory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品分类 映射层。
|
|
||||||
*
|
|
||||||
* @author zs
|
|
||||||
* @since 2025-02-20
|
|
||||||
*/
|
|
||||||
public interface ShopProdCategoryMapper extends BaseMapper<ShopProdCategory> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -29,7 +29,6 @@ import jakarta.annotation.Resource;
|
|||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -42,7 +41,7 @@ import java.util.stream.Collectors;
|
|||||||
* @author zs
|
* @author zs
|
||||||
* @since 2025-02-21
|
* @since 2025-02-21
|
||||||
*/
|
*/
|
||||||
@Service
|
@DubboService
|
||||||
public class CallTableServiceImpl extends ServiceImpl<CallTableMapper, CallTable> implements CallTableService {
|
public class CallTableServiceImpl extends ServiceImpl<CallTableMapper, CallTable> implements CallTableService {
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private SysParamsService sysParamsService;
|
private SysParamsService sysParamsService;
|
||||||
@@ -222,7 +221,7 @@ public class CallTableServiceImpl extends ServiceImpl<CallTableMapper, CallTable
|
|||||||
callQueueService.save(callQueue);
|
callQueueService.save(callQueue);
|
||||||
|
|
||||||
// 打印排号票信息
|
// 打印排号票信息
|
||||||
rabbitPublisher.printCallNumTicket(callQueue.getId());
|
rabbitPublisher.sendOtherPrintMsg(callQueue.getShopId(), callQueue, "CALL");
|
||||||
|
|
||||||
return new CallTableNumDTO().setTableName(callTable.getName()).setTableNote(callTable.getNote())
|
return new CallTableNumDTO().setTableName(callTable.getName()).setTableNote(callTable.getNote())
|
||||||
.setCallNum(callQueue.getCallNum()).setQueueId(callQueue.getId());
|
.setCallNum(callQueue.getCallNum()).setQueueId(callQueue.getId());
|
||||||
@@ -342,6 +341,7 @@ public class CallTableServiceImpl extends ServiceImpl<CallTableMapper, CallTable
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getStrByState(Integer state) {
|
private String getStrByState(Integer state) {
|
||||||
return switch (state) {
|
return switch (state) {
|
||||||
case -1 -> "已取消";
|
case -1 -> "已取消";
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
package com.czg.service.account.service.impl;
|
package com.czg.service.account.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONWriter;
|
import com.alibaba.fastjson2.JSONWriter;
|
||||||
import com.czg.account.dto.HandoverRecordDTO;
|
import com.czg.account.dto.HandoverRecordDTO;
|
||||||
import com.czg.account.entity.HandoverRecord;
|
import com.czg.account.entity.HandoverRecord;
|
||||||
import com.czg.account.service.HandoverRecordService;
|
import com.czg.account.service.HandoverRecordService;
|
||||||
import com.czg.account.vo.HandoverCategoryListVo;
|
|
||||||
import com.czg.account.vo.HandoverProductListVo;
|
import com.czg.account.vo.HandoverProductListVo;
|
||||||
import com.czg.account.vo.HandoverTotalVo;
|
import com.czg.account.vo.HandoverTotalVo;
|
||||||
import com.czg.constants.SystemConstants;
|
import com.czg.constants.SystemConstants;
|
||||||
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.order.service.OrderInfoRpcService;
|
import com.czg.order.service.OrderInfoRpcService;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.service.account.mapper.HandoverRecordMapper;
|
import com.czg.service.account.mapper.HandoverRecordMapper;
|
||||||
@@ -24,7 +26,6 @@ import org.apache.dubbo.config.annotation.DubboReference;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -40,53 +41,40 @@ public class HandoverRecordServiceImpl extends ServiceImpl<HandoverRecordMapper,
|
|||||||
@DubboReference
|
@DubboReference
|
||||||
private OrderInfoRpcService orderInfoRpcService;
|
private OrderInfoRpcService orderInfoRpcService;
|
||||||
|
|
||||||
private QueryWrapper buildQueryWrapper(HandoverRecordDTO param) {
|
|
||||||
QueryWrapper queryWrapper = PageUtil.buildSortQueryWrapper();
|
|
||||||
if (StrUtil.isNotEmpty(param.getBeginDate())) {
|
|
||||||
queryWrapper.ge(HandoverRecord::getHandoverTime, param.getBeginDate() + " 00:00:00");
|
|
||||||
}
|
|
||||||
if (StrUtil.isNotEmpty(param.getEndDate())) {
|
|
||||||
queryWrapper.le(HandoverRecord::getHandoverTime, param.getEndDate() + " 23:59:59");
|
|
||||||
}
|
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
|
||||||
queryWrapper.eq(HandoverRecord::getShopId, shopId);
|
|
||||||
queryWrapper.isNotNull(HandoverRecord::getHandoverTime);
|
|
||||||
queryWrapper.orderBy(HandoverRecord::getId, false);
|
|
||||||
return queryWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<HandoverRecordDTO> getHandoverRecordPage(String beginDate, String endDate) {
|
public Page<HandoverRecordDTO> getHandoverRecordPage(String beginDate, String endDate) {
|
||||||
HandoverRecordDTO param = new HandoverRecordDTO();
|
HandoverRecordDTO param = new HandoverRecordDTO();
|
||||||
param.setBeginDate(beginDate);
|
param.setBeginDate(beginDate);
|
||||||
param.setEndDate(endDate);
|
param.setEndDate(endDate);
|
||||||
QueryWrapper queryWrapper = buildQueryWrapper(param);
|
QueryWrapper queryWrapper = query().eq(HandoverRecord::getShopId, StpKit.USER.getShopId());
|
||||||
|
if (StrUtil.isNotEmpty(param.getBeginDate())) {
|
||||||
|
queryWrapper.ge(HandoverRecord::getHandoverTime, param.getBeginDate() + " 00:00:00");
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotEmpty(param.getEndDate())) {
|
||||||
|
queryWrapper.le(HandoverRecord::getHandoverTime, param.getEndDate() + " 23:59:59");
|
||||||
|
}
|
||||||
return super.pageAs(PageUtil.buildPage(), queryWrapper, HandoverRecordDTO.class);
|
return super.pageAs(PageUtil.buildPage(), queryWrapper, HandoverRecordDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HandoverProductListVo> getHandoverProductListById(Long id) {
|
public List<HandoverProductListVo> getHandoverProductListById(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId();
|
||||||
HandoverRecord data = super.getOne(query().eq(HandoverRecord::getId, id).eq(HandoverRecord::getShopId, shopId));
|
HandoverRecord data = getOne(query().eq(HandoverRecord::getId, id).eq(HandoverRecord::getShopId, shopId));
|
||||||
if (data == null) {
|
if (data == null || data.getProductData() == null) {
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
String productData = data.getProductData();
|
return JSON.parseArray(data.getProductData(), HandoverProductListVo.class);
|
||||||
if (StrUtil.isBlank(productData)) {
|
|
||||||
return List.of();
|
|
||||||
}
|
|
||||||
return JSON.parseArray(productData, HandoverProductListVo.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HandoverTotalVo totalHandoverData() {
|
public HandoverTotalVo totalHandoverData() {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId();
|
||||||
LocalDateTime handoverTime = LocalDateTime.now();
|
LocalDateTime handoverTime = LocalDateTime.now();
|
||||||
HandoverRecord record = super.getOne(query().eq(HandoverRecord::getShopId, shopId).isNull(HandoverRecord::getHandoverTime));
|
HandoverRecord record = super.getOne(query().eq(HandoverRecord::getShopId, shopId).isNull(HandoverRecord::getHandoverTime));
|
||||||
HandoverTotalVo data = new HandoverTotalVo();
|
HandoverTotalVo data = new HandoverTotalVo();
|
||||||
if (record == null) {
|
if (record == null) {
|
||||||
return data;
|
throw new CzgException("未处在当班状态");
|
||||||
}
|
}
|
||||||
data.setId(record.getId());
|
data.setId(record.getId());
|
||||||
data.setShopId(record.getShopId());
|
data.setShopId(record.getShopId());
|
||||||
@@ -98,11 +86,22 @@ public class HandoverRecordServiceImpl extends ServiceImpl<HandoverRecordMapper,
|
|||||||
data.setHandoverTime(handoverTime);
|
data.setHandoverTime(handoverTime);
|
||||||
String loginTimeStr = LocalDateTimeUtil.formatNormal(record.getLoginTime());
|
String loginTimeStr = LocalDateTimeUtil.formatNormal(record.getLoginTime());
|
||||||
String handoverTimeStr = LocalDateTimeUtil.formatNormal(handoverTime);
|
String handoverTimeStr = LocalDateTimeUtil.formatNormal(handoverTime);
|
||||||
data.setCashAmount(sumCashAmount(shopId, loginTimeStr, handoverTimeStr));
|
data.setDetailList(orderInfoRpcService.getHandoverDetailList(shopId, loginTimeStr, handoverTimeStr));
|
||||||
data.setRefundAmount(sumRefundAmount(shopId, loginTimeStr, handoverTimeStr));
|
data.setCategoryList(orderInfoRpcService.getHandoverCategoryList(shopId, loginTimeStr, handoverTimeStr));
|
||||||
data.setHandAmount(sumHandAmount(shopId, loginTimeStr, handoverTimeStr));
|
HandoverRecord onlinePayTypeDate = orderInfoRpcService.getOnlinePayTypeDate(shopId, loginTimeStr, handoverTimeStr);
|
||||||
data.setOrderCount(countOrderNum(shopId, loginTimeStr, handoverTimeStr));
|
// 合并结果
|
||||||
data.setDetailList(getDetailList(shopId, loginTimeStr, handoverTimeStr));
|
CopyOptions copyOptions = CopyOptions.create().setIgnoreNullValue(true);
|
||||||
|
if (onlinePayTypeDate != null) {
|
||||||
|
BeanUtil.copyProperties(onlinePayTypeDate, data, copyOptions);
|
||||||
|
data.setTurnover(onlinePayTypeDate.getOrderTurnover());
|
||||||
|
}
|
||||||
|
HandoverRecord handoverRecord = orderInfoRpcService.countShopUserFlow(shopId, loginTimeStr, handoverTimeStr);
|
||||||
|
if (handoverRecord != null) {
|
||||||
|
data.setTurnover(NumberUtil.add(data.getTurnover(), handoverRecord.getRecharge()));
|
||||||
|
data.setRefundAmount(NumberUtil.add(data.getRefundAmount(), handoverRecord.getRefundAmount()));
|
||||||
|
data.setRecharge(handoverRecord.getRecharge());
|
||||||
|
}
|
||||||
|
data.setReturnDishCount(orderInfoRpcService.countReturnDish(shopId, loginTimeStr, handoverTimeStr));
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,57 +112,25 @@ public class HandoverRecordServiceImpl extends ServiceImpl<HandoverRecordMapper,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
entity.setLoginTime(LocalDateTime.now());
|
entity.setLoginTime(LocalDateTime.now());
|
||||||
super.save(entity);
|
save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long handover() {
|
public HandoverRecord handover() {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
|
||||||
HandoverTotalVo data = totalHandoverData();
|
HandoverTotalVo data = totalHandoverData();
|
||||||
LocalDateTime loginTime = data.getLoginTime();
|
|
||||||
LocalDateTime handoverTime = data.getHandoverTime();
|
|
||||||
String loginTimeStr = LocalDateTimeUtil.formatNormal(loginTime);
|
|
||||||
String handoverTimeStr = LocalDateTimeUtil.formatNormal(handoverTime);
|
|
||||||
HandoverRecord entity = BeanUtil.copyProperties(data, HandoverRecord.class);
|
HandoverRecord entity = BeanUtil.copyProperties(data, HandoverRecord.class);
|
||||||
entity.setWechatAmount(orderInfoRpcService.getHandoverWechatAmount(shopId, loginTimeStr, handoverTimeStr));
|
entity.setCategoryData(JSON.toJSONString(data.getCategoryList(), JSONWriter.Feature.WriteMapNullValue));
|
||||||
entity.setAlipayAmount(orderInfoRpcService.getHandoverAlipayAmount(shopId, loginTimeStr, handoverTimeStr));
|
|
||||||
entity.setVipPay(orderInfoRpcService.getHandoverVipPayAmount(shopId, loginTimeStr, handoverTimeStr));
|
|
||||||
entity.setVipRecharge(orderInfoRpcService.getHandoverVipChargeAmount(shopId, loginTimeStr, handoverTimeStr));
|
|
||||||
entity.setQuickInAmount(orderInfoRpcService.getHandoverQuickPayAmount(shopId, loginTimeStr, handoverTimeStr));
|
|
||||||
entity.setCreditAmount(orderInfoRpcService.getHandoverCreditAmount(shopId, loginTimeStr, handoverTimeStr));
|
|
||||||
List<HandoverCategoryListVo> categoryData = orderInfoRpcService.getHandoverCategoryList(shopId, loginTimeStr, handoverTimeStr);
|
|
||||||
entity.setCategoryData(JSON.toJSONString(categoryData, JSONWriter.Feature.WriteMapNullValue));
|
|
||||||
List<HandoverProductListVo> productData = data.getDetailList();
|
List<HandoverProductListVo> productData = data.getDetailList();
|
||||||
entity.setProductData(JSON.toJSONString(productData, JSONWriter.Feature.WriteMapNullValue));
|
entity.setProductData(JSON.toJSONString(productData, JSONWriter.Feature.WriteMapNullValue));
|
||||||
super.updateById(entity);
|
super.updateById(entity);
|
||||||
return entity.getId();
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printHandoverReceipt(Long handoverRecordId, Integer isPrint) {
|
public void printHandoverReceipt(HandoverRecord record, Integer isPrint) {
|
||||||
if (isPrint == SystemConstants.OneZero.ONE) {
|
if (isPrint == SystemConstants.OneZero.ONE) {
|
||||||
orderInfoRpcService.sendHandoverReceiptPrintMsgToMq(handoverRecordId);
|
orderInfoRpcService.sendHandoverReceiptPrintMsgToMq(record.getShopId(), record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private BigDecimal sumCashAmount(Long shopId, String loginTime, String handoverTime) {
|
|
||||||
return orderInfoRpcService.getHandoverCashAmount(shopId, loginTime, handoverTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
private BigDecimal sumRefundAmount(Long shopId, String loginTime, String handoverTime) {
|
|
||||||
return orderInfoRpcService.getHandoverRefundAmount(shopId, loginTime, handoverTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
private BigDecimal sumHandAmount(Long shopId, String loginTime, String handoverTime) {
|
|
||||||
return orderInfoRpcService.getHandoverTotalAmount(shopId, loginTime, handoverTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int countOrderNum(Long shopId, String loginTime, String handoverTime) {
|
|
||||||
return orderInfoRpcService.getHandoverOrderNum(shopId, loginTime, handoverTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<HandoverProductListVo> getDetailList(Long shopId, String loginTime, String handoverTime) {
|
|
||||||
return orderInfoRpcService.getHandoverDetailList(shopId, loginTime, handoverTime);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -7,15 +7,16 @@ import com.czg.account.dto.pad.*;
|
|||||||
import com.czg.account.entity.PadLayout;
|
import com.czg.account.entity.PadLayout;
|
||||||
import com.czg.account.entity.PadProductCategory;
|
import com.czg.account.entity.PadProductCategory;
|
||||||
import com.czg.account.entity.PadProductCategoryDetail;
|
import com.czg.account.entity.PadProductCategoryDetail;
|
||||||
import com.czg.account.entity.ShopProdCategory;
|
|
||||||
import com.czg.account.service.*;
|
import com.czg.account.service.*;
|
||||||
import com.czg.constants.SystemConstants;
|
import com.czg.constants.SystemConstants;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.product.entity.ProdSku;
|
import com.czg.product.entity.ProdSku;
|
||||||
import com.czg.product.entity.Product;
|
import com.czg.product.entity.Product;
|
||||||
|
import com.czg.product.entity.ShopProdCategory;
|
||||||
import com.czg.product.service.ProdSkuService;
|
import com.czg.product.service.ProdSkuService;
|
||||||
import com.czg.product.service.ProductRpcService;
|
import com.czg.product.service.ProductRpcService;
|
||||||
import com.czg.product.service.ProductService;
|
import com.czg.product.service.ProductService;
|
||||||
|
import com.czg.product.service.ShopProdCategoryService;
|
||||||
import com.czg.product.vo.ProductVO;
|
import com.czg.product.vo.ProductVO;
|
||||||
import com.czg.service.account.mapper.PadProductCategoryDetailMapper;
|
import com.czg.service.account.mapper.PadProductCategoryDetailMapper;
|
||||||
import com.czg.utils.PageUtil;
|
import com.czg.utils.PageUtil;
|
||||||
@@ -50,7 +51,7 @@ public class PadProdServiceImpl implements PadProdService {
|
|||||||
private ProductRpcService productRpcService;
|
private ProductRpcService productRpcService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private ProdSkuService prodSkuService;
|
private ProdSkuService prodSkuService;
|
||||||
@Resource
|
@DubboReference
|
||||||
private ShopProdCategoryService shopProdCategoryService;
|
private ShopProdCategoryService shopProdCategoryService;
|
||||||
@Resource
|
@Resource
|
||||||
private PadLayoutService padLayoutService;
|
private PadLayoutService padLayoutService;
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ package com.czg.service.account.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.czg.account.dto.print.PrinterAddDTO;
|
|
||||||
import com.czg.account.dto.print.PrinterEditDTO;
|
|
||||||
import com.czg.account.entity.PrintMachine;
|
import com.czg.account.entity.PrintMachine;
|
||||||
import com.czg.account.service.PrintMachineService;
|
import com.czg.account.service.PrintMachineService;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
@@ -20,32 +17,31 @@ import org.apache.dubbo.config.annotation.DubboService;
|
|||||||
* @since 2025-02-20
|
* @since 2025-02-20
|
||||||
*/
|
*/
|
||||||
@DubboService
|
@DubboService
|
||||||
public class PrintMachineServiceImpl extends ServiceImpl<PrintMachineMapper, PrintMachine> implements PrintMachineService{
|
public class PrintMachineServiceImpl extends ServiceImpl<PrintMachineMapper, PrintMachine> implements PrintMachineService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean add(Long shopId, PrinterAddDTO dto) {
|
public boolean add(Long shopId, PrintMachine dto) {
|
||||||
//分类打印选择部分打印时必传,JsonArray字符串数据 如:[{"id":125,"name":"意式咖啡"},{"id":127,"name":"饮品"}]
|
dto.setShopId(shopId);
|
||||||
if ("1".equals(dto.getClassifyPrint()) || "2".equals(dto.getClassifyPrint())) {
|
if ("1".equals(dto.getClassifyPrint())) {
|
||||||
if (StrUtil.isBlank(dto.getCategoryList())) {
|
|
||||||
throw new CzgException("分类打印选择部分打印时,必须勾选需要部分打印的菜品");
|
|
||||||
}
|
|
||||||
if (!JSONUtil.isTypeJSONArray(dto.getCategoryList())) {
|
|
||||||
throw new CzgException("传递的部分打印菜品数据不合法");
|
|
||||||
}
|
|
||||||
if (StrUtil.isBlank(dto.getCategoryIds())) {
|
if (StrUtil.isBlank(dto.getCategoryIds())) {
|
||||||
throw new CzgException("分类打印选择部分打印时,传递的部分打印菜品id数据不能为空");
|
throw new CzgException("分类打印选择部分打印时,必须勾选需要部分打印的分类");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dto.setCategoryIds(null);
|
dto.setCategoryIds(null);
|
||||||
dto.setCategoryList(null);
|
|
||||||
}
|
}
|
||||||
PrintMachine entity = BeanUtil.copyProperties(dto, PrintMachine.class);
|
return save(dto);
|
||||||
entity.setShopId(shopId);
|
|
||||||
return save(entity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean edit(Long shopId, PrinterEditDTO printerEditDTO) {
|
public Boolean edit(Long shopId, PrintMachine printerEditDTO) {
|
||||||
|
printerEditDTO.setShopId(shopId);
|
||||||
|
if ("1".equals(printerEditDTO.getClassifyPrint())) {
|
||||||
|
if (StrUtil.isBlank(printerEditDTO.getCategoryIds())) {
|
||||||
|
throw new CzgException("分类打印选择部分打印时,必须勾选需要部分打印的分类");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printerEditDTO.setCategoryIds(null);
|
||||||
|
}
|
||||||
PrintMachine printMachine = getOne(new QueryWrapper().eq(PrintMachine::getShopId, shopId).eq(PrintMachine::getId, printerEditDTO.getId()));
|
PrintMachine printMachine = getOne(new QueryWrapper().eq(PrintMachine::getShopId, shopId).eq(PrintMachine::getId, printerEditDTO.getId()));
|
||||||
if (printMachine == null) {
|
if (printMachine == null) {
|
||||||
throw new CzgException("打印机不存在");
|
throw new CzgException("打印机不存在");
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.czg.service.account.service.impl;
|
|
||||||
|
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
|
||||||
import com.czg.account.entity.ShopProdCategory;
|
|
||||||
import com.czg.account.service.ShopProdCategoryService;
|
|
||||||
import com.czg.service.account.mapper.ShopProdCategoryMapper;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品分类 服务层实现。
|
|
||||||
*
|
|
||||||
* @author zs
|
|
||||||
* @since 2025-02-20
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class ShopProdCategoryServiceImpl extends ServiceImpl<ShopProdCategoryMapper, ShopProdCategory> implements ShopProdCategoryService{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -38,8 +38,8 @@ public class CodeGen {
|
|||||||
// String packageName = "market";
|
// String packageName = "market";
|
||||||
String packageName = "order";
|
String packageName = "order";
|
||||||
// tableName 指定需要生成的表
|
// tableName 指定需要生成的表
|
||||||
String tableName = "pp_package_order";
|
String tableName = "sys_print_data";
|
||||||
String author = "gyj";
|
String author = "ww";
|
||||||
//是否生成DTO实体 默认生成
|
//是否生成DTO实体 默认生成
|
||||||
boolean isGenerateDto = true;
|
boolean isGenerateDto = true;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.czg.service.market.mapper;
|
package com.czg.service.market.mapper;
|
||||||
|
|
||||||
|
import com.czg.account.entity.HandoverRecord;
|
||||||
import com.czg.account.vo.HandoverCategoryListVo;
|
import com.czg.account.vo.HandoverCategoryListVo;
|
||||||
import com.czg.account.vo.HandoverProductListVo;
|
import com.czg.account.vo.HandoverProductListVo;
|
||||||
import com.czg.order.entity.OrderInfo;
|
import com.czg.order.entity.OrderInfo;
|
||||||
import com.mybatisflex.core.BaseMapper;
|
import com.mybatisflex.core.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -16,105 +18,6 @@ import java.util.List;
|
|||||||
* @since 2025-02-13
|
* @since 2025-02-13
|
||||||
*/
|
*/
|
||||||
public interface OrderInfoMapper extends BaseMapper<OrderInfo> {
|
public interface OrderInfoMapper extends BaseMapper<OrderInfo> {
|
||||||
/**
|
|
||||||
* 交班现金支付统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 现金支付总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverCashAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班微信支付统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 现金支付总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverWechatAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班支付宝支付统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 支付宝支付总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverAlipayAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班VIP支付统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return VIP支付总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverVipPayAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班VIP充值统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return VIP充值总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverVipChargeAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班快捷支付统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 快捷支付总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverQuickPayAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班退款统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 退款总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverRefundAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班挂账统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 挂账总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverCreditAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班营业额统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 营业额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverTotalAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班订单数统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 交班订单数
|
|
||||||
*/
|
|
||||||
int getHandoverOrderNum(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 交班售出商品明细
|
* 交班售出商品明细
|
||||||
@@ -140,4 +43,49 @@ public interface OrderInfoMapper extends BaseMapper<OrderInfo> {
|
|||||||
|
|
||||||
int updatePayOrderId(@Param("orderId") Long orderId, @Param("paymentId") Long paymentId, @Param("payType") String payType, @Param("remark") String remark);
|
int updatePayOrderId(@Param("orderId") Long orderId, @Param("paymentId") Long paymentId, @Param("payType") String payType, @Param("remark") String remark);
|
||||||
|
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* 订单支付方式统计 当日实时数据
|
||||||
|
*/
|
||||||
|
@Select("SELECT" +
|
||||||
|
" SUM(tb_order_info.pay_amount) AS orderTurnover," +
|
||||||
|
" SUM(CASE WHEN pay_type = 'main_scan' THEN pay_amount ELSE 0 END) AS selfScan," +
|
||||||
|
" SUM(CASE WHEN pay_type = 'back_scan' THEN pay_amount ELSE 0 END) AS barScan," +
|
||||||
|
" SUM(CASE WHEN pay_type = 'wechat_mini' THEN pay_amount ELSE 0 END) AS wechat," +
|
||||||
|
" SUM(CASE WHEN pay_type = 'alipay_mini' THEN pay_amount ELSE 0 END) AS alipay," +
|
||||||
|
" SUM(CASE WHEN pay_type = 'vip_pay' THEN pay_amount ELSE 0 END) AS balance," +
|
||||||
|
" SUM(CASE WHEN pay_type = 'cash_pay' THEN pay_amount ELSE 0 END) AS cash," +
|
||||||
|
" SUM(CASE WHEN pay_type = 'credit_pay' THEN pay_amount ELSE 0 END) AS owed," +
|
||||||
|
|
||||||
|
" IFNULL(SUM(refund_amount), 0) as refundAmount," +
|
||||||
|
" count(1) as orderCount " +
|
||||||
|
" FROM" +
|
||||||
|
" tb_order_info " +
|
||||||
|
" WHERE" +
|
||||||
|
" shop_id = #{shopId} " +
|
||||||
|
"and create_time >= #{loginTime} and create_time <= #{handoverTime} " +
|
||||||
|
"and paid_time is not null ")
|
||||||
|
HandoverRecord getOnlinePayTypeDate(Long shopId, String loginTime, String handoverTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单退菜数量
|
||||||
|
*/
|
||||||
|
@Select("SELECT" +
|
||||||
|
" SUM(o.return_num) AS returnDishCount " +
|
||||||
|
" FROM" +
|
||||||
|
" tb_order_info left join tb_order_detail o on tb_order_info.id = o.order_id" +
|
||||||
|
" WHERE" +
|
||||||
|
" tb_order_info.shop_id = #{shopId} " +
|
||||||
|
"and tb_order_info.create_time >= #{loginTime} and tb_order_info.create_time <= #{handoverTime} " +
|
||||||
|
"and tb_order_info.paid_time is not null ")
|
||||||
|
BigDecimal countReturnDish(Long shopId, String loginTime, String handoverTime);
|
||||||
|
|
||||||
|
@Select("SELECT " +
|
||||||
|
" SUM(CASE WHEN biz_code IN ('cashIn', 'wechatIn', 'alipayIn', 'adminIn','freeIn') THEN amount ELSE 0 END) AS recharge," +
|
||||||
|
" SUM(CASE WHEN biz_code IN ('rechargeRefund') THEN amount ELSE 0 END) AS refundAmount " +
|
||||||
|
"FROM `tb_shop_user_flow` " +
|
||||||
|
" WHERE" +
|
||||||
|
" shop_id = #{shopId} " +
|
||||||
|
"and create_time >= #{loginTime} and create_time <= #{handoverTime} ")
|
||||||
|
HandoverRecord countShopUserFlow(Long shopId, String loginTime, String handoverTime);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.czg.service.market.service.impl;
|
package com.czg.service.market.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.DesensitizedUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
||||||
@@ -9,6 +10,7 @@ import com.czg.account.entity.ShopUser;
|
|||||||
import com.czg.account.service.ShopConfigService;
|
import com.czg.account.service.ShopConfigService;
|
||||||
import com.czg.account.service.ShopInfoService;
|
import com.czg.account.service.ShopInfoService;
|
||||||
import com.czg.account.service.ShopUserService;
|
import com.czg.account.service.ShopUserService;
|
||||||
|
import com.czg.config.RabbitPublisher;
|
||||||
import com.czg.constant.TableValueConstant;
|
import com.czg.constant.TableValueConstant;
|
||||||
import com.czg.enums.ShopUserFlowBizEnum;
|
import com.czg.enums.ShopUserFlowBizEnum;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
@@ -20,6 +22,7 @@ import com.czg.market.entity.ShopCoupon;
|
|||||||
import com.czg.market.enums.PointsConstant;
|
import com.czg.market.enums.PointsConstant;
|
||||||
import com.czg.market.service.*;
|
import com.czg.market.service.*;
|
||||||
import com.czg.market.vo.*;
|
import com.czg.market.vo.*;
|
||||||
|
import com.czg.print.RechargePrintDTO;
|
||||||
import com.czg.utils.AssertUtil;
|
import com.czg.utils.AssertUtil;
|
||||||
import com.czg.utils.FunUtils;
|
import com.czg.utils.FunUtils;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
@@ -32,6 +35,7 @@ import org.apache.dubbo.config.annotation.DubboReference;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -60,6 +64,8 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
|
|||||||
private ShopInfoService shopInfoService;
|
private ShopInfoService shopInfoService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private ShopConfigService shopConfigService;
|
private ShopConfigService shopConfigService;
|
||||||
|
@Resource
|
||||||
|
private RabbitPublisher rabbitPublisher;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MkShopRechargeVO detailApp(Long shopId) {
|
public MkShopRechargeVO detailApp(Long shopId) {
|
||||||
@@ -72,7 +78,7 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MkShopRechargeVO detail(Long shopId) throws CzgException{
|
public MkShopRechargeVO detail(Long shopId) throws CzgException {
|
||||||
shopId = shopInfoService.getMainIdByShopId(shopId);
|
shopId = shopInfoService.getMainIdByShopId(shopId);
|
||||||
ShopInfo shopInfo = shopInfoService.getById(shopId);
|
ShopInfo shopInfo = shopInfoService.getById(shopId);
|
||||||
if (shopInfo.getMainId() != null) {
|
if (shopInfo.getMainId() != null) {
|
||||||
@@ -164,7 +170,7 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recharge(Long shopId, Long shopUserId, Long rechargeDetailId, BigDecimal amount, Long paymentId,
|
public void recharge(Long shopId, Long shopUserId, Long rechargeDetailId, BigDecimal amount, Long paymentId,
|
||||||
String payType, ShopUserFlowBizEnum bizEnum, boolean isNoJoin) {
|
String payType, LocalDateTime payTime, ShopUserFlowBizEnum bizEnum, boolean isNoJoin, String operator) {
|
||||||
log.info("充值回调, 用户id: {}, 金额: {}, rechargeDetailId: {}", shopUserId, amount, rechargeDetailId);
|
log.info("充值回调, 用户id: {}, 金额: {}, rechargeDetailId: {}", shopUserId, amount, rechargeDetailId);
|
||||||
ShopUser shopUser = shopUserService.getById(shopUserId);
|
ShopUser shopUser = shopUserService.getById(shopUserId);
|
||||||
ShopUserMoneyEditDTO shopUserMoneyEditDTO = new ShopUserMoneyEditDTO()
|
ShopUserMoneyEditDTO shopUserMoneyEditDTO = new ShopUserMoneyEditDTO()
|
||||||
@@ -172,12 +178,17 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
|
|||||||
.setType(1)
|
.setType(1)
|
||||||
.setBizEnum(bizEnum)
|
.setBizEnum(bizEnum)
|
||||||
.setRelationId(paymentId);
|
.setRelationId(paymentId);
|
||||||
|
BigDecimal rechargeAmount = BigDecimal.ZERO;
|
||||||
|
BigDecimal giftAmount = BigDecimal.ZERO;
|
||||||
|
BigDecimal giftPoints = BigDecimal.ZERO;
|
||||||
|
Integer giftCoupon = 0;
|
||||||
|
|
||||||
// 标准充值
|
// 标准充值
|
||||||
if (rechargeDetailId != null) {
|
if (rechargeDetailId != null) {
|
||||||
MkShopRechargeDetail rechargeDetail = shopRechargeDetailService.getById(rechargeDetailId);
|
MkShopRechargeDetail rechargeDetail = shopRechargeDetailService.getById(rechargeDetailId);
|
||||||
shopUserMoneyEditDTO.setMoney(rechargeDetail.getAmount());
|
shopUserMoneyEditDTO.setMoney(rechargeDetail.getAmount());
|
||||||
FunUtils.asyncSafeRunVoid(() -> {
|
rechargeAmount = rechargeDetail.getAmount();
|
||||||
|
try {
|
||||||
// 赠送金额
|
// 赠送金额
|
||||||
ShopUserMoneyEditDTO shopUserMoneyEditRewardDTO = new ShopUserMoneyEditDTO()
|
ShopUserMoneyEditDTO shopUserMoneyEditRewardDTO = new ShopUserMoneyEditDTO()
|
||||||
.setId(shopUserId)
|
.setId(shopUserId)
|
||||||
@@ -186,28 +197,56 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
|
|||||||
.setRelationId(paymentId);
|
.setRelationId(paymentId);
|
||||||
shopUserMoneyEditRewardDTO.setMoney(rechargeDetail.getRewardAmount());
|
shopUserMoneyEditRewardDTO.setMoney(rechargeDetail.getRewardAmount());
|
||||||
Long editId = shopUserService.updateMoney(shopUserMoneyEditRewardDTO);
|
Long editId = shopUserService.updateMoney(shopUserMoneyEditRewardDTO);
|
||||||
|
giftAmount = rechargeDetail.getRewardAmount();
|
||||||
// 发放积分
|
// 发放积分
|
||||||
if (rechargeDetail.getRewardPoints() != null) {
|
if (rechargeDetail.getRewardPoints() != null) {
|
||||||
|
giftPoints = BigDecimal.valueOf(rechargeDetail.getRewardPoints());
|
||||||
pointsUserService.alterPoints(null, shopUserId, shopUser.getMainShopId(), PointsConstant.ADD, rechargeDetail.getRewardPoints(), editId, "充值赠送");
|
pointsUserService.alterPoints(null, shopUserId, shopUser.getMainShopId(), PointsConstant.ADD, rechargeDetail.getRewardPoints(), editId, "充值赠送");
|
||||||
}
|
}
|
||||||
// 发放优惠券
|
// 发放优惠券
|
||||||
if (StrUtil.isNotBlank(rechargeDetail.getCouponInfoList())) {
|
if (StrUtil.isNotBlank(rechargeDetail.getCouponInfoList())) {
|
||||||
JSONArray.parseArray(rechargeDetail.getCouponInfoList()).toJavaList(CouponInfoDTO.class).forEach(item -> {
|
List<CouponInfoDTO> list = JSONArray.parseArray(rechargeDetail.getCouponInfoList()).toJavaList(CouponInfoDTO.class);
|
||||||
|
for (CouponInfoDTO item : list) {
|
||||||
if (item.getId() == null) {
|
if (item.getId() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
giftCoupon = giftCoupon + item.getNum();
|
||||||
shopCouponRecordService.grant(shopId, new MkRewardCouponDTO().setCouponId(item.getId())
|
shopCouponRecordService.grant(shopId, new MkRewardCouponDTO().setCouponId(item.getId())
|
||||||
.setNum(item.getNum())
|
.setNum(item.getNum())
|
||||||
.setUserId(shopUser.getUserId())
|
.setUserId(shopUser.getUserId())
|
||||||
.setShopId(shopId), "充值赠券");
|
.setShopId(shopId), "充值赠券");
|
||||||
});
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
} catch (Exception e) {
|
||||||
|
log.error("recharge充值有问题", e);
|
||||||
|
}
|
||||||
// 自定义金额
|
// 自定义金额
|
||||||
} else {
|
} else {
|
||||||
shopUserMoneyEditDTO.setMoney(amount);
|
shopUserMoneyEditDTO.setMoney(amount);
|
||||||
|
rechargeAmount = amount;
|
||||||
}
|
}
|
||||||
shopUserService.updateMoney(shopUserMoneyEditDTO);
|
Long flowId = shopUserService.updateMoney(shopUserMoneyEditDTO);
|
||||||
|
BigDecimal finalRechargeAmount = rechargeAmount;
|
||||||
|
BigDecimal finalGiftAmount = giftAmount;
|
||||||
|
BigDecimal finalGiftPoints = giftPoints;
|
||||||
|
Integer finalGiftCoupon = giftCoupon;
|
||||||
|
FunUtils.asyncSafeRunVoid(() -> {
|
||||||
|
RechargePrintDTO rechargePrintDTO = new RechargePrintDTO();
|
||||||
|
rechargePrintDTO.setUserId(shopUserId);
|
||||||
|
rechargePrintDTO.setUserName(shopUser.getNickName());
|
||||||
|
rechargePrintDTO.setUserPhone(DesensitizedUtil.mobilePhone(shopUser.getPhone()));
|
||||||
|
rechargePrintDTO.setPayTime(payTime);
|
||||||
|
rechargePrintDTO.setRechargeAmount(finalRechargeAmount);
|
||||||
|
rechargePrintDTO.setGiftAmount(finalGiftAmount);
|
||||||
|
rechargePrintDTO.setGiftPoints(finalGiftPoints);
|
||||||
|
rechargePrintDTO.setGiftCoupon(finalGiftCoupon);
|
||||||
|
rechargePrintDTO.setPayType(bizEnum.getMsg());
|
||||||
|
rechargePrintDTO.setBalance(shopUser.getAmount().add(finalRechargeAmount).add(finalGiftAmount));
|
||||||
|
rechargePrintDTO.setRechargeId(flowId.toString());
|
||||||
|
rechargePrintDTO.setOperator(operator);
|
||||||
|
rabbitPublisher.sendOtherPrintMsg(shopId, rechargePrintDTO, "RECHARGE");
|
||||||
|
});
|
||||||
FunUtils.asyncSafeRunVoid(() -> {
|
FunUtils.asyncSafeRunVoid(() -> {
|
||||||
memberConfigService.deliver(shopUser, TableValueConstant.MemberExpFlow.Type.RECHARGE, amount, null, rechargeDetailId);
|
memberConfigService.deliver(shopUser, TableValueConstant.MemberExpFlow.Type.RECHARGE, amount, null, rechargeDetailId);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -45,39 +45,7 @@
|
|||||||
where id = #{orderId};
|
where id = #{orderId};
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="getHandoverCashAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(t1.pay_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
and t1.pay_type = 'cash_pay'
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverRefundAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(t1.refund_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverTotalAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(t1.pay_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverOrderNum" resultType="java.lang.Integer">
|
|
||||||
SELECT
|
|
||||||
count(*)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverDetailList" resultType="com.czg.account.vo.HandoverProductListVo">
|
<select id="getHandoverDetailList" resultType="com.czg.account.vo.HandoverProductListVo">
|
||||||
SELECT
|
SELECT
|
||||||
t2.product_id,
|
t2.product_id,
|
||||||
@@ -96,53 +64,7 @@
|
|||||||
t2.product_id,
|
t2.product_id,
|
||||||
t2.sku_id
|
t2.sku_id
|
||||||
</select>
|
</select>
|
||||||
<select id="getHandoverWechatAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(t1.pay_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
and t1.pay_type = 'wechat_mini'
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverAlipayAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(t1.pay_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
and t1.pay_type = 'alipay_mini'
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverVipPayAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(t1.pay_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
and t1.pay_type = 'vip_pay'
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverVipChargeAmount" resultType="java.math.BigDecimal">
|
|
||||||
select ifnull(sum(t1.amount), 0)
|
|
||||||
from tb_shop_user_flow t1
|
|
||||||
where t1.shop_id = #{shopId}
|
|
||||||
and t1.biz_code in ('cashIn', 'wechatIn', 'alipayIn', 'adminIn')
|
|
||||||
and t1.recharge_id is not null
|
|
||||||
<![CDATA[
|
|
||||||
AND t1.create_time >= str_to_date(#{loginTime}, '%Y-%m-%d %H:%i:%s')
|
|
||||||
AND t1.create_time <= str_to_date(#{handoverTime}, '%Y-%m-%d %H:%i:%s')
|
|
||||||
]]>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverQuickPayAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(pay_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
and t1.pay_type in ('main_scan','back_scan')
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverCategoryList" resultType="com.czg.account.vo.HandoverCategoryListVo">
|
<select id="getHandoverCategoryList" resultType="com.czg.account.vo.HandoverCategoryListVo">
|
||||||
SELECT case when t3.category_id is null then 0 else t3.category_id end as category_id,
|
SELECT case when t3.category_id is null then 0 else t3.category_id end as category_id,
|
||||||
case when t4.name is null then '未分类' else t4.name end as category_name,
|
case when t4.name is null then '未分类' else t4.name end as category_name,
|
||||||
@@ -158,13 +80,4 @@
|
|||||||
</where>
|
</where>
|
||||||
GROUP BY t3.category_id
|
GROUP BY t3.category_id
|
||||||
</select>
|
</select>
|
||||||
<select id="getHandoverCreditAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(t1.pay_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
and t1.pay_type = 'credit_pay'
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public class VipPayParamDTO {
|
|||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
private String buyerRemark;
|
private String buyerRemark;
|
||||||
|
private String operator;
|
||||||
/**
|
/**
|
||||||
* 跳转地址
|
* 跳转地址
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ package com.czg.service.order.mapper;
|
|||||||
|
|
||||||
import com.czg.account.vo.HandoverCategoryListVo;
|
import com.czg.account.vo.HandoverCategoryListVo;
|
||||||
import com.czg.account.vo.HandoverProductListVo;
|
import com.czg.account.vo.HandoverProductListVo;
|
||||||
|
import com.czg.product.vo.ConsStockRecord;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单表 映射层。
|
* 订单表 映射层。
|
||||||
@@ -13,107 +15,7 @@ import java.util.List;
|
|||||||
* @author ww
|
* @author ww
|
||||||
* @since 2025-02-13
|
* @since 2025-02-13
|
||||||
*/
|
*/
|
||||||
public interface OrderInfoCustomMapper{
|
public interface OrderInfoCustomMapper {
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班现金支付统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 现金支付总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverCashAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班微信支付统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 现金支付总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverWechatAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班支付宝支付统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 支付宝支付总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverAlipayAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班VIP支付统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return VIP支付总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverVipPayAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班VIP充值统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return VIP充值总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverVipChargeAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班快捷支付统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 快捷支付总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverQuickPayAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班退款统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 退款总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverRefundAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班挂账统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 挂账总额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverCreditAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班营业额统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 营业额
|
|
||||||
*/
|
|
||||||
BigDecimal getHandoverTotalAmount(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班订单数统计
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param loginTime 上岗时间
|
|
||||||
* @param handoverTime 交班时间
|
|
||||||
* @return 交班订单数
|
|
||||||
*/
|
|
||||||
int getHandoverOrderNum(Long shopId, String loginTime, String handoverTime);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 交班售出商品明细
|
* 交班售出商品明细
|
||||||
@@ -138,4 +40,9 @@ public interface OrderInfoCustomMapper{
|
|||||||
int decrMoney(@Param("id") Long id, @Param("amount") BigDecimal amount);
|
int decrMoney(@Param("id") Long id, @Param("amount") BigDecimal amount);
|
||||||
|
|
||||||
int updatePayOrderId(@Param("orderId") Long orderId, @Param("paymentId") Long paymentId, @Param("payType") String payType, @Param("remark") String remark);
|
int updatePayOrderId(@Param("orderId") Long orderId, @Param("paymentId") Long paymentId, @Param("payType") String payType, @Param("remark") String remark);
|
||||||
|
|
||||||
|
List<ConsStockRecord> getConsByProductAndNum(
|
||||||
|
@Param("shopId") Long shopId,
|
||||||
|
@Param("productUsageMap") Map<Long, BigDecimal> productUsageMap
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.service.order.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.order.entity.SysPrintData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据打印表 映射层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-04-16
|
||||||
|
*/
|
||||||
|
public interface SysPrintDataMapper extends BaseMapper<SysPrintData> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,18 +1,14 @@
|
|||||||
package com.czg.service.order.print;
|
package com.czg.service.order.print;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.text.UnicodeUtil;
|
import cn.hutool.core.text.UnicodeUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.czg.account.dto.HandoverRecordDTO;
|
import com.czg.account.dto.HandoverRecordDTO;
|
||||||
import com.czg.account.entity.PrintMachine;
|
import com.czg.account.entity.PrintMachine;
|
||||||
import com.czg.account.entity.ShopInfo;
|
|
||||||
import com.czg.order.entity.OrderDetail;
|
import com.czg.order.entity.OrderDetail;
|
||||||
import com.czg.order.entity.OrderInfo;
|
import com.czg.order.entity.OrderInfo;
|
||||||
import com.czg.service.order.enums.OrderStatusEnums;
|
import com.czg.print.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.HttpEntity;
|
||||||
@@ -22,9 +18,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -67,57 +61,71 @@ public class FeiPrinter extends PrinterHandler implements PrinterImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void normalDishesPrint(String operator, OrderInfo orderInfo, OrderDetail orderDetail, PrintMachine machine) {
|
protected void onlyKitchenPrint(OrderInfo orderInfo, OrderDetail orderDetail, PrintMachine machine) {
|
||||||
String buildDishPrintData = buildDishPrintData(false, getPickupNum(orderInfo), DateUtil.format(orderDetail.getCreateTime(), "yyyy-MM-dd HH:mm:ss"), orderDetail.getProductName(), orderDetail.getSkuName(),
|
String buildDishPrintData = buildOnlyKitchenPrintData(getPickupNum(orderInfo), orderDetail);
|
||||||
orderDetail.getNum(), orderDetail.getRemark(), orderDetail.getProGroupInfo(), orderDetail.getId(), orderDetail.isUrgent());
|
|
||||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
if (1 == machine.getVolumeSwitch()) {
|
if (1 == machine.getVolumeSwitch()) {
|
||||||
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
voiceJson = "{\"bizType\":\"2\",\"content\":\"新单来了,请注意查看\"}";
|
||||||
}
|
}
|
||||||
String resp = sendPrintRequest(machine.getAddress(), buildDishPrintData, voiceJson, "1");
|
String resp = sendPrintRequest(machine.getAddress(), buildDishPrintData, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
printMachineLogService.save(orderInfo.getId(), machine, "新订单", buildDishPrintData, resp);
|
printMachineLogService.save(orderInfo.getId(), machine, "后厨商品单", buildDishPrintData, resp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void returnDishesPrint(String operator, OrderInfo orderInfo, OrderDetail orderDetail, PrintMachine machine) {
|
public OrderPrintDTO allKitchenPrint(OrderInfo orderInfo, List<OrderDetail> orderDetails, PrintMachine machine) {
|
||||||
String buildDishPrintData = buildDishPrintData(true, getPickupNum(orderInfo), DateUtil.format(orderDetail.getCreateTime(), "yyyy-MM-dd HH:mm:ss"), orderDetail.getProductName(), orderDetail.getSkuName(),
|
OrderPrintDTO orderPrintDTO = super.allKitchenPrint(orderInfo, orderDetails, machine);
|
||||||
orderDetail.getReturnNum(), orderDetail.getRemark(), orderDetail.getProGroupInfo(), orderDetail.getId(), orderDetail.isUrgent());
|
String buildDishPrintData = buildAllKitchenPrintData(orderPrintDTO, orderDetails);
|
||||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
String resp = sendPrintRequest(machine.getAddress(), buildDishPrintData, voiceJson, "1");
|
if (1 == machine.getVolumeSwitch()) {
|
||||||
printMachineLogService.save(orderInfo.getId(), machine, "厨房退菜", buildDishPrintData, resp);
|
voiceJson = "{\"bizType\":\"2\",\"content\":\"新单来了,请注意查看\"}";
|
||||||
|
}
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), buildDishPrintData, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(orderInfo.getId(), machine, "后厨总单", buildDishPrintData, resp);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PrintInfoDTO returnOrderPrint(String printTitle,String operator, String refundAmount, String refundReason, String refundType,
|
public OrderPrintDTO returnKitchenPrint(String operator, OrderInfo orderInfo, List<OrderDetail> orderDetail, PrintMachine machine) {
|
||||||
OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
OrderPrintDTO orderPrintDTO = super.returnKitchenPrint(operator, orderInfo, orderDetail, machine);
|
||||||
PrintInfoDTO printInfoDTO = super.returnOrderPrint(printTitle,operator, refundAmount, refundReason, refundType, orderInfo, machine, detailList);
|
String buildDishPrintData = buildAllKitchenPrintData(orderPrintDTO, orderDetail);
|
||||||
String data = buildRefundOrderPrintData(printInfoDTO, detailList);
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
if (1 == machine.getVolumeSwitch()) {
|
||||||
|
voiceJson = "{\"bizType\":\"2\",\"content\":\"退菜消息,请及时处理\"}";
|
||||||
|
}
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), buildDishPrintData, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(orderInfo.getId(), machine, "后厨退菜", buildDishPrintData, resp);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderPrintDTO returnOrderPrint(String printTitle, String operator, String refundAmount, String refundReason, String refundType,
|
||||||
|
OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
||||||
|
OrderPrintDTO orderPrintDTO = super.returnOrderPrint(printTitle, operator, refundAmount, refundReason, refundType, orderInfo, machine, detailList);
|
||||||
|
String data = buildRefundOrderPrintData(orderPrintDTO, detailList);
|
||||||
sendOrderPrint(data, orderInfo.getId(), machine, "退款单");
|
sendOrderPrint(data, orderInfo.getId(), machine, "退款单");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PrintInfoDTO guestOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
public OrderPrintDTO guestOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
||||||
PrintInfoDTO printInfoDTO = super.guestOrderPrint(orderInfo, machine, detailList);
|
OrderPrintDTO orderPrintDTO = super.guestOrderPrint(orderInfo, machine, detailList);
|
||||||
String data = buildGuestOrderPrintData(printInfoDTO, detailList);
|
String data = buildGuestOrderPrintData(orderPrintDTO, detailList);
|
||||||
sendOrderPrint(data, orderInfo.getId(), machine, "客看单");
|
sendOrderPrint(data, orderInfo.getId(), machine, "客看单");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PrintInfoDTO preOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
public OrderPrintDTO preOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
||||||
PrintInfoDTO printInfoDTO = super.preOrderPrint(orderInfo, machine, detailList);
|
OrderPrintDTO orderPrintDTO = super.preOrderPrint(orderInfo, machine, detailList);
|
||||||
String data = buildOrderPrintData(printInfoDTO, detailList);
|
String data = buildOrderPrintData(orderPrintDTO, detailList);
|
||||||
sendOrderPrint(data, orderInfo.getId(), machine, "预结算单");
|
sendOrderPrint(data, orderInfo.getId(), machine, "预结算单");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PrintInfoDTO orderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
public OrderPrintDTO orderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
||||||
PrintInfoDTO printInfoDTO = super.orderPrint(orderInfo, machine, detailList);
|
OrderPrintDTO orderPrintDTO = super.orderPrint(orderInfo, machine, detailList);
|
||||||
String data = buildOrderPrintData(printInfoDTO, detailList);
|
String data = buildOrderPrintData(orderPrintDTO, detailList);
|
||||||
sendOrderPrint(data, orderInfo.getId(), machine, "结算单");
|
sendOrderPrint(data, orderInfo.getId(), machine, "结算单");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -130,15 +138,60 @@ public class FeiPrinter extends PrinterHandler implements PrinterImpl {
|
|||||||
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一条新的排号记录\"}";
|
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一条新的排号记录\"}";
|
||||||
}
|
}
|
||||||
String data = buildCallTicketData(shopName, tableName, callNum, preNum, codeUrl, shopNote, takeTime);
|
String data = buildCallTicketData(shopName, tableName, callNum, preNum, codeUrl, shopNote, takeTime);
|
||||||
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, "1");
|
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
printMachineLogService.save(machine, "叫号单", data, resp);
|
printMachineLogService.save(machine, "叫号单", data, resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handoverPrint(PrintMachine machine, HandoverRecordDTO record) {
|
protected void stockPrint(PrintMachine machine, String shopName, StockPrintDTO record) {
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
String data = buildStockData(record);
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(machine, "IN".equals(record.getType()) ? "入库单" : "出库单", data, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dayReportPrint(PrintMachine machine, String shopName, DayReportPrintDTO record) {
|
||||||
|
record.setShopName(shopName);
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
String data = buildDayReportData(record);
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(machine, "经营日报单", data, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void productReportPrint(PrintMachine machine, String shopName, ProductReportPrintDTO record) {
|
||||||
|
record.setShopName(shopName);
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
String data = buildProductReportData(record);
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(machine, "商品报表单", data, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void rechargePrint(PrintMachine machine, String shopName, RechargePrintDTO record) {
|
||||||
|
record.setShopName(shopName);
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
String data = buildRechargeData(record);
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(machine, "储值单", data, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void stockCheckPrint(PrintMachine machine, String shopName, StockCheckPrintDTO record) {
|
||||||
|
record.setShopName(shopName);
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
String data = buildStockCheckData(record);
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(machine, "盘点单", data, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void handoverPrint(PrintMachine machine, String shopName, HandoverRecordDTO record) {
|
||||||
|
record.setShopName(shopName);
|
||||||
String string = buildHandoverData(record);
|
String string = buildHandoverData(record);
|
||||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
sendPrintRequest(machine.getAddress(), string, voiceJson, "1");
|
sendPrintRequest(machine.getAddress(), string, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -153,11 +206,7 @@ public class FeiPrinter extends PrinterHandler implements PrinterImpl {
|
|||||||
if (1 == machine.getVolumeSwitch()) {
|
if (1 == machine.getVolumeSwitch()) {
|
||||||
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||||
}
|
}
|
||||||
String printerNum = "1";
|
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
if (StrUtil.isNotBlank(machine.getPrintQty())) {
|
|
||||||
printerNum = machine.getPrintQty().split("\\^")[1];
|
|
||||||
}
|
|
||||||
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, printerNum);
|
|
||||||
printMachineLogService.save(orderId, machine, bizType, data, resp);
|
printMachineLogService.save(orderId, machine, bizType, data, resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,7 +244,7 @@ public class FeiPrinter extends PrinterHandler implements PrinterImpl {
|
|||||||
* @param printOrderId 打印订单编号
|
* @param printOrderId 打印订单编号
|
||||||
* @return null-未知错误,true-已打印,false-未打印
|
* @return null-未知错误,true-已打印,false-未打印
|
||||||
*/
|
*/
|
||||||
public Boolean checkFPrintStatus(String printOrderId) {
|
public Boolean checkPrintStatus(String printOrderId) {
|
||||||
String time = String.valueOf(System.currentTimeMillis() / 1000);
|
String time = String.valueOf(System.currentTimeMillis() / 1000);
|
||||||
Map<String, Object> paramMap = new HashMap<>();
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
paramMap.put("user", USER);
|
paramMap.put("user", USER);
|
||||||
@@ -244,20 +293,4 @@ public class FeiPrinter extends PrinterHandler implements PrinterImpl {
|
|||||||
}
|
}
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 计算优惠金额:优先使用 discountAllAmount,如果为 null 则用原价 - 实付计算
|
|
||||||
*/
|
|
||||||
private String calculateDiscountAmount(OrderInfo orderInfo) {
|
|
||||||
if (orderInfo.getDiscountAllAmount() != null) {
|
|
||||||
return orderInfo.getDiscountAllAmount().toPlainString();
|
|
||||||
}
|
|
||||||
// 兜底计算:原价 + 餐位费 + 打包费 - 实付
|
|
||||||
BigDecimal originalTotal = orderInfo.getOriginAmount()
|
|
||||||
.add(orderInfo.getSeatAmount() != null ? orderInfo.getSeatAmount() : BigDecimal.ZERO)
|
|
||||||
.add(orderInfo.getPackFee() != null ? orderInfo.getPackFee() : BigDecimal.ZERO);
|
|
||||||
BigDecimal discount = originalTotal.subtract(orderInfo.getPayAmount());
|
|
||||||
return discount.compareTo(BigDecimal.ZERO) >= 0 ? discount.toPlainString() : "0.00";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,41 +1,343 @@
|
|||||||
package com.czg.service.order.print;
|
package com.czg.service.order.print;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import org.springframework.context.annotation.Primary;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.czg.account.dto.HandoverRecordDTO;
|
||||||
|
import com.czg.account.entity.CallQueue;
|
||||||
|
import com.czg.account.entity.PrintMachine;
|
||||||
|
import com.czg.account.entity.ShopInfo;
|
||||||
|
import com.czg.account.service.PrintMachineService;
|
||||||
|
import com.czg.account.service.ShopInfoService;
|
||||||
|
import com.czg.config.RedisCst;
|
||||||
|
import com.czg.exception.CzgException;
|
||||||
|
import com.czg.market.service.OrderInfoService;
|
||||||
|
import com.czg.order.entity.OrderDetail;
|
||||||
|
import com.czg.order.entity.OrderInfo;
|
||||||
|
import com.czg.order.service.OrderDetailService;
|
||||||
|
import com.czg.print.*;
|
||||||
|
import com.czg.product.entity.Product;
|
||||||
|
import com.czg.product.service.ProductService;
|
||||||
|
import com.czg.service.RedisService;
|
||||||
|
import com.czg.service.order.enums.OrderStatusEnums;
|
||||||
|
import com.czg.utils.FunUtils;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
|
import org.springframework.boot.ApplicationArguments;
|
||||||
|
import org.springframework.boot.ApplicationRunner;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import java.math.BigDecimal;
|
||||||
import javax.annotation.Resource;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印机责任链初始化
|
* 打印机责任链初始化
|
||||||
|
*
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Slf4j
|
||||||
public class PrintConfig {
|
@Component
|
||||||
|
public class PrintConfig implements ApplicationRunner {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private List<PrinterHandler> printers;
|
private ApplicationContext applicationContext;
|
||||||
|
@Resource
|
||||||
|
protected OrderDetailService orderDetailService;
|
||||||
|
@Resource
|
||||||
|
protected OrderInfoService orderInfoService;
|
||||||
|
@DubboReference
|
||||||
|
private PrintMachineService printMachineService;
|
||||||
|
@DubboReference
|
||||||
|
protected ShopInfoService shopInfoService;
|
||||||
|
@DubboReference
|
||||||
|
protected ProductService productService;
|
||||||
|
@Resource
|
||||||
|
protected RedisService redisService;
|
||||||
|
|
||||||
// 初始化责任链
|
public static final Map<String, PrinterHandler> PRINTER_MAP = new ConcurrentHashMap<>();
|
||||||
@PostConstruct
|
|
||||||
public void initChain() {
|
@Override
|
||||||
// 检查打印处理器列表是否为空
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
if (printers != null && !printers.isEmpty()) {
|
|
||||||
for (int i = 0; i < printers.size() - 1; i++) {
|
Map<String, PrinterHandler> beans = applicationContext.getBeansOfType(PrinterHandler.class);
|
||||||
// 设置当前处理器的下一个处理器
|
|
||||||
printers.get(i).setNextPrinter(printers.get(i + 1));
|
for (Map.Entry<String, PrinterHandler> entry : beans.entrySet()) {
|
||||||
|
PrinterHandler handler = entry.getValue();
|
||||||
|
String brand = handler.printerBrand;
|
||||||
|
PRINTER_MAP.put(brand, handler);
|
||||||
|
}
|
||||||
|
log.info("已注册打印机品牌:{}", PRINTER_MAP.keySet());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取打印机
|
||||||
|
*/
|
||||||
|
public PrinterHandler getPrinter(String key) {
|
||||||
|
PrinterHandler printer = PRINTER_MAP.get(key);
|
||||||
|
if (printer == null) {
|
||||||
|
throw new CzgException("未找到打印机: " + key);
|
||||||
|
}
|
||||||
|
return printer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理订单打印
|
||||||
|
*
|
||||||
|
* @param data 传递的数据
|
||||||
|
* @param printTypeEnum GUEST_ORDER ORDER PRE_ORDER ONLY_KITCHEN ALL_KITCHEN
|
||||||
|
*/
|
||||||
|
public void orderHandler(String data, PrinterHandler.PrintTypeEnum printTypeEnum, Integer placeNum) {
|
||||||
|
OrderInfo orderInfo = orderInfoService.getById(data);
|
||||||
|
if (orderInfo == null) {
|
||||||
|
throw new RuntimeException("订单打印失败,订单不存在");
|
||||||
|
}
|
||||||
|
List<OrderDetail> orderDetailList = new ArrayList<>();
|
||||||
|
orderDetailList = switch (printTypeEnum) {
|
||||||
|
case PrinterHandler.PrintTypeEnum.GUEST_ORDER -> {
|
||||||
|
orderInfo.setPlaceNum(placeNum);
|
||||||
|
yield orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()).eq(OrderDetail::getPlaceNum, placeNum));
|
||||||
|
}
|
||||||
|
case PrinterHandler.PrintTypeEnum.ORDER, PrinterHandler.PrintTypeEnum.PRE_ORDER,
|
||||||
|
PrinterHandler.PrintTypeEnum.ONLY_KITCHEN, PrinterHandler.PrintTypeEnum.ALL_KITCHEN ->
|
||||||
|
orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()));
|
||||||
|
default -> orderDetailList;
|
||||||
|
};
|
||||||
|
for (PrintMachine machine : getPrintMachine(orderInfo.getShopId(), printTypeEnum)) {
|
||||||
|
PrinterHandler printer = getPrinter(machine.getBrand());
|
||||||
|
redisService.set("order:print:" + orderInfo.getId(), "", 180);
|
||||||
|
switch (printTypeEnum) {
|
||||||
|
case PrinterHandler.PrintTypeEnum.GUEST_ORDER:
|
||||||
|
log.info("准备开始打印客看订单");
|
||||||
|
printer.guestOrderPrint(orderInfo, machine, orderDetailList);
|
||||||
|
break;
|
||||||
|
case PrinterHandler.PrintTypeEnum.ORDER:
|
||||||
|
log.info("准备开始打印订单");
|
||||||
|
printer.orderPrintBefore(machine, orderInfo, orderDetailList);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case PrinterHandler.PrintTypeEnum.PRE_ORDER:
|
||||||
|
log.info("准备开始打印预结算订单");
|
||||||
|
printer.preOrderPrintBefore(machine, orderInfo, orderDetailList);
|
||||||
|
break;
|
||||||
|
case PrinterHandler.PrintTypeEnum.ONLY_KITCHEN:
|
||||||
|
// 判断订单是否是先付费或者已结算
|
||||||
|
if (!"after-pay".equals(orderInfo.getPayMode()) && (OrderStatusEnums.UNPAID.getCode().equals(orderInfo.getStatus()) || OrderStatusEnums.CANCELLED.getCode().equals(orderInfo.getStatus()))) {
|
||||||
|
log.warn("此订单未支付, 订单信息: {}", orderInfo.getId());
|
||||||
|
}
|
||||||
|
List<OrderDetail> tbOrderDetailList = getCanPrintOrderDetails(machine, orderInfo.getId(), orderDetailList);
|
||||||
|
if (CollUtil.isEmpty(tbOrderDetailList)) {
|
||||||
|
log.info("此订单无打印菜品, 订单信息: {}", orderInfo.getId());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
log.info("准备开始打印菜品单");
|
||||||
|
//后厨单菜品
|
||||||
|
tbOrderDetailList.forEach(item -> {
|
||||||
|
Boolean b = redisService.hasKey(RedisCst.kitchenNormal(orderInfo.getId(), machine.getId(), item.getId()));
|
||||||
|
if (!b) {
|
||||||
|
FunUtils.safeRunVoid(() -> printer.onlyKitchenPrint(orderInfo, item, machine),
|
||||||
|
"订单id:{} ,后厨分单打印失败", orderInfo.getId());
|
||||||
|
// 保存已打印信息
|
||||||
|
redisService.set(RedisCst.kitchenNormal(orderInfo.getId(), machine.getId(), item.getId()), "", 180);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case PrinterHandler.PrintTypeEnum.ALL_KITCHEN:
|
||||||
|
Boolean exit = redisService.hasKey(RedisCst.kitchenAll(orderInfo.getId(), machine.getId()));
|
||||||
|
if (exit) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 判断订单是否是先付费或者已结算
|
||||||
|
if (!"after-pay".equals(orderInfo.getPayMode()) && (OrderStatusEnums.UNPAID.getCode().equals(orderInfo.getStatus()) || OrderStatusEnums.CANCELLED.getCode().equals(orderInfo.getStatus()))) {
|
||||||
|
log.warn("此订单未支付, 订单信息: {}", orderInfo.getId());
|
||||||
|
}
|
||||||
|
List<OrderDetail> allOrderDetailList = getCanPrintOrderDetails(machine, orderInfo.getId(), orderDetailList);
|
||||||
|
if (CollUtil.isEmpty(allOrderDetailList)) {
|
||||||
|
log.info("此订单无打印菜品, 订单信息: {}", orderInfo.getId());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
log.info("准备开始打印后厨整单");
|
||||||
|
printer.allKitchenPrint(orderInfo, allOrderDetailList, machine);
|
||||||
|
redisService.set(RedisCst.kitchenAll(orderInfo.getId(), machine.getId()), "", 180);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
/**
|
||||||
@Primary
|
* 处理其它打印
|
||||||
public PrinterHandler printerHandler() {
|
*
|
||||||
// 返回责任链的起始处理器
|
* @param data 传递的数据
|
||||||
return printers.getFirst();
|
* @param printTypeEnum IN_STOCK DAY_REPORT PRODUCT_REPORT RECHARGE STOCK_CHECK
|
||||||
|
*/
|
||||||
|
public void otherHandler(Long shopId, JSONObject data, PrinterHandler.PrintTypeEnum printTypeEnum) {
|
||||||
|
if (shopId == null || Objects.isNull(data)) {
|
||||||
|
log.info("otherHandler 打印数据为空, shopId: {}, data: {}", shopId, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ShopInfo shopInfo = shopInfoService.getById(shopId);
|
||||||
|
switch (printTypeEnum) {
|
||||||
|
case PrinterHandler.PrintTypeEnum.STOCK:
|
||||||
|
getPrintMachine(shopId, printTypeEnum)
|
||||||
|
.forEach(machine -> getPrinter(machine.getBrand())
|
||||||
|
.stockPrint(machine, shopInfo.getShopName(), JSONObject.parseObject(data.toJSONString(), StockPrintDTO.class)));
|
||||||
|
break;
|
||||||
|
case PrinterHandler.PrintTypeEnum.DAY_REPORT:
|
||||||
|
getPrintMachine(shopId, printTypeEnum)
|
||||||
|
.forEach(machine -> getPrinter(machine.getBrand())
|
||||||
|
.dayReportPrint(machine, shopInfo.getShopName(), JSONObject.parseObject(data.toJSONString(), DayReportPrintDTO.class)));
|
||||||
|
break;
|
||||||
|
case PrinterHandler.PrintTypeEnum.PRODUCT_REPORT:
|
||||||
|
getPrintMachine(shopId, printTypeEnum)
|
||||||
|
.forEach(machine -> getPrinter(machine.getBrand())
|
||||||
|
.productReportPrint(machine, shopInfo.getShopName(), JSONObject.parseObject(data.toJSONString(), ProductReportPrintDTO.class)));
|
||||||
|
break;
|
||||||
|
case PrinterHandler.PrintTypeEnum.RECHARGE:
|
||||||
|
getPrintMachine(shopId, printTypeEnum)
|
||||||
|
.forEach(machine -> getPrinter(machine.getBrand())
|
||||||
|
.rechargePrint(machine, shopInfo.getShopName(), JSONObject.parseObject(data.toJSONString(), RechargePrintDTO.class)));
|
||||||
|
break;
|
||||||
|
case PrinterHandler.PrintTypeEnum.STOCK_CHECK:
|
||||||
|
getPrintMachine(shopId, printTypeEnum)
|
||||||
|
.forEach(machine -> getPrinter(machine.getBrand())
|
||||||
|
.stockCheckPrint(machine, shopInfo.getShopName(), JSONObject.parseObject(data.toJSONString(), StockCheckPrintDTO.class)));
|
||||||
|
break;
|
||||||
|
case PrinterHandler.PrintTypeEnum.HANDOVER:
|
||||||
|
log.info("准备开始打印交班");
|
||||||
|
getPrintMachine(shopId, printTypeEnum)
|
||||||
|
.forEach(machine -> getPrinter(machine.getBrand()).handoverPrint(machine, shopInfo.getShopName(), JSONObject.parseObject(data.toJSONString(), HandoverRecordDTO.class)));
|
||||||
|
break;
|
||||||
|
case PrinterHandler.PrintTypeEnum.CALL:
|
||||||
|
log.info("准备开始打印叫号单");
|
||||||
|
getPrintMachine(shopId, printTypeEnum)
|
||||||
|
.forEach(machine -> getPrinter(machine.getBrand())
|
||||||
|
.callNumPrintBefore(machine, shopInfo.getShopName(), JSONObject.parseObject(data.toJSONString(), CallQueue.class)));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new CzgException("otherHandler 未知打印类型");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理退菜退款订单打印
|
||||||
|
*/
|
||||||
|
public void kitchenRefundAllHandler(String operator, OrderInfo orderInfo, List<OrderDetail> detailList) {
|
||||||
|
//后厨退菜单
|
||||||
|
getPrintMachine(orderInfo.getShopId(), PrinterHandler.PrintTypeEnum.REFUND_KITCHEN).forEach(machine -> {
|
||||||
|
Boolean isPrint = redisService.hasKey(RedisCst.kitchenRefundAll(orderInfo.getId(), machine.getId()));
|
||||||
|
if (!isPrint) {
|
||||||
|
getPrinter(machine.getBrand()).returnKitchenPrint(operator, orderInfo, detailList, machine);
|
||||||
|
redisService.set(RedisCst.kitchenRefundAll(orderInfo.getId(), machine.getId()), "", 180);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理退菜退款订单打印
|
||||||
|
*
|
||||||
|
* @param printTitle 退菜单 / 退款单
|
||||||
|
* @param operator 操作人
|
||||||
|
* @param refundAmount 退款金额
|
||||||
|
* @param refundReason 退款原因
|
||||||
|
* @param refundType 退款方式
|
||||||
|
* @param orderInfo 订单信息
|
||||||
|
* @param detailList 退菜/退款 列表
|
||||||
|
*/
|
||||||
|
public void refundOrderHandler(String printTitle, String operator, String refundAmount, String refundReason, String refundType,
|
||||||
|
OrderInfo orderInfo, List<OrderDetail> detailList) {
|
||||||
|
//前台退菜单
|
||||||
|
if ("退菜单".equals(printTitle)) {
|
||||||
|
getPrintMachine(orderInfo.getShopId(), PrinterHandler.PrintTypeEnum.RETURN_ORDER).forEach(machine ->
|
||||||
|
getPrinter(machine.getBrand()).returnOrderPrint(printTitle, operator, refundAmount, refundReason, refundType, orderInfo, machine, detailList));
|
||||||
|
} else if ("退款单".equals(printTitle)) {
|
||||||
|
getPrintMachine(orderInfo.getShopId(), PrinterHandler.PrintTypeEnum.REFUND_ORDER).forEach(machine ->
|
||||||
|
getPrinter(machine.getBrand()).returnOrderPrint(printTitle, operator, refundAmount, refundReason, refundType, orderInfo, machine, detailList));
|
||||||
|
} else {
|
||||||
|
log.error("未知的前台退款打印类型: {}", printTitle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected List<OrderDetail> getCanPrintOrderDetails(PrintMachine machine, Long orderId, List<OrderDetail> tbOrderDetailList) {
|
||||||
|
Set<Long> canPrintProSet = new HashSet<>();
|
||||||
|
boolean partPrint = false;
|
||||||
|
if ("1".equals(machine.getClassifyPrint())) {
|
||||||
|
partPrint = true;
|
||||||
|
List categoryIds = JSONObject.parseObject(StrUtil.emptyToDefault(machine.getCategoryIds(), "[]"), List.class);
|
||||||
|
if (CollUtil.isEmpty(categoryIds)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
List<Long> productIds = tbOrderDetailList.stream().map(OrderDetail::getProductId).collect(Collectors.toList());
|
||||||
|
canPrintProSet = productService.list(new QueryWrapper()
|
||||||
|
.in(Product::getCategoryId, categoryIds)
|
||||||
|
.in(Product::getId, productIds))
|
||||||
|
.stream()
|
||||||
|
.map(Product::getId)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
ArrayList<OrderDetail> orderDetails = new ArrayList<>();
|
||||||
|
for (OrderDetail item : tbOrderDetailList) {
|
||||||
|
//-999 台位费
|
||||||
|
if (item.getNum().compareTo(BigDecimal.ZERO) <= 0 || item.getProductId().equals(-999L)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Boolean isPrint = redisService.hasKey(RedisCst.kitchenNormal(orderId, machine.getId(), item.getId()));
|
||||||
|
if (isPrint) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (item.getIsPrint() != null && item.getIsPrint() == 1 && (!partPrint || canPrintProSet.contains(item.getProductId()))) {
|
||||||
|
orderDetails.add(item);
|
||||||
|
} else {
|
||||||
|
log.info("此菜品不在打印分类或属于免打, {} {} {}", item.getProductName(), item.getSkuName(), item.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return orderDetails;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取可用打印机
|
||||||
|
*
|
||||||
|
* @param shopId 店铺id
|
||||||
|
* @param contentType GUEST_ORDER("客看单"),
|
||||||
|
* PRE_ORDER("预结算单"),
|
||||||
|
* ORDER("订单结算单"),
|
||||||
|
* RETURN_ORDER("退菜单"),
|
||||||
|
* REFUND_ORDER("退款单"),
|
||||||
|
* <p>
|
||||||
|
* ALL_KITCHEN("后厨整单"),
|
||||||
|
* ONLY_KITCHEN("后厨分单"),
|
||||||
|
* REFUND_KITCHEN("后厨退菜单"),
|
||||||
|
* <p>
|
||||||
|
* HANDOVER("交班单"),
|
||||||
|
* CALL("排队取号"),
|
||||||
|
* RECHARGE("储值单"),
|
||||||
|
* STOCK("出入库单"),
|
||||||
|
* STOCK_CHECK("盘点单"),
|
||||||
|
* PRODUCT_REPORT("商品报表"),
|
||||||
|
* DAY_REPORT("经营日报"),
|
||||||
|
* DAY_ORDER("日结单");
|
||||||
|
* @return 打印机列表
|
||||||
|
*/
|
||||||
|
private List<PrintMachine> getPrintMachine(Long shopId, PrinterHandler.PrintTypeEnum contentType) {
|
||||||
|
QueryWrapper wrapper = new QueryWrapper()
|
||||||
|
.eq(PrintMachine::getStatus, 1)
|
||||||
|
.eq(PrintMachine::getShopId, shopId)
|
||||||
|
.eq(PrintMachine::getPrintType, "cash")
|
||||||
|
.like(PrintMachine::getPrintContentType, contentType)
|
||||||
|
.eq(PrintMachine::getConnectionType, "云打印");
|
||||||
|
List<PrintMachine> list = printMachineService.list(wrapper);
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
log.error("店铺未配置打印机,店铺id: {}", shopId);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
log.info("打印机列表: {}", list);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +1,28 @@
|
|||||||
package com.czg.service.order.print;
|
package com.czg.service.order.print;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.czg.account.dto.HandoverRecordDTO;
|
import com.czg.account.dto.HandoverRecordDTO;
|
||||||
import com.czg.account.dto.PrintOrderDetailDTO;
|
import com.czg.account.dto.PrintOrderDetailDTO;
|
||||||
import com.czg.account.entity.*;
|
import com.czg.account.entity.*;
|
||||||
import com.czg.account.service.*;
|
import com.czg.account.service.*;
|
||||||
import com.czg.config.RedisCst;
|
|
||||||
import com.czg.constants.ParamCodeCst;
|
import com.czg.constants.ParamCodeCst;
|
||||||
import com.czg.market.service.OrderInfoService;
|
import com.czg.market.service.OrderInfoService;
|
||||||
import com.czg.order.entity.OrderDetail;
|
import com.czg.order.entity.OrderDetail;
|
||||||
import com.czg.order.entity.OrderInfo;
|
import com.czg.order.entity.OrderInfo;
|
||||||
import com.czg.order.service.OrderDetailService;
|
import com.czg.order.service.OrderDetailService;
|
||||||
import com.czg.order.service.PrintMachineLogService;
|
import com.czg.order.service.PrintMachineLogService;
|
||||||
|
import com.czg.print.*;
|
||||||
import com.czg.product.entity.ProdSku;
|
import com.czg.product.entity.ProdSku;
|
||||||
import com.czg.product.entity.Product;
|
|
||||||
import com.czg.product.service.ProdSkuService;
|
import com.czg.product.service.ProdSkuService;
|
||||||
import com.czg.product.service.ProductService;
|
|
||||||
import com.czg.resp.CzgResult;
|
|
||||||
import com.czg.service.RedisService;
|
import com.czg.service.RedisService;
|
||||||
import com.czg.service.order.enums.OrderStatusEnums;
|
import com.czg.service.order.enums.OrderStatusEnums;
|
||||||
import com.czg.system.dto.SysParamsDTO;
|
|
||||||
import com.czg.system.service.SysParamsService;
|
import com.czg.system.service.SysParamsService;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
@@ -39,8 +30,8 @@ import org.springframework.web.client.RestTemplate;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
import java.util.stream.Collectors;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
@@ -48,10 +39,9 @@ import java.util.stream.Collectors;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@ToString
|
@ToString
|
||||||
public abstract class PrinterHandler {
|
public abstract class PrinterHandler {
|
||||||
@Setter
|
public String printerBrand;
|
||||||
protected PrinterHandler nextPrinter;
|
@Resource
|
||||||
protected String printerBrand;
|
protected PrintConfig printConfig;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
protected RestTemplate restTemplate;
|
protected RestTemplate restTemplate;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -62,7 +52,6 @@ public abstract class PrinterHandler {
|
|||||||
protected RedisService redisService;
|
protected RedisService redisService;
|
||||||
@Resource
|
@Resource
|
||||||
protected PrintMachineLogService printMachineLogService;
|
protected PrintMachineLogService printMachineLogService;
|
||||||
|
|
||||||
@DubboReference
|
@DubboReference
|
||||||
protected SysParamsService sysParamsService;
|
protected SysParamsService sysParamsService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
@@ -78,449 +67,48 @@ public abstract class PrinterHandler {
|
|||||||
@DubboReference
|
@DubboReference
|
||||||
private ShopStaffService shopStaffService;
|
private ShopStaffService shopStaffService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
protected ProductService productService;
|
|
||||||
@DubboReference
|
|
||||||
protected ProdSkuService prodSkuService;
|
protected ProdSkuService prodSkuService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private PrintMachineService printMachineService;
|
|
||||||
@DubboReference
|
|
||||||
private HandoverRecordRpcService handoverRecordService;
|
private HandoverRecordRpcService handoverRecordService;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public enum PrintTypeEnum {
|
public enum PrintTypeEnum {
|
||||||
HANDOVER("交班", "handover"),
|
GUEST_ORDER("客看单"),
|
||||||
|
PRE_ORDER("预结算单"),
|
||||||
|
ORDER("订单结算单"),
|
||||||
|
RETURN_ORDER("退菜单"),
|
||||||
|
REFUND_ORDER("退款单"),
|
||||||
|
|
||||||
ONE_AND_ORDER("菜品和结算单同时打印", "oneAndOrder"),
|
ALL_KITCHEN("后厨整单"),
|
||||||
PRE_ORDER("预结算单", "preOrder"),
|
ONLY_KITCHEN("后厨分单"),
|
||||||
ORDER("订单结算单", "order"),
|
REFUND_KITCHEN("后厨退菜单"),
|
||||||
GUEST_ORDER("客看单", "guestOrder"),
|
|
||||||
|
|
||||||
RETURN_FOOD("退菜", "returnFood"),
|
HANDOVER("交班单"),
|
||||||
RETURN_ORDER("退单", "returnOrder"),
|
CALL("排队取号"),
|
||||||
|
RECHARGE("储值单"),
|
||||||
|
STOCK("出入库单"),
|
||||||
|
STOCK_CHECK("盘点单"),
|
||||||
|
PRODUCT_REPORT("商品报表"),
|
||||||
|
DAY_REPORT("经营日报"),
|
||||||
|
DAY_ORDER("日结单");
|
||||||
|
|
||||||
ONE("菜品", "one"),
|
|
||||||
CALL("叫号", "call");
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String code;
|
|
||||||
|
|
||||||
PrintTypeEnum(String name, String code) {
|
PrintTypeEnum(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.code = code;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public static class PrintDetailInfo {
|
|
||||||
private boolean isPrint;
|
|
||||||
// private boolean isReturn;
|
|
||||||
private long orderId;
|
|
||||||
private long detailId;
|
|
||||||
private BigDecimal printNum;
|
|
||||||
private BigDecimal printReturnNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public static class PrintInfoDTO {
|
|
||||||
private long count;
|
|
||||||
// 打印标题 结算单/客看单/预结算单 退菜单/退款单
|
|
||||||
private String printTitle;
|
|
||||||
private String shopName;
|
|
||||||
//打印类型 收银-堂食
|
|
||||||
private String printType;
|
|
||||||
//台桌区域-台桌号
|
|
||||||
private String pickupNum;
|
|
||||||
private String orderNo;
|
|
||||||
//结账时间
|
|
||||||
private String tradeDate;
|
|
||||||
//操作人名称
|
|
||||||
private String operator;
|
|
||||||
private String payAmount;
|
|
||||||
private String originalAmount;
|
|
||||||
//余额
|
|
||||||
// private String balance;
|
|
||||||
private String payType;
|
|
||||||
private String remark;
|
|
||||||
//取餐码
|
|
||||||
private String outNumber;
|
|
||||||
private String discountAmount;
|
|
||||||
// private String discountRadio;
|
|
||||||
// private String orderNum;
|
|
||||||
private String seatNum;
|
|
||||||
private String seatAmount;
|
|
||||||
private String packFee;
|
|
||||||
// 是否退款单
|
|
||||||
private boolean isReturn;
|
|
||||||
//退款单用
|
|
||||||
private String refundAmount;
|
|
||||||
//退款方式 现金退款/原路退回
|
|
||||||
private String refundType;
|
|
||||||
//退款原因
|
|
||||||
private String refundReason;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public PrinterHandler(String printerBrand) {
|
public PrinterHandler(String printerBrand) {
|
||||||
this.printerBrand = printerBrand;
|
this.printerBrand = printerBrand;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取可用打印机
|
|
||||||
*
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @param subType 打印类型(分类)label标签 cash小票 kitchen出品
|
|
||||||
* @param printMethod 打印方式 all-全部打印 normal-仅打印结账单「前台」one-仅打印制作单「厨房」
|
|
||||||
* @param printType 打印类型,JSON数组 refund-确认退款单 handover-交班单 queue-排队取号
|
|
||||||
* @return 打印机列表
|
|
||||||
*/
|
|
||||||
private List<PrintMachine> getPrintMachine(Long shopId, String subType, String printMethod, String printType) {
|
|
||||||
QueryWrapper wrapper = new QueryWrapper()
|
|
||||||
.eq(PrintMachine::getStatus, 1)
|
|
||||||
.eq(PrintMachine::getShopId, shopId)
|
|
||||||
.eq(PrintMachine::getSubType, subType)
|
|
||||||
.eq(PrintMachine::getConnectionType, "网络");
|
|
||||||
|
|
||||||
if (StrUtil.isNotEmpty(printMethod)) {
|
|
||||||
List<String> arrayList = switch (printMethod) {
|
|
||||||
case "all" -> Arrays.asList("one", "normal", "all");
|
|
||||||
case "one" -> Arrays.asList("one", "all");
|
|
||||||
case "normal" -> Arrays.asList("normal", "all");
|
|
||||||
default -> new ArrayList<>();
|
|
||||||
};
|
|
||||||
if (!arrayList.isEmpty()) {
|
|
||||||
wrapper.in(PrintMachine::getPrintMethod, arrayList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ("callTicket".equals(printType)) {
|
|
||||||
printType = "queue";
|
|
||||||
}
|
|
||||||
if (StrUtil.isNotEmpty(printType)) {
|
|
||||||
wrapper.like(PrintMachine::getPrintType, printType);
|
|
||||||
}
|
|
||||||
List<PrintMachine> list = printMachineService.list(wrapper);
|
|
||||||
if (list.isEmpty()) {
|
|
||||||
log.error("店铺未配置打印机,店铺id: {}", shopId);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info("打印机列表: {}", list);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理订单打印
|
|
||||||
*
|
|
||||||
* @param data 传递的数据
|
|
||||||
* @param printTypeEnum order preOrder one
|
|
||||||
*/
|
|
||||||
public void orderHandler(String data, PrintTypeEnum printTypeEnum, Integer placeNum) {
|
|
||||||
String printMethod;
|
|
||||||
OrderInfo orderInfo = orderInfoService.getById(data);
|
|
||||||
if (orderInfo == null) {
|
|
||||||
throw new RuntimeException("订单打印失败,订单不存在");
|
|
||||||
}
|
|
||||||
switch (printTypeEnum) {
|
|
||||||
case PrintTypeEnum.GUEST_ORDER:
|
|
||||||
case PrintTypeEnum.PRE_ORDER:
|
|
||||||
case PrintTypeEnum.ORDER:
|
|
||||||
printMethod = "normal";
|
|
||||||
break;
|
|
||||||
case PrintTypeEnum.ONE:
|
|
||||||
printMethod = "one";
|
|
||||||
break;
|
|
||||||
case PrintTypeEnum.ONE_AND_ORDER:
|
|
||||||
printMethod = "all";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("未知打印类型");
|
|
||||||
}
|
|
||||||
getPrintMachine(orderInfo.getShopId(), "cash", printMethod, "").forEach(machine -> {
|
|
||||||
handleRequest(machine, placeNum, orderInfo, printTypeEnum);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理退菜退款订单打印
|
|
||||||
*
|
|
||||||
* @param printTitle 退菜单 / 退款单
|
|
||||||
* @param operator 操作人
|
|
||||||
* @param refundAmount 退款金额
|
|
||||||
* @param refundReason 退款原因
|
|
||||||
* @param refundType 退款方式
|
|
||||||
* @param orderInfo 订单信息
|
|
||||||
* @param detailList 退菜/退款 列表
|
|
||||||
*/
|
|
||||||
public void refundOrderHandler(String printTitle, String operator, String refundAmount, String refundReason, String refundType,
|
|
||||||
OrderInfo orderInfo, List<OrderDetail> detailList) {
|
|
||||||
getPrintMachine(orderInfo.getShopId(), "cash", "normal", "").forEach(machine -> {
|
|
||||||
orderInfo.setTableName(getTableAreaAndName(orderInfo.getShopId(), orderInfo.getTableCode(), orderInfo.getTableName()));
|
|
||||||
refundHandleRequest(machine, printTitle, operator, refundAmount, refundReason, refundType, orderInfo, detailList);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 叫号打印
|
|
||||||
*
|
|
||||||
* @param data 传递的数据
|
|
||||||
*/
|
|
||||||
public void callHandler(String data) {
|
|
||||||
|
|
||||||
CallQueue queue = callQueueService.getById(data);
|
|
||||||
if (queue == null) {
|
|
||||||
throw new RuntimeException("叫号信息不存在: " + data);
|
|
||||||
}
|
|
||||||
Long shopId = queue.getShopId();
|
|
||||||
if (shopId == null) {
|
|
||||||
throw new RuntimeException("店铺不存在, id:" + shopId);
|
|
||||||
}
|
|
||||||
getPrintMachine(shopId, "cash", "", "queue").forEach(machine -> handleRequest(machine, null, queue, PrintTypeEnum.CALL));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班打印
|
|
||||||
*
|
|
||||||
* @param data 传递的数据
|
|
||||||
*/
|
|
||||||
public void handoverHandler(String data) {
|
|
||||||
HandoverRecordDTO record = handoverRecordService.getHandoverRecordById(Long.parseLong(data));
|
|
||||||
if (record == null) {
|
|
||||||
throw new RuntimeException("交班票打印失败,交班记录不存在");
|
|
||||||
}
|
|
||||||
Long shopId = record.getShopId();
|
|
||||||
if (shopId == null) {
|
|
||||||
throw new RuntimeException("店铺不存在, id:" + shopId);
|
|
||||||
}
|
|
||||||
getPrintMachine(shopId, "cash", "", "handover").forEach(machine -> handleRequest(machine, null, record, PrintTypeEnum.HANDOVER));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleRequest(PrintMachine machine, Integer placeNum, Object data, PrintTypeEnum printTypeEnum) {
|
|
||||||
if (canHandleRequest(machine.getContentType(), machine.getConnectionType())) {
|
|
||||||
log.info("打印机: {}, 传递信息: {}", machine.getName(), data);
|
|
||||||
print(machine, placeNum, data, printTypeEnum);
|
|
||||||
} else if (nextPrinter != null) {
|
|
||||||
log.info("当前打印机无法处理: {},将请求传递给下一个打印机:{}...", this.printerBrand, nextPrinter.printerBrand);
|
|
||||||
nextPrinter.handleRequest(machine, placeNum, data, printTypeEnum);
|
|
||||||
} else {
|
|
||||||
log.warn("未找到匹配打印机");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void refundHandleRequest(PrintMachine machine, String printTitle, String operator, String refundAmount, String refundReason, String refundType,
|
|
||||||
OrderInfo orderInfo, List<OrderDetail> detailList) {
|
|
||||||
if (canHandleRequest(machine.getContentType(), machine.getConnectionType())) {
|
|
||||||
log.info("退款打印机: {}, 传递信息: {}", machine.getName(), orderInfo.getId());
|
|
||||||
returnOrderPrint(printTitle, operator, refundAmount, refundReason, refundType, orderInfo, machine, detailList);
|
|
||||||
} else if (nextPrinter != null) {
|
|
||||||
log.info("当前打印机无法处理: {},将请求传递给下一个打印机:{}...", this.printerBrand, nextPrinter.printerBrand);
|
|
||||||
nextPrinter.refundHandleRequest(machine, printTitle, operator, refundAmount, refundReason, refundType, orderInfo, detailList);
|
|
||||||
} else {
|
|
||||||
log.warn("未找到匹配打印机");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean canHandleRequest(String currentBrand, String connectType) {
|
|
||||||
log.info("handle判断是否可处理: {}, 连接类型: {}, handler类型: {}", currentBrand, connectType, printerBrand);
|
|
||||||
if (StrUtil.isBlank(printerBrand)) {
|
|
||||||
throw new RuntimeException("打印机品牌未赋值");
|
|
||||||
}
|
|
||||||
return printerBrand.equals(currentBrand) && "网络".equals(connectType);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected List<OrderDetail> getCanPrintOrderDetails(boolean partPrint, Long orderId, List<OrderDetail> tbOrderDetailList, List<?> categoryIds) {
|
|
||||||
List<Long> productIds = tbOrderDetailList.stream().map(OrderDetail::getProductId).collect(Collectors.toList());
|
|
||||||
|
|
||||||
Map<Long, Boolean> canPrintProMap = categoryIds.isEmpty() ? new HashMap<>() :
|
|
||||||
productService.list(new QueryWrapper().in(Product::getCategoryId, categoryIds).in(Product::getId, productIds))
|
|
||||||
.stream().collect(Collectors.toMap(Product::getId, i -> true));
|
|
||||||
|
|
||||||
ArrayList<OrderDetail> orderDetails = new ArrayList<>();
|
|
||||||
tbOrderDetailList.forEach(item -> {
|
|
||||||
Object o = redisService.get(RedisCst.getPrintOrderDetailKey(orderId, item.getId()));
|
|
||||||
|
|
||||||
if (item.getIsPrint() != null && item.getIsPrint() == 1 && (canPrintProMap.get(item.getProductId()) != null || !partPrint)) {
|
|
||||||
item.setReturnNum(item.getReturnNum() == null ? BigDecimal.ZERO : item.getReturnNum());
|
|
||||||
PrintDetailInfo printDetailInfo = o != null ? JSONObject.parseObject((String) o, PrintDetailInfo.class) : null;
|
|
||||||
if (printDetailInfo != null) {
|
|
||||||
if (item.getNum().compareTo(BigDecimal.ZERO) != 0 && item.getNum().compareTo(printDetailInfo.getPrintNum()) <= 0) {
|
|
||||||
log.info("此菜品已打印, {} {} {}", item.getProductName(), item.getSkuName(), printDetailInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.getReturnNum().compareTo(BigDecimal.ZERO) != 0 && item.getReturnNum().compareTo(printDetailInfo.getPrintReturnNum()) <= 0) {
|
|
||||||
log.info("此退菜菜品已打印, {} {} {}", item.getProductName(), item.getSkuName(), printDetailInfo);
|
|
||||||
}
|
|
||||||
item.setNum(item.getNum().subtract(printDetailInfo.getPrintNum()));
|
|
||||||
item.setReturnNum(item.getReturnNum().subtract(printDetailInfo.getPrintReturnNum()));
|
|
||||||
orderDetails.add(item);
|
|
||||||
} else {
|
|
||||||
orderDetails.add(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
log.info("此菜品不在打印分类或属于免打, {} {} {}", item.getProductName(), item.getSkuName(), item.getId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return orderDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void print(PrintMachine machine, Integer placeNum, Object data, PrintTypeEnum printTypeEnum) {
|
|
||||||
switch (printTypeEnum) {
|
|
||||||
case PrintTypeEnum.HANDOVER:
|
|
||||||
log.info("准备开始打印交班");
|
|
||||||
if (data instanceof HandoverRecordDTO record) {
|
|
||||||
handoverPrint(machine, record);
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException("传递数据类型有误");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PrintTypeEnum.GUEST_ORDER:
|
|
||||||
log.info("准备开始打印客看订单");
|
|
||||||
if (data instanceof OrderInfo orderInfo) {
|
|
||||||
orderInfo.setPlaceNum(placeNum);
|
|
||||||
List<OrderDetail> orderDetailList = orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()).eq(OrderDetail::getPlaceNum, placeNum));
|
|
||||||
guestOrderPrint(orderInfo, machine, orderDetailList);
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException("传递数据类型有误");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PrintTypeEnum.ORDER:
|
|
||||||
log.info("准备开始打印订单");
|
|
||||||
if (data instanceof OrderInfo orderInfo) {
|
|
||||||
redisService.set("order:print:" + orderInfo.getId(), "", 180);
|
|
||||||
List<OrderDetail> orderDetailList = orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()));
|
|
||||||
orderPrint(machine, orderInfo, orderDetailList);
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException("传递数据类型有误");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PrintTypeEnum.PRE_ORDER:
|
|
||||||
log.info("准备开始打印预结算订单");
|
|
||||||
if (data instanceof OrderInfo orderInfo) {
|
|
||||||
redisService.set("order:print:" + orderInfo.getId(), "", 180);
|
|
||||||
List<OrderDetail> orderDetailList = orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()));
|
|
||||||
preOrderPrint(machine, orderInfo, orderDetailList);
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException("传递数据类型有误");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PrintTypeEnum.ONE:
|
|
||||||
log.info("准备开始打印菜品单");
|
|
||||||
if (data instanceof OrderInfo orderInfo) {
|
|
||||||
redisService.set("order:print:" + orderInfo.getId(), "", 180);
|
|
||||||
List<OrderDetail> orderDetailList = orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()));
|
|
||||||
onlyKitchen(machine, orderInfo, orderDetailList);
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException("传递数据类型有误");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PrintTypeEnum.CALL:
|
|
||||||
log.info("准备开始打印叫号单");
|
|
||||||
if (data instanceof CallQueue queue) {
|
|
||||||
onlyCallNumPrint(machine, queue);
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException("传递数据类型有误");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PrintTypeEnum.ONE_AND_ORDER:
|
|
||||||
log.info("准备开始打印菜品以及结算单");
|
|
||||||
if (data instanceof OrderInfo orderInfo) {
|
|
||||||
redisService.set("order:print:" + orderInfo.getId(), "", 180);
|
|
||||||
List<OrderDetail> orderDetailList = orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()));
|
|
||||||
switch (machine.getPrintMethod()) {
|
|
||||||
case "all":
|
|
||||||
orderPrint(machine, orderInfo, orderDetailList);
|
|
||||||
onlyKitchen(machine, orderInfo, orderDetailList);
|
|
||||||
break;
|
|
||||||
case "one":
|
|
||||||
log.info("打印机仅打印one");
|
|
||||||
onlyKitchen(machine, orderInfo, orderDetailList);
|
|
||||||
break;
|
|
||||||
case "normal":
|
|
||||||
log.info("打印机仅打印normal");
|
|
||||||
orderPrint(machine, orderInfo, orderDetailList);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("打印方法有误");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException("传递数据类型有误");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 仅打印制作单「厨房」
|
|
||||||
*/
|
|
||||||
private void onlyKitchen(PrintMachine machine, OrderInfo orderInfo, List<OrderDetail> tbOrderDetailList) {
|
|
||||||
// 判断订单是否是先付费或者已结算
|
|
||||||
if (!"after-pay".equals(orderInfo.getPayMode()) && (OrderStatusEnums.UNPAID.getCode().equals(orderInfo.getStatus()) || OrderStatusEnums.CANCELLED.getCode().equals(orderInfo.getStatus()))) {
|
|
||||||
log.warn("此订单未支付, 订单信息: {}", orderInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<?> categoryIds = JSONObject.parseObject(StrUtil.emptyToDefault(machine.getCategoryIds(), "[]"), List.class);
|
|
||||||
if (StrUtil.isEmpty(machine.getClassifyPrint())) {
|
|
||||||
log.error("分类打印是空, classifyPrint: {}", machine.getClassifyPrint());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 已打印详情信息
|
|
||||||
Map<Long, OrderDetail> detailMap = tbOrderDetailList.stream().map(item -> BeanUtil.copyProperties(item, OrderDetail.class)).collect(Collectors.toMap(OrderDetail::getId, i -> i));
|
|
||||||
tbOrderDetailList = getCanPrintOrderDetails("1".equals(machine.getClassifyPrint()), orderInfo.getId(), tbOrderDetailList, categoryIds);
|
|
||||||
tbOrderDetailList.parallelStream().filter(o -> ObjectUtil.defaultIfNull(o.getIsPrint(), 0) == 1).forEach(item -> {
|
|
||||||
if (item.getNum().compareTo(BigDecimal.ZERO) <= 0 && item.getReturnNum().compareTo(BigDecimal.ZERO) <= 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Integer isWaitCall = ObjectUtil.defaultIfNull(item.getIsWaitCall(), 0);
|
|
||||||
if (isWaitCall == 1) {
|
|
||||||
if (!item.getProductName().contains("【等叫】")) {
|
|
||||||
item.setProductName("【等叫】" + item.getProductName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Integer isTemporary = ObjectUtil.defaultIfNull(item.getIsTemporary(), 0);
|
|
||||||
if (isTemporary == 1) {
|
|
||||||
item.setProductId(0L);
|
|
||||||
item.setSkuId(0L);
|
|
||||||
if (!item.getProductName().contains("【临】")) {
|
|
||||||
item.setProductName("【临】" + item.getProductName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
boolean isGift = item.getIsGift() != null && item.getIsGift() == 1;
|
|
||||||
if (isGift && !item.getProductName().contains("【赠】")) {
|
|
||||||
item.setProductName("【赠】" + item.getProductName());
|
|
||||||
}
|
|
||||||
// 台位费不打印
|
|
||||||
if (item.getProductId().equals(-999L)) {
|
|
||||||
log.info("台位费商品,不打印");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.getReturnNum().compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
returnDishesPrint("操作人名称", orderInfo, item, machine);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.getNum().compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
normalDishesPrint("操作人名称", orderInfo, item, machine);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 保存已打印信息
|
|
||||||
OrderDetail orderDetail = detailMap.get(item.getId());
|
|
||||||
redisService.set(RedisCst.getPrintOrderDetailKey(orderInfo.getId(), item.getId()),
|
|
||||||
JSONObject.toJSONString(new PrintDetailInfo().setPrint(item.getIsPrint() == 1).setDetailId(item.getId())
|
|
||||||
.setPrintNum(orderDetail.getNum()).setPrintReturnNum(orderDetail.getReturnNum())), 3600 * 24);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印预结算单「前台」
|
* 打印预结算单「前台」
|
||||||
*/
|
*/
|
||||||
private void preOrderPrint(PrintMachine machine, OrderInfo orderInfo, List<OrderDetail> orderDetail) {
|
public void preOrderPrintBefore(PrintMachine machine, OrderInfo orderInfo, List<OrderDetail> orderDetail) {
|
||||||
// 判断订单是否是先付费或者已结算
|
// 判断订单是否是先付费或者已结算
|
||||||
if (OrderStatusEnums.CANCELLED.getCode().equals(orderInfo.getStatus())) {
|
if (OrderStatusEnums.CANCELLED.getCode().equals(orderInfo.getStatus())) {
|
||||||
log.warn("已取消, 订单信息: {}", orderInfo);
|
log.warn("已取消, 订单信息: {}", orderInfo);
|
||||||
@@ -570,7 +158,7 @@ public abstract class PrinterHandler {
|
|||||||
/**
|
/**
|
||||||
* 仅打印结算单「前台」
|
* 仅打印结算单「前台」
|
||||||
*/
|
*/
|
||||||
private void orderPrint(PrintMachine machine, OrderInfo orderInfo, List<OrderDetail> tbOrderDetailList) {
|
public void orderPrintBefore(PrintMachine machine, OrderInfo orderInfo, List<OrderDetail> tbOrderDetailList) {
|
||||||
// 判断订单是否是先付费或者已结算
|
// 判断订单是否是先付费或者已结算
|
||||||
if (OrderStatusEnums.UNPAID.getCode().equals(orderInfo.getStatus()) || OrderStatusEnums.CANCELLED.getCode().equals(orderInfo.getStatus())) {
|
if (OrderStatusEnums.UNPAID.getCode().equals(orderInfo.getStatus()) || OrderStatusEnums.CANCELLED.getCode().equals(orderInfo.getStatus())) {
|
||||||
log.warn("此订单未支付或已取消, 订单信息: {}", orderInfo);
|
log.warn("此订单未支付或已取消, 订单信息: {}", orderInfo);
|
||||||
@@ -618,26 +206,20 @@ public abstract class PrinterHandler {
|
|||||||
/**
|
/**
|
||||||
* 打印排队小票
|
* 打印排队小票
|
||||||
*/
|
*/
|
||||||
private void onlyCallNumPrint(PrintMachine machine, CallQueue queue) {
|
public void callNumPrintBefore(PrintMachine machine, String shopName, CallQueue queue) {
|
||||||
if (queue == null) {
|
if (queue == null) {
|
||||||
log.warn("叫号记录不存在");
|
log.warn("叫号记录不存在");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String callUrl = sysParamsService.getSysParamValue(ParamCodeCst.System.CALL_PAGE_URL);
|
||||||
CzgResult<SysParamsDTO> paramsByCode = sysParamsService.getParamsByCode(ParamCodeCst.System.CALL_PAGE_URL);
|
|
||||||
SysParamsDTO params = paramsByCode.getData();
|
|
||||||
String callUrl = null;
|
|
||||||
if (params != null && StrUtil.isNotBlank(params.getParamValue())) {
|
|
||||||
callUrl = params.getParamValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
CallTable tbCallTable = callTableService.getById(queue.getCallTableId());
|
CallTable tbCallTable = callTableService.getById(queue.getCallTableId());
|
||||||
ShopInfo shopInfo = shopInfoService.getById(queue.getShopId());
|
long count = callQueueService.count(new QueryWrapper()
|
||||||
callNumPrint(machine, queue.getCallNum(), shopInfo.getShopName(), tbCallTable.getName(), tbCallTable.getNote(), String.valueOf(callQueueService.count(new QueryWrapper()
|
.eq(CallQueue::getShopId, queue.getShopId())
|
||||||
.eq(CallQueue::getShopId, queue.getShopId())
|
.eq(CallQueue::getCallTableId, queue.getCallTableId())
|
||||||
.eq(CallQueue::getCallTableId, queue.getCallTableId())
|
.lt(CallQueue::getId, queue.getId())
|
||||||
.lt(CallQueue::getId, queue.getId())
|
.in(CallQueue::getState, 0, 1));
|
||||||
.in(CallQueue::getState, 0, 1))), callUrl == null ? "未配置页面" : StrUtil.format(callUrl, queue.getShopId(), queue.getId()), queue.getCreateTime(),
|
callNumPrint(machine, queue.getCallNum(), shopName, tbCallTable.getName(), tbCallTable.getNote(), String.valueOf(count),
|
||||||
|
StrUtil.isEmpty(callUrl) ? "未配置页面" : StrUtil.format(callUrl, queue.getShopId(), queue.getId()), queue.getCreateTime(),
|
||||||
StrUtil.format("过号顺延{}桌 {}桌后需重新排号 谢谢理解!", tbCallTable.getPostponeNum(), tbCallTable.getPostponeNum()));
|
StrUtil.format("过号顺延{}桌 {}桌后需重新排号 谢谢理解!", tbCallTable.getPostponeNum(), tbCallTable.getPostponeNum()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -648,31 +230,32 @@ public abstract class PrinterHandler {
|
|||||||
return StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getTakeCode() : orderInfo.getTableName();
|
return StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getTakeCode() : orderInfo.getTableName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTableAreaAndName(Long shopId, String tableCode, String tableName) {
|
|
||||||
return shopTableService.getTableAreaAndName(shopId, tableCode, tableName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
public PrintInfoDTO returnOrderPrint(String printTitle, String operator, String refundAmount, String refundReason, String refundType,
|
* 打印退菜/退款单
|
||||||
OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
*/
|
||||||
|
protected OrderPrintDTO returnOrderPrint(String printTitle, String operator, String refundAmount, String refundReason, String refundType,
|
||||||
|
OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
||||||
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
|
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
|
||||||
PrintInfoDTO printInfoDTO = new PrintInfoDTO().setShopName(shopInfo.getShopName()).setPrintType("收银-堂食")
|
OrderPrintDTO orderPrintDTO = new OrderPrintDTO().setShopName(shopInfo.getShopName()).setPrintType("收银-堂食")
|
||||||
.setOrderNo(orderInfo.getOrderNo())
|
.setOrderNo(orderInfo.getOrderNo())
|
||||||
.setTradeDate(DateUtil.format(orderInfo.getCreateTime(), "yyyy/MM/dd HH:mm:ss"))
|
.setTradeDate(DateUtil.format(orderInfo.getCreateTime(), "yyyy/MM/dd HH:mm:ss"))
|
||||||
.setOperator(operator)
|
.setOperator(operator)
|
||||||
.setReturn(true)
|
.setReturn(true)
|
||||||
.setPrintTitle(printTitle);
|
.setPrintTitle(printTitle);
|
||||||
printInfoDTO.setSeatNum(orderInfo.getSeatNum() == null ? "" : orderInfo.getSeatNum().toString());
|
orderPrintDTO.setSeatNum(orderInfo.getSeatNum() == null ? "" : orderInfo.getSeatNum().toString());
|
||||||
printInfoDTO.setPickupNum(getTableAreaAndName(orderInfo.getShopId(), orderInfo.getTableCode(), orderInfo.getTableName()));
|
orderPrintDTO.setPickupNum(orderInfo.getTableName());
|
||||||
printInfoDTO.setRefundAmount(refundAmount);
|
orderPrintDTO.setRefundAmount(refundAmount);
|
||||||
printInfoDTO.setRefundReason(refundReason);
|
orderPrintDTO.setRefundReason(refundReason);
|
||||||
printInfoDTO.setRefundType("cash".equals(refundType) ? "线下退款" : "原路退回");
|
orderPrintDTO.setRefundType("cash".equals(refundType) ? "线下退款" : "原路退回");
|
||||||
return printInfoDTO;
|
return orderPrintDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
public PrintInfoDTO guestOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
* 打印客看单
|
||||||
PrintInfoDTO printInfoDTO = getPrintInfoDTO(orderInfo, "客看单");
|
*/
|
||||||
|
protected OrderPrintDTO guestOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
||||||
|
OrderPrintDTO orderPrintDTO = getPrintInfoDTO(orderInfo, "客看单");
|
||||||
|
|
||||||
BigDecimal originalAmount = BigDecimal.ZERO;
|
BigDecimal originalAmount = BigDecimal.ZERO;
|
||||||
for (OrderDetail orderDetail : detailList) {
|
for (OrderDetail orderDetail : detailList) {
|
||||||
@@ -697,126 +280,82 @@ public abstract class PrinterHandler {
|
|||||||
orderDetail.setProductName("【赠】%s".formatted(orderDetail.getProductName()));
|
orderDetail.setProductName("【赠】%s".formatted(orderDetail.getProductName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("客看单 第{}次下单--------------------------------------------", orderInfo.getPlaceNum());
|
// log.info("客看单 第{}次下单--------------------------------------------", orderInfo.getPlaceNum());
|
||||||
if (orderInfo.getPlaceNum() != null && orderInfo.getPlaceNum() != 1) {
|
if (orderInfo.getPlaceNum() != null && orderInfo.getPlaceNum() != 1) {
|
||||||
orderInfo.setSeatAmount(BigDecimal.ZERO);
|
orderInfo.setSeatAmount(BigDecimal.ZERO);
|
||||||
printInfoDTO.setSeatAmount("");
|
orderPrintDTO.setSeatAmount("");
|
||||||
}
|
}
|
||||||
printInfoDTO.setOriginalAmount((originalAmount.add(orderInfo.getSeatAmount()).add(orderInfo.getPackFee()))
|
orderPrintDTO.setOriginalAmount((originalAmount.add(orderInfo.getSeatAmount()).add(orderInfo.getPackFee()))
|
||||||
.setScale(2, RoundingMode.HALF_UP).toPlainString());
|
.setScale(2, RoundingMode.HALF_UP).toPlainString());
|
||||||
printInfoDTO.setPayAmount((originalAmount.add(orderInfo.getSeatAmount()).add(orderInfo.getPackFee())
|
orderPrintDTO.setPayAmount((originalAmount.add(orderInfo.getSeatAmount()).add(orderInfo.getPackFee())
|
||||||
.subtract(orderInfo.getDiscountAllAmount())).setScale(2, RoundingMode.HALF_UP).toPlainString());
|
.subtract(orderInfo.getDiscountAllAmount())).setScale(2, RoundingMode.HALF_UP).toPlainString());
|
||||||
|
|
||||||
if (orderInfo.getPackFee().compareTo(BigDecimal.ZERO) > 0) {
|
if (orderInfo.getPackFee().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
printInfoDTO.setPackFee(orderInfo.getPackFee().toPlainString());
|
orderPrintDTO.setPackFee(orderInfo.getPackFee().toPlainString());
|
||||||
}
|
}
|
||||||
return printInfoDTO;
|
return orderPrintDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrintInfoDTO preOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
/**
|
||||||
PrintInfoDTO printInfoDTO = getPrintInfoDTO(orderInfo, "预结算单");
|
* 打印预结算单
|
||||||
|
*/
|
||||||
|
protected OrderPrintDTO preOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
||||||
|
OrderPrintDTO orderPrintDTO = getPrintInfoDTO(orderInfo, "预结算单");
|
||||||
|
|
||||||
BigDecimal originalAmount = BigDecimal.ZERO;
|
BigDecimal originalAmount = BigDecimal.ZERO;
|
||||||
for (OrderDetail orderDetail : detailList) {
|
for (OrderDetail orderDetail : detailList) {
|
||||||
if (orderDetail.getIsGift() == 1) {
|
if (orderDetail.getIsGift() == 1) {
|
||||||
continue;
|
|
||||||
} else if (orderDetail.getDiscountSaleAmount().compareTo(BigDecimal.ZERO) > 0) {
|
} else if (orderDetail.getDiscountSaleAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
originalAmount = originalAmount.add((orderDetail.getNum().subtract(orderDetail.getReturnNum()).subtract(orderDetail.getRefundNum())).multiply(orderDetail.getUnitPrice()));
|
originalAmount = originalAmount.add((orderDetail.getNum().subtract(orderDetail.getReturnNum()).subtract(orderDetail.getRefundNum())).multiply(orderDetail.getUnitPrice()));
|
||||||
} else {
|
} else {
|
||||||
originalAmount = originalAmount.add((orderDetail.getNum().subtract(orderDetail.getReturnNum()).subtract(orderDetail.getRefundNum())).multiply(orderDetail.getPrice()));
|
originalAmount = originalAmount.add((orderDetail.getNum().subtract(orderDetail.getReturnNum()).subtract(orderDetail.getRefundNum())).multiply(orderDetail.getPrice()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printInfoDTO.setOriginalAmount((originalAmount.add(orderInfo.getSeatAmount()).add(orderInfo.getPackFee()))
|
orderPrintDTO.setOriginalAmount((originalAmount.add(orderInfo.getSeatAmount()).add(orderInfo.getPackFee()))
|
||||||
.setScale(2, RoundingMode.HALF_UP).toPlainString());
|
.setScale(2, RoundingMode.HALF_UP).toPlainString());
|
||||||
printInfoDTO.setPayAmount(originalAmount.add(orderInfo.getSeatAmount()).add(orderInfo.getPackFee())
|
orderPrintDTO.setPayAmount(originalAmount.add(orderInfo.getSeatAmount()).add(orderInfo.getPackFee())
|
||||||
.subtract(orderInfo.getDiscountAllAmount()).setScale(2, RoundingMode.HALF_UP).toPlainString());
|
.subtract(orderInfo.getDiscountAllAmount()).setScale(2, RoundingMode.HALF_UP).toPlainString());
|
||||||
if (orderInfo.getPackFee().compareTo(BigDecimal.ZERO) > 0) {
|
if (orderInfo.getPackFee().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
printInfoDTO.setPackFee(orderInfo.getPackFee().toPlainString());
|
orderPrintDTO.setPackFee(orderInfo.getPackFee().toPlainString());
|
||||||
}
|
}
|
||||||
return printInfoDTO;
|
return orderPrintDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrintInfoDTO orderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
/**
|
||||||
PrintInfoDTO printInfoDTO = getPrintInfoDTO(orderInfo, "结算单");
|
* 打印结算单
|
||||||
|
*/
|
||||||
|
protected OrderPrintDTO orderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
||||||
|
OrderPrintDTO orderPrintDTO = getPrintInfoDTO(orderInfo, "结算单");
|
||||||
|
|
||||||
BigDecimal originalAmount = orderInfo.getOriginAmount() == null ? BigDecimal.ZERO : orderInfo.getOriginAmount();
|
BigDecimal originalAmount = orderInfo.getOriginAmount() == null ? BigDecimal.ZERO : orderInfo.getOriginAmount();
|
||||||
printInfoDTO.setOriginalAmount(originalAmount.toPlainString());
|
orderPrintDTO.setOriginalAmount(originalAmount.toPlainString());
|
||||||
printInfoDTO.setPayAmount(originalAmount.subtract(orderInfo.getDiscountAllAmount()).setScale(2, RoundingMode.HALF_UP).toPlainString());
|
orderPrintDTO.setPayAmount(originalAmount.subtract(orderInfo.getDiscountAllAmount()).setScale(2, RoundingMode.HALF_UP).toPlainString());
|
||||||
if (orderInfo.getPackFee().compareTo(BigDecimal.ZERO) > 0) {
|
if (orderInfo.getPackFee().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
printInfoDTO.setPackFee(orderInfo.getPackFee().toPlainString());
|
orderPrintDTO.setPackFee(orderInfo.getPackFee().toPlainString());
|
||||||
}
|
}
|
||||||
return printInfoDTO;
|
return orderPrintDTO;
|
||||||
}
|
|
||||||
|
|
||||||
private PrintInfoDTO getPrintInfoDTO(OrderInfo orderInfo, String printTitle) {
|
|
||||||
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
|
|
||||||
long count = orderInfoService.count(new QueryWrapper().eq(OrderInfo::getTradeDay, orderInfo.getTradeDay())
|
|
||||||
.eq(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode())
|
|
||||||
.eq(OrderInfo::getShopId, orderInfo.getShopId())
|
|
||||||
.le(OrderInfo::getCreateTime, orderInfo.getCreateTime()));
|
|
||||||
|
|
||||||
PrintInfoDTO printInfoDTO = new PrintInfoDTO().setShopName(shopInfo.getShopName())
|
|
||||||
.setPrintTitle(printTitle)
|
|
||||||
.setPickupNum(getTableAreaAndName(orderInfo.getShopId(), orderInfo.getTableCode(), orderInfo.getTableName()))
|
|
||||||
.setOrderNo(orderInfo.getOrderNo()).setPayAmount(orderInfo.getPayAmount().toPlainString()).setReturn(false)
|
|
||||||
.setOutNumber(orderInfo.getTakeCode()).setCount(count).setRemark(orderInfo.getRemark())
|
|
||||||
// 使用累计的总优惠金额,null 表示没有优惠
|
|
||||||
.setDiscountAmount(orderInfo.getDiscountAllAmount() != null
|
|
||||||
? orderInfo.getDiscountAllAmount().toPlainString()
|
|
||||||
: "0.00");
|
|
||||||
|
|
||||||
printInfoDTO.setSeatNum(orderInfo.getSeatNum() == null ? "" : orderInfo.getSeatNum().toString());
|
|
||||||
if (orderInfo.getSeatNum() != null && orderInfo.getSeatAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
printInfoDTO.setSeatAmount(orderInfo.getSeatAmount().divide(BigDecimal.valueOf(orderInfo.getSeatNum()), 2, RoundingMode.DOWN).toPlainString());
|
|
||||||
}
|
|
||||||
if (StrUtil.isNotBlank(orderInfo.getDineMode())) {
|
|
||||||
switch (orderInfo.getDineMode()) {
|
|
||||||
case "dine-in" -> printInfoDTO.setPrintType("收银-堂食");
|
|
||||||
case "take-out" -> printInfoDTO.setPrintType("收银-外带");
|
|
||||||
case "take-away" -> printInfoDTO.setPrintType("收银-外卖");
|
|
||||||
}
|
|
||||||
if (!"dine-in".equals(orderInfo.getDineMode())) {
|
|
||||||
orderInfo.setSeatAmount(BigDecimal.ZERO);
|
|
||||||
printInfoDTO.setSeatAmount("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (orderInfo.getStaffId() != null) {
|
|
||||||
ShopStaff detail = shopStaffService.getOne(new QueryWrapper().eq(ShopStaff::getId, orderInfo.getStaffId()).eq(ShopStaff::getShopId, orderInfo.getShopId()));
|
|
||||||
if (detail != null) {
|
|
||||||
printInfoDTO.setOperator(detail.getName());
|
|
||||||
} else {
|
|
||||||
printInfoDTO.setOperator("");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
printInfoDTO.setOperator("");
|
|
||||||
}
|
|
||||||
if ("结算单".equals(printTitle)) {
|
|
||||||
if (StrUtil.isNotBlank(orderInfo.getPayType())) {
|
|
||||||
switch (orderInfo.getPayType()) {
|
|
||||||
case "main_scan" -> printInfoDTO.setPayType("二维码收款");
|
|
||||||
case "back_scan" -> printInfoDTO.setPayType("扫码收款");
|
|
||||||
case "wechat_mini" -> printInfoDTO.setPayType("微信小程序");
|
|
||||||
case "alipay_mini" -> printInfoDTO.setPayType("支付宝小程序");
|
|
||||||
case "vip_pay" -> printInfoDTO.setPayType("余额支付");
|
|
||||||
case "cash_pay" -> printInfoDTO.setPayType("现金支付");
|
|
||||||
case "credit_pay" -> printInfoDTO.setPayType("挂账支付");
|
|
||||||
case "free_pay" -> printInfoDTO.setPayType("霸王餐支付");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printInfoDTO.setTradeDate(DateUtil.format(orderInfo.getPaidTime(), "yyyy/MM/dd HH:mm:ss"));
|
|
||||||
}
|
|
||||||
return printInfoDTO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜品打印
|
* 后厨 总单打印
|
||||||
*/
|
*/
|
||||||
protected abstract void normalDishesPrint(String operator, OrderInfo orderInfo, OrderDetail orderDetail, PrintMachine machine);
|
protected OrderPrintDTO allKitchenPrint(OrderInfo orderInfo, List<OrderDetail> orderDetails, PrintMachine machine) {
|
||||||
|
return getPrintInfoDTO(orderInfo, "后厨总单");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜品 退菜打印
|
* 后厨 菜品打印
|
||||||
*/
|
*/
|
||||||
protected abstract void returnDishesPrint(String operator, OrderInfo orderInfo, OrderDetail orderDetail, PrintMachine machine);
|
protected abstract void onlyKitchenPrint(OrderInfo orderInfo, OrderDetail orderDetail, PrintMachine machine);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后厨 退菜整单打印
|
||||||
|
*/
|
||||||
|
protected OrderPrintDTO returnKitchenPrint(String operator, OrderInfo orderInfo, List<OrderDetail> orderDetail, PrintMachine machine) {
|
||||||
|
OrderPrintDTO printInfo = getPrintInfoDTO(orderInfo, "后厨退菜单");
|
||||||
|
printInfo.setOperator(operator);
|
||||||
|
return printInfo;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 叫号打印
|
* 叫号打印
|
||||||
@@ -824,9 +363,91 @@ public abstract class PrinterHandler {
|
|||||||
protected abstract void callNumPrint(PrintMachine machine, String callNum, String shopName, String tableName, String tableNote, String preNum,
|
protected abstract void callNumPrint(PrintMachine machine, String callNum, String shopName, String tableName, String tableNote, String preNum,
|
||||||
String codeUrl, LocalDateTime takeTime, String shopNote);
|
String codeUrl, LocalDateTime takeTime, String shopNote);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出入库打印单 √
|
||||||
|
*/
|
||||||
|
protected abstract void stockPrint(PrintMachine machine, String shopName, StockPrintDTO record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经营日报打印
|
||||||
|
*/
|
||||||
|
protected abstract void dayReportPrint(PrintMachine machine, String shopName, DayReportPrintDTO record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品报表打印
|
||||||
|
*/
|
||||||
|
protected abstract void productReportPrint(PrintMachine machine, String shopName, ProductReportPrintDTO record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 储值单打印 √
|
||||||
|
*/
|
||||||
|
protected abstract void rechargePrint(PrintMachine machine, String shopName, RechargePrintDTO record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存盘点打印 √
|
||||||
|
*/
|
||||||
|
protected abstract void stockCheckPrint(PrintMachine machine, String shopName, StockCheckPrintDTO record);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 交班打印
|
* 交班打印
|
||||||
*/
|
*/
|
||||||
protected abstract void handoverPrint(PrintMachine machine, HandoverRecordDTO record);
|
protected abstract void handoverPrint(PrintMachine machine, String shopName, HandoverRecordDTO record);
|
||||||
|
|
||||||
|
|
||||||
|
private OrderPrintDTO getPrintInfoDTO(OrderInfo orderInfo, String printTitle) {
|
||||||
|
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
|
||||||
|
OrderPrintDTO orderPrintDTO = new OrderPrintDTO().setShopName(shopInfo.getShopName())
|
||||||
|
.setPrintTitle(printTitle)
|
||||||
|
.setPickupNum(orderInfo.getTableName())
|
||||||
|
.setOrderNo(orderInfo.getOrderNo()).setPayAmount(orderInfo.getPayAmount().toPlainString()).setReturn(false)
|
||||||
|
.setOutNumber(orderInfo.getTakeCode())
|
||||||
|
.setRemark(orderInfo.getRemark())
|
||||||
|
// 使用累计的总优惠金额,null 表示没有优惠
|
||||||
|
.setDiscountAmount(orderInfo.getDiscountAllAmount() != null
|
||||||
|
? orderInfo.getDiscountAllAmount().toPlainString()
|
||||||
|
: "0.00");
|
||||||
|
|
||||||
|
orderPrintDTO.setSeatNum(orderInfo.getSeatNum() == null ? "" : orderInfo.getSeatNum().toString());
|
||||||
|
if (orderInfo.getSeatNum() != null && orderInfo.getSeatAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
orderPrintDTO.setSeatAmount(orderInfo.getSeatAmount().divide(BigDecimal.valueOf(orderInfo.getSeatNum()), 2, RoundingMode.DOWN).toPlainString());
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(orderInfo.getDineMode())) {
|
||||||
|
switch (orderInfo.getDineMode()) {
|
||||||
|
case "dine-in" -> orderPrintDTO.setPrintType("收银-堂食");
|
||||||
|
case "take-out" -> orderPrintDTO.setPrintType("收银-外带");
|
||||||
|
case "take-away" -> orderPrintDTO.setPrintType("收银-外卖");
|
||||||
|
}
|
||||||
|
if (!"dine-in".equals(orderInfo.getDineMode())) {
|
||||||
|
orderInfo.setSeatAmount(BigDecimal.ZERO);
|
||||||
|
orderPrintDTO.setSeatAmount("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (orderInfo.getStaffId() != null) {
|
||||||
|
ShopStaff detail = shopStaffService.getOne(new QueryWrapper().eq(ShopStaff::getId, orderInfo.getStaffId()).eq(ShopStaff::getShopId, orderInfo.getShopId()));
|
||||||
|
if (detail != null) {
|
||||||
|
orderPrintDTO.setOperator(detail.getName());
|
||||||
|
} else {
|
||||||
|
orderPrintDTO.setOperator("");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
orderPrintDTO.setOperator("");
|
||||||
|
}
|
||||||
|
if ("结算单".equals(printTitle)) {
|
||||||
|
if (StrUtil.isNotBlank(orderInfo.getPayType())) {
|
||||||
|
switch (orderInfo.getPayType()) {
|
||||||
|
case "main_scan" -> orderPrintDTO.setPayType("二维码收款");
|
||||||
|
case "back_scan" -> orderPrintDTO.setPayType("扫码收款");
|
||||||
|
case "wechat_mini" -> orderPrintDTO.setPayType("微信小程序");
|
||||||
|
case "alipay_mini" -> orderPrintDTO.setPayType("支付宝小程序");
|
||||||
|
case "vip_pay" -> orderPrintDTO.setPayType("余额支付");
|
||||||
|
case "cash_pay" -> orderPrintDTO.setPayType("现金支付");
|
||||||
|
case "credit_pay" -> orderPrintDTO.setPayType("挂账支付");
|
||||||
|
case "free_pay" -> orderPrintDTO.setPayType("霸王餐支付");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
orderPrintDTO.setTradeDate(DateUtil.format(orderInfo.getPaidTime(), "yyyy/MM/dd HH:mm:ss"));
|
||||||
|
}
|
||||||
|
return orderPrintDTO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,12 @@
|
|||||||
package com.czg.service.order.print;
|
package com.czg.service.order.print;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.hutool.crypto.SecureUtil;
|
import cn.hutool.crypto.SecureUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.czg.account.dto.HandoverRecordDTO;
|
import com.czg.account.dto.HandoverRecordDTO;
|
||||||
import com.czg.account.entity.PrintMachine;
|
import com.czg.account.entity.PrintMachine;
|
||||||
import com.czg.account.entity.ShopInfo;
|
|
||||||
import com.czg.order.entity.OrderDetail;
|
import com.czg.order.entity.OrderDetail;
|
||||||
import com.czg.order.entity.OrderInfo;
|
import com.czg.order.entity.OrderInfo;
|
||||||
import com.czg.service.order.enums.OrderStatusEnums;
|
import com.czg.print.*;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.HttpEntity;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
@@ -20,8 +15,6 @@ import org.springframework.stereotype.Component;
|
|||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -48,7 +41,7 @@ public class YxyPrinter extends PrinterHandler implements PrinterImpl {
|
|||||||
super("云想印");
|
super("云想印");
|
||||||
}
|
}
|
||||||
|
|
||||||
private PrintSignLabel printSignLabel = new PrintSignLabel()
|
private final PrintSignLabel printSignLabel = new PrintSignLabel()
|
||||||
.setBr("<BR>")
|
.setBr("<BR>")
|
||||||
.setCut("<PCUT>")
|
.setCut("<PCUT>")
|
||||||
.setOut("OUT")
|
.setOut("OUT")
|
||||||
@@ -62,12 +55,162 @@ public class YxyPrinter extends PrinterHandler implements PrinterImpl {
|
|||||||
.setBr("<BR>")
|
.setBr("<BR>")
|
||||||
.setBold(new String[]{"<B>", "</B>"});
|
.setBold(new String[]{"<B>", "</B>"});
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onlyKitchenPrint(OrderInfo orderInfo, OrderDetail orderDetail, PrintMachine machine) {
|
||||||
|
String buildDishPrintData = buildOnlyKitchenPrintData(getPickupNum(orderInfo), orderDetail);
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
if (1 == machine.getVolumeSwitch()) {
|
||||||
|
voiceJson = "{\"bizType\":\"2\",\"content\":\"新单来了,请注意查看\"}";
|
||||||
|
}
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), buildDishPrintData, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(orderInfo.getId(), machine, "后厨商品单", buildDishPrintData, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderPrintDTO allKitchenPrint(OrderInfo orderInfo, List<OrderDetail> orderDetails, PrintMachine machine) {
|
||||||
|
OrderPrintDTO orderPrintDTO = super.allKitchenPrint(orderInfo, orderDetails, machine);
|
||||||
|
String buildDishPrintData = buildAllKitchenPrintData(orderPrintDTO, orderDetails);
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
if (1 == machine.getVolumeSwitch()) {
|
||||||
|
voiceJson = "{\"bizType\":\"2\",\"content\":\"有客人退菜了,请注意查看\"}";
|
||||||
|
}
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), buildDishPrintData, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(orderInfo.getId(), machine, "后厨总单", buildDishPrintData, resp);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderPrintDTO returnKitchenPrint(String operator, OrderInfo orderInfo, List<OrderDetail> orderDetail, PrintMachine machine) {
|
||||||
|
OrderPrintDTO orderPrintDTO = super.returnKitchenPrint(operator, orderInfo, orderDetail, machine);
|
||||||
|
String buildDishPrintData = buildAllKitchenPrintData(orderPrintDTO, orderDetail);
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
if (1 == machine.getVolumeSwitch()) {
|
||||||
|
voiceJson = "{\"bizType\":\"2\",\"content\":\"有客人退菜了,请注意查看\"}";
|
||||||
|
}
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), buildDishPrintData, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(orderInfo.getId(), machine, "后厨退菜", buildDishPrintData, resp);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderPrintDTO returnOrderPrint(String printTitle, String operator, String refundAmount, String refundReason, String refundType,
|
||||||
|
OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
||||||
|
OrderPrintDTO orderPrintDTO = super.returnOrderPrint(printTitle, operator, refundAmount, refundReason, refundType, orderInfo, machine, detailList);
|
||||||
|
String data = buildRefundOrderPrintData(orderPrintDTO, detailList);
|
||||||
|
sendOrderPrint(data, orderInfo.getId(), machine, "退款单");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderPrintDTO guestOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
||||||
|
OrderPrintDTO orderPrintDTO = super.guestOrderPrint(orderInfo, machine, detailList);
|
||||||
|
String data = buildGuestOrderPrintData(orderPrintDTO, detailList);
|
||||||
|
sendOrderPrint(data, orderInfo.getId(), machine, "客看单");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderPrintDTO preOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
||||||
|
OrderPrintDTO orderPrintDTO = super.preOrderPrint(orderInfo, machine, detailList);
|
||||||
|
String data = buildOrderPrintData(orderPrintDTO, detailList);
|
||||||
|
sendOrderPrint(data, orderInfo.getId(), machine, "预结算单");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderPrintDTO orderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
||||||
|
OrderPrintDTO orderPrintDTO = super.orderPrint(orderInfo, machine, detailList);
|
||||||
|
String data = buildOrderPrintData(orderPrintDTO, detailList);
|
||||||
|
sendOrderPrint(data, orderInfo.getId(), machine, "结算单");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 叫号单打印
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void callNumPrint(PrintMachine machine, String callNum, String shopName, String tableName, String tableNote, String preNum, String codeUrl, LocalDateTime takeTime, String shopNote) {
|
||||||
|
String resp = buildCallTicketData(shopName, tableName, callNum, preNum, codeUrl, shopNote, takeTime);
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
if (1 == machine.getVolumeSwitch()) {
|
||||||
|
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一条新的排号记录\"}";
|
||||||
|
}
|
||||||
|
sendPrintRequest(machine.getAddress(), resp, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void stockPrint(PrintMachine machine, String shopName, StockPrintDTO record) {
|
||||||
|
record.setShopName(shopName);
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
String data = buildStockData(record);
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(machine, "入库单", data, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dayReportPrint(PrintMachine machine, String shopName, DayReportPrintDTO record) {
|
||||||
|
record.setShopName(shopName);
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
String data = buildDayReportData(record);
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(machine, "经营日报单", data, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void productReportPrint(PrintMachine machine, String shopName, ProductReportPrintDTO record) {
|
||||||
|
record.setShopName(shopName);
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
String data = buildProductReportData(record);
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(machine, "商品报表单", data, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void rechargePrint(PrintMachine machine, String shopName, RechargePrintDTO record) {
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
record.setShopName(shopName);
|
||||||
|
String data = buildRechargeData(record);
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(machine, "储值单", data, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void stockCheckPrint(PrintMachine machine, String shopName, StockCheckPrintDTO record) {
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
record.setShopName(shopName);
|
||||||
|
String data = buildStockCheckData(record);
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(machine, "盘点单", data, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交班单打印
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void handoverPrint(PrintMachine machine, String shopName, HandoverRecordDTO record) {
|
||||||
|
String string = buildHandoverData(record);
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
sendPrintRequest(machine.getAddress(), string, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void sendOrderPrint(String data, Long orderId, PrintMachine machine, String bizType) {
|
||||||
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||||
|
if (1 == machine.getVolumeSwitch()) {
|
||||||
|
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||||
|
}
|
||||||
|
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, machine.getPrintNum() == null ? "1" : machine.getPrintNum().toString());
|
||||||
|
printMachineLogService.save(orderId, machine, bizType, data, resp);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PrintSignLabel getSignLabelInfo() {
|
public PrintSignLabel getSignLabelInfo() {
|
||||||
return printSignLabel;
|
return printSignLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String sendPrintRequest(String address, String metaPrintData, String voiceData, String printNum) {
|
public String sendPrintRequest(String address, String metaPrintData, String voiceData, String printNum) {
|
||||||
log.info("开始请求云享印,请求数据:{}, {}", voiceData, metaPrintData);
|
log.info("开始请求云享印,请求数据:{}, {}", voiceData, metaPrintData);
|
||||||
@@ -104,81 +247,6 @@ public class YxyPrinter extends PrinterHandler implements PrinterImpl {
|
|||||||
return httpResponse;
|
return httpResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void normalDishesPrint(String operator, OrderInfo orderInfo, OrderDetail orderDetail, PrintMachine machine) {
|
|
||||||
String buildDishPrintData = buildDishPrintData(false, getPickupNum(orderInfo), DateUtil.format(orderDetail.getCreateTime(), "yyyy-MM-dd HH:mm:ss"), orderDetail.getProductName(), orderDetail.getSkuName(),
|
|
||||||
orderDetail.getNum(), orderDetail.getRemark(), orderDetail.getProGroupInfo(), orderDetail.getId(), orderDetail.isUrgent());
|
|
||||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
|
||||||
if (1 == machine.getVolumeSwitch()) {
|
|
||||||
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
|
||||||
}
|
|
||||||
String resp = sendPrintRequest(machine.getAddress(), buildDishPrintData, voiceJson, "1");
|
|
||||||
printMachineLogService.save(orderInfo.getId(), machine, "新订单", buildDishPrintData, resp);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void returnDishesPrint(String operator, OrderInfo orderInfo, OrderDetail orderDetail, PrintMachine machine) {
|
|
||||||
String buildDishPrintData = buildDishPrintData(true, getPickupNum(orderInfo), DateUtil.format(orderDetail.getCreateTime(), "yyyy-MM-dd HH:mm:ss"), orderDetail.getProductName(), orderDetail.getSkuName(),
|
|
||||||
orderDetail.getReturnNum(), orderDetail.getRemark(), orderDetail.getProGroupInfo(), orderDetail.getId(), orderDetail.isUrgent());
|
|
||||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
|
||||||
String resp = sendPrintRequest(machine.getAddress(), buildDishPrintData, voiceJson, "1");
|
|
||||||
printMachineLogService.save(orderInfo.getId(), machine, "退款单", buildDishPrintData, resp);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PrintInfoDTO returnOrderPrint(String printTitle, String operator, String refundAmount, String refundReason, String refundType,
|
|
||||||
OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
|
||||||
PrintInfoDTO printInfoDTO = super.returnOrderPrint(printTitle, operator, refundAmount, refundReason, refundType, orderInfo, machine, detailList);
|
|
||||||
String data = buildRefundOrderPrintData(printInfoDTO, detailList);
|
|
||||||
sendOrderPrint(data, orderInfo.getId(), machine, "退款单");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PrintInfoDTO guestOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
|
||||||
PrintInfoDTO printInfoDTO = super.guestOrderPrint(orderInfo, machine, detailList);
|
|
||||||
String data = buildGuestOrderPrintData(printInfoDTO, detailList);
|
|
||||||
sendOrderPrint(data, orderInfo.getId(), machine, "客看单");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PrintInfoDTO preOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
|
||||||
PrintInfoDTO printInfoDTO = super.preOrderPrint(orderInfo, machine, detailList);
|
|
||||||
String data = buildOrderPrintData(printInfoDTO, detailList);
|
|
||||||
sendOrderPrint(data, orderInfo.getId(), machine, "预结算单");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PrintInfoDTO orderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
|
|
||||||
PrintInfoDTO printInfoDTO = super.orderPrint(orderInfo, machine, detailList);
|
|
||||||
String data = buildOrderPrintData(printInfoDTO, detailList);
|
|
||||||
sendOrderPrint(data, orderInfo.getId(), machine, "结算单");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 叫号单打印
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void callNumPrint(PrintMachine machine, String callNum, String shopName, String tableName, String tableNote, String preNum, String codeUrl, LocalDateTime takeTime, String shopNote) {
|
|
||||||
String resp = buildCallTicketData(shopName, tableName, callNum, preNum, codeUrl, shopNote, takeTime);
|
|
||||||
sendPrintRequest(machine.getAddress(), resp, null, "1");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班单打印
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void handoverPrint(PrintMachine machine, HandoverRecordDTO record) {
|
|
||||||
String string = buildHandoverData(record);
|
|
||||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
|
||||||
sendPrintRequest(machine.getAddress(), string, voiceJson, "1");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取TOKEN值
|
* 获取TOKEN值
|
||||||
@@ -202,20 +270,6 @@ public class YxyPrinter extends PrinterHandler implements PrinterImpl {
|
|||||||
return SecureUtil.md5(token + APP_SECRET).toUpperCase();
|
return SecureUtil.md5(token + APP_SECRET).toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOrderPrint(String data, Long orderId, PrintMachine machine, String bizType) {
|
|
||||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
|
||||||
if (1 == machine.getVolumeSwitch()) {
|
|
||||||
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
|
||||||
}
|
|
||||||
String printerNum = "1";
|
|
||||||
if (StrUtil.isNotBlank(machine.getPrintQty())) {
|
|
||||||
printerNum = machine.getPrintQty().split("\\^")[1];
|
|
||||||
}
|
|
||||||
String resp = sendPrintRequest(machine.getAddress(), data, voiceJson, printerNum);
|
|
||||||
printMachineLogService.save(orderId, machine, bizType, data, resp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查打印状态
|
* 检查打印状态
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -44,13 +44,18 @@ import com.czg.order.service.*;
|
|||||||
import com.czg.order.vo.*;
|
import com.czg.order.vo.*;
|
||||||
import com.czg.pay.PayNotifyRespDTO;
|
import com.czg.pay.PayNotifyRespDTO;
|
||||||
import com.czg.product.entity.Product;
|
import com.czg.product.entity.Product;
|
||||||
|
import com.czg.product.entity.ShopProdCategory;
|
||||||
import com.czg.product.service.ProductRpcService;
|
import com.czg.product.service.ProductRpcService;
|
||||||
import com.czg.product.service.ProductService;
|
import com.czg.product.service.ProductService;
|
||||||
|
import com.czg.product.service.ShopProdCategoryService;
|
||||||
|
import com.czg.product.vo.ConsStockRecord;
|
||||||
|
import com.czg.product.vo.ProductStockVO;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.service.RedisService;
|
import com.czg.service.RedisService;
|
||||||
import com.czg.service.order.enums.OrderStatusEnums;
|
import com.czg.service.order.enums.OrderStatusEnums;
|
||||||
import com.czg.service.order.mapper.OrderInfoCustomMapper;
|
import com.czg.service.order.mapper.OrderInfoCustomMapper;
|
||||||
|
import com.czg.service.order.print.PrintConfig;
|
||||||
import com.czg.service.order.print.PrinterHandler;
|
import com.czg.service.order.print.PrinterHandler;
|
||||||
import com.czg.utils.*;
|
import com.czg.utils.*;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
@@ -60,7 +65,6 @@ import jakarta.validation.constraints.NotBlank;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.support.TransactionSynchronization;
|
import org.springframework.transaction.support.TransactionSynchronization;
|
||||||
@@ -90,9 +94,8 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
private OrderInfoCustomMapper orderInfoCustomMapper;
|
private OrderInfoCustomMapper orderInfoCustomMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private OrderInfoService orderInfoService;
|
private OrderInfoService orderInfoService;
|
||||||
@Lazy
|
|
||||||
@Resource
|
@Resource
|
||||||
private PrinterHandler printerHandler;
|
private PrintConfig printConfig;
|
||||||
@Resource
|
@Resource
|
||||||
private OrderDetailService orderDetailService;
|
private OrderDetailService orderDetailService;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -108,6 +111,8 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
@DubboReference
|
@DubboReference
|
||||||
private ProductService productService;
|
private ProductService productService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
|
private ShopProdCategoryService shopProdCategoryService;
|
||||||
|
@DubboReference
|
||||||
private ProductRpcService productRpcService;
|
private ProductRpcService productRpcService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private ShopInfoService shopInfoService;
|
private ShopInfoService shopInfoService;
|
||||||
@@ -326,11 +331,14 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
if ("after-pay".equals(orderInfo.getPayMode())) {
|
if ("after-pay".equals(orderInfo.getPayMode())) {
|
||||||
//
|
//
|
||||||
log.info("后付费生成订单{},第{}", orderInfo.getId(), orderInfo.getPlaceNum());
|
log.info("后付费生成订单{},第{}", orderInfo.getId(), orderInfo.getPlaceNum());
|
||||||
printerHandler.orderHandler(orderInfo.getId().toString(), PrinterHandler.PrintTypeEnum.GUEST_ORDER, orderInfo.getPlaceNum());
|
//客看单
|
||||||
//发送打票信息 后付费推送多次 需要处理
|
printConfig.orderHandler(orderInfo.getId().toString(), PrinterHandler.PrintTypeEnum.GUEST_ORDER, orderInfo.getPlaceNum());
|
||||||
//orderId_0_0 订单ID_先付后付(1先付0后付)_订单状态 0未完成 1完成
|
//orderId_0_0 订单ID_先付后付(1先付0后付)_订单状态 0未完成 1完成_第几次下单
|
||||||
//orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_0"
|
//orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_0"
|
||||||
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId() + "_0_0", false, "后付费打印");
|
//后付费 菜品单
|
||||||
|
rabbitPublisher.sendKitchenOrderPrintMsg(orderInfo.getId() + "_0_0", false, "后付费打印");
|
||||||
|
// 消息通知 本地打印机执行
|
||||||
|
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId() + "_0_0_" + orderInfo.getPlaceNum(), true, "后付费打印");
|
||||||
} else {
|
} else {
|
||||||
redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId(), "", 60 * 15);
|
redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId(), "", 60 * 15);
|
||||||
}
|
}
|
||||||
@@ -1038,15 +1046,13 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
*/
|
*/
|
||||||
private void processOrderDetails(List<OrderDetail> orderDetails, LimitRateDTO limitRate, OrderInfoAddDTO param) throws CzgException {
|
private void processOrderDetails(List<OrderDetail> orderDetails, LimitRateDTO limitRate, OrderInfoAddDTO param) throws CzgException {
|
||||||
BigDecimal packFee = BigDecimal.ZERO;
|
BigDecimal packFee = BigDecimal.ZERO;
|
||||||
|
Map<Long, BigDecimal> productNumMap = new HashMap<>();
|
||||||
for (OrderDetail detail : orderDetails) {
|
for (OrderDetail detail : orderDetails) {
|
||||||
if (!detail.getIsTemporary().equals(1) && detail.getProductId() > 0) {
|
if (!detail.getIsTemporary().equals(1) && detail.getProductId() > 0 && 1 == detail.getIsAutoSoldStock()) {
|
||||||
Product product = productService.getOne(QueryWrapper.create()
|
if (productNumMap.containsKey(detail.getProductId())) {
|
||||||
.eq(Product::getId, detail.getProductId())
|
productNumMap.put(detail.getProductId(), productNumMap.get(detail.getProductId()).add(detail.getNum().subtract(detail.getReturnNum())));
|
||||||
.eq(Product::getShopId, detail.getShopId())
|
} else {
|
||||||
.eq(Product::getIsDel, 0)
|
productNumMap.put(detail.getProductId(), detail.getNum().subtract(detail.getReturnNum()));
|
||||||
.eq(Product::getIsStock, 1));
|
|
||||||
if (product != null && detail.getNum().compareTo(new BigDecimal(product.getStockNumber())) > 0) {
|
|
||||||
throw new CzgException("下单失败" + product.getName() + "库存不足");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (detail.getDiscountSaleAmount() != null && detail.getDiscountSaleAmount().compareTo(BigDecimal.ZERO) > 0) {
|
if (detail.getDiscountSaleAmount() != null && detail.getDiscountSaleAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
@@ -1065,9 +1071,29 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
detail.setPayAmount(detail.getNum().multiply(detail.getUnitPrice()));
|
detail.setPayAmount(detail.getNum().multiply(detail.getUnitPrice()));
|
||||||
packFee = packFee.add(detail.getPackAmount().multiply(detail.getPackNumber()));
|
packFee = packFee.add(detail.getPackAmount().multiply(detail.getPackNumber()));
|
||||||
}
|
}
|
||||||
|
if (CollUtil.isNotEmpty(productNumMap)) {
|
||||||
|
checkStock(param.getShopId(), productNumMap);
|
||||||
|
}
|
||||||
param.setPackFee(packFee);
|
param.setPackFee(packFee);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验库存数
|
||||||
|
*
|
||||||
|
* @param productNumMap 商品Id ,使用数量
|
||||||
|
*/
|
||||||
|
private void checkStock(Long shopId, Map<Long, BigDecimal> productNumMap) {
|
||||||
|
if (CollUtil.isEmpty(productNumMap)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<ConsStockRecord> consNumList = orderInfoCustomMapper.getConsByProductAndNum(shopId, productNumMap);
|
||||||
|
for (ConsStockRecord consStockRecord : consNumList) {
|
||||||
|
if (consStockRecord.getStockNumber().compareTo(consStockRecord.getCurrentStockNumber()) > 0) {
|
||||||
|
throw new CzgException("耗材:" + consStockRecord.getConName() + "库存不足,当前库存:" + consStockRecord.getCurrentStockNumber());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void payCallBackOrder(@NotBlank String orderNo, @NotNull PayNotifyRespDTO notifyRespDTO, String channel, int retryCount) {
|
public void payCallBackOrder(@NotBlank String orderNo, @NotNull PayNotifyRespDTO notifyRespDTO, String channel, int retryCount) {
|
||||||
@@ -1154,7 +1180,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
}
|
}
|
||||||
shopRechargeService.recharge(payment.getShopId(), payment.getSourceId(), payment.getRelatedId(),
|
shopRechargeService.recharge(payment.getShopId(), payment.getSourceId(), payment.getRelatedId(),
|
||||||
BigDecimal.valueOf(notifyRespDTO.getAmount()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN),
|
BigDecimal.valueOf(notifyRespDTO.getAmount()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN),
|
||||||
payment.getId(), payment.getSourceType(), bizEnum, orderInfo == null);
|
payment.getId(), payment.getSourceType(), payment.getPayTime(), bizEnum, orderInfo == null, null);
|
||||||
}
|
}
|
||||||
} else if (PayTypeConstants.SourceType.MEMBER_PAY.equals(payment.getSourceType())) {
|
} else if (PayTypeConstants.SourceType.MEMBER_PAY.equals(payment.getSourceType())) {
|
||||||
//购买会员
|
//购买会员
|
||||||
@@ -1275,6 +1301,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
if (payType != PayEnums.BACK_SCAN) {
|
if (payType != PayEnums.BACK_SCAN) {
|
||||||
// 事务成功提交后执行消息发送
|
// 事务成功提交后执行消息发送
|
||||||
String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1";
|
String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1";
|
||||||
|
rabbitPublisher.sendKitchenOrderPrintMsg(printParam, isPrint, "事务环境打印");
|
||||||
rabbitPublisher.sendOrderPrintMsg(printParam, isPrint, "事务环境打印");
|
rabbitPublisher.sendOrderPrintMsg(printParam, isPrint, "事务环境打印");
|
||||||
}
|
}
|
||||||
// log.info("订单{}事务提交后,发送打印消息", orderId);
|
// log.info("订单{}事务提交后,发送打印消息", orderId);
|
||||||
@@ -1285,6 +1312,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
// 非事务环境下直接发送(兼容无事务场景)
|
// 非事务环境下直接发送(兼容无事务场景)
|
||||||
String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1";
|
String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1";
|
||||||
rabbitPublisher.sendOrderPrintMsg(printParam, isPrint, "非事务环境打印");
|
rabbitPublisher.sendOrderPrintMsg(printParam, isPrint, "非事务环境打印");
|
||||||
|
rabbitPublisher.sendKitchenOrderPrintMsg(printParam, isPrint, "非事务环境打印");
|
||||||
}
|
}
|
||||||
// log.info("非事务环境下,直接发送订单{}打印消息", orderId);
|
// log.info("非事务环境下,直接发送订单{}打印消息", orderId);
|
||||||
}
|
}
|
||||||
@@ -1448,7 +1476,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
}
|
}
|
||||||
if (table != null) {
|
if (table != null) {
|
||||||
orderInfo.setTableCode(table.getTableCode());
|
orderInfo.setTableCode(table.getTableCode());
|
||||||
orderInfo.setTableName(table.getName());
|
orderInfo.setTableName(shopTableService.getTableAreaAndName(shopInfo.getId(), table.getTableCode(), table.getName()));
|
||||||
}
|
}
|
||||||
// 餐位费
|
// 餐位费
|
||||||
if (shopInfo.getIsTableFee().equals(0)) {
|
if (shopInfo.getIsTableFee().equals(0)) {
|
||||||
@@ -1589,14 +1617,11 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (orderInfoPrintDTO.getType()) {
|
switch (orderInfoPrintDTO.getType()) {
|
||||||
case 0://菜品和结算单同时打印
|
|
||||||
printerHandler.orderHandler(orderInfo.getId().toString(), PrinterHandler.PrintTypeEnum.ONE_AND_ORDER, null);
|
|
||||||
break;
|
|
||||||
case 1://预结算单
|
case 1://预结算单
|
||||||
printerHandler.orderHandler(orderInfo.getId().toString(), PrinterHandler.PrintTypeEnum.PRE_ORDER, null);
|
printConfig.orderHandler(orderInfo.getId().toString(), PrinterHandler.PrintTypeEnum.PRE_ORDER, null);
|
||||||
break;
|
break;
|
||||||
case 2://结算单
|
case 2://结算单
|
||||||
printerHandler.orderHandler(orderInfo.getId().toString(), PrinterHandler.PrintTypeEnum.ORDER, null);
|
printConfig.orderHandler(orderInfo.getId().toString(), PrinterHandler.PrintTypeEnum.ORDER, null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -1693,17 +1718,13 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
List<OrderDetail> details = orderDetailService.list(QueryWrapper.create().eq(OrderDetail::getOrderId, orderId).eq(OrderDetail::getPlaceNum, placeNum));
|
List<OrderDetail> details = orderDetailService.list(QueryWrapper.create().eq(OrderDetail::getOrderId, orderId).eq(OrderDetail::getPlaceNum, placeNum));
|
||||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
List<ProductStockVO> listStock = new ArrayList<>();
|
||||||
for (OrderDetail detail : details) {
|
for (OrderDetail detail : details) {
|
||||||
Map<String, Object> data = new HashMap<>();
|
listStock.add(new ProductStockVO(detail.getProductId(), NumberUtil.sub(detail.getNum(), detail.getReturnNum())));
|
||||||
data.put("shopId", shopId);
|
|
||||||
data.put("productId", detail.getProductId());
|
|
||||||
data.put("num", NumberUtil.sub(detail.getNum(), detail.getReturnNum()));
|
|
||||||
dataList.add(data);
|
|
||||||
}
|
}
|
||||||
orderDetailService.remove(new QueryWrapper().eq(OrderDetail::getOrderId, orderId).eq(OrderDetail::getPlaceNum, placeNum));
|
orderDetailService.remove(new QueryWrapper().eq(OrderDetail::getOrderId, orderId).eq(OrderDetail::getPlaceNum, placeNum));
|
||||||
if (CollUtil.isNotEmpty(dataList)) {
|
if (CollUtil.isNotEmpty(listStock)) {
|
||||||
productRpcService.orderCancelRecoverStock(shopId, orderId, dataList);
|
productRpcService.orderCancelRecoverStock(shopId, orderId, listStock);
|
||||||
}
|
}
|
||||||
List<OrderDetail> list = orderDetailService.queryChain().eq(OrderDetail::getOrderId, orderId).eq(OrderDetail::getShopId, shopId).list();
|
List<OrderDetail> list = orderDetailService.queryChain().eq(OrderDetail::getOrderId, orderId).eq(OrderDetail::getShopId, shopId).list();
|
||||||
if (CollUtil.isEmpty(list)) {
|
if (CollUtil.isEmpty(list)) {
|
||||||
@@ -1829,4 +1850,48 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
rabbitPublisher.sendOrderDetailStatusMsg(shopId.toString(), "bc");
|
rabbitPublisher.sendOrderDetailStatusMsg(shopId.toString(), "bc");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退单库存问题
|
||||||
|
* 1退菜退库存 2仅退菜不退库存 3每次询问-退菜后弹窗提示1
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void refundStock(ShopInfo shopInfo, Long orderId, Map<Long, BigDecimal> products, boolean refundStock) {
|
||||||
|
List<Product> list = productService.list(new QueryWrapper().select(Product::getId, Product::getCategoryId, Product::getRefundMode)
|
||||||
|
.eq(Product::getShopId, shopInfo.getId())
|
||||||
|
.in(Product::getId, products.keySet()));
|
||||||
|
if (CollUtil.isEmpty(list)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<ProductStockVO> resultProduct = new ArrayList<>();
|
||||||
|
HashMap<Long, Integer> categoryMap = new HashMap<>();
|
||||||
|
for (Product product : list) {
|
||||||
|
Integer refundMode;
|
||||||
|
if (shopInfo.getRefundMode().equals(1)) {
|
||||||
|
//分类
|
||||||
|
if (!categoryMap.containsKey(product.getCategoryId())) {
|
||||||
|
refundMode = shopProdCategoryService.getOneAs(new QueryWrapper().select(ShopProdCategory::getRefundMode)
|
||||||
|
.eq(ShopProdCategory::getShopId, shopInfo.getId()).eq(ShopProdCategory::getId, product.getCategoryId()), Integer.class);
|
||||||
|
categoryMap.put(product.getCategoryId(), refundMode);
|
||||||
|
} else {
|
||||||
|
refundMode = categoryMap.get(product.getCategoryId());
|
||||||
|
}
|
||||||
|
} else if (shopInfo.getRefundMode().equals(2)) {
|
||||||
|
//单商品
|
||||||
|
refundMode = product.getRefundMode();
|
||||||
|
} else {
|
||||||
|
log.error("退菜模式错误 店铺{},退款模式{},商品Id{}分类Id{}", shopInfo.getShopName(), shopInfo.getRefundMode(), product.getId(), product.getCategoryId());
|
||||||
|
throw new CzgException("退菜模式错误");
|
||||||
|
}
|
||||||
|
if (refundMode.equals(1)) {
|
||||||
|
resultProduct.add(new ProductStockVO(product.getId(), products.get(product.getId())));
|
||||||
|
} else if (refundMode.equals(3) && refundStock) {
|
||||||
|
resultProduct.add(new ProductStockVO(product.getId(), products.get(product.getId())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(resultProduct)) {
|
||||||
|
rabbitPublisher.sendOrderRefundMsg(JSONObject.toJSONString(Map.of("orderId", orderId, "returnProList", resultProduct)));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.czg.service.order.service.impl;
|
package com.czg.service.order.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.czg.account.entity.HandoverRecord;
|
||||||
import com.czg.account.vo.HandoverCategoryListVo;
|
import com.czg.account.vo.HandoverCategoryListVo;
|
||||||
import com.czg.account.vo.HandoverProductListVo;
|
import com.czg.account.vo.HandoverProductListVo;
|
||||||
import com.czg.config.RabbitPublisher;
|
import com.czg.config.RabbitPublisher;
|
||||||
@@ -12,8 +12,9 @@ import com.czg.order.entity.OrderDetail;
|
|||||||
import com.czg.order.entity.OrderInfo;
|
import com.czg.order.entity.OrderInfo;
|
||||||
import com.czg.order.service.OrderInfoRpcService;
|
import com.czg.order.service.OrderInfoRpcService;
|
||||||
import com.czg.product.service.ProductRpcService;
|
import com.czg.product.service.ProductRpcService;
|
||||||
import com.czg.service.order.mapper.OrderDetailMapper;
|
import com.czg.product.vo.ProductStockVO;
|
||||||
import com.czg.service.market.mapper.OrderInfoMapper;
|
import com.czg.service.market.mapper.OrderInfoMapper;
|
||||||
|
import com.czg.service.order.mapper.OrderDetailMapper;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import io.seata.spring.annotation.GlobalTransactional;
|
import io.seata.spring.annotation.GlobalTransactional;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@@ -23,7 +24,8 @@ import org.apache.dubbo.config.annotation.DubboService;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单Rpc ServiceImpl
|
* 订单Rpc ServiceImpl
|
||||||
@@ -47,55 +49,6 @@ public class OrderInfoRpcServiceImpl implements OrderInfoRpcService {
|
|||||||
@Resource
|
@Resource
|
||||||
private RabbitPublisher rabbitPublisher;
|
private RabbitPublisher rabbitPublisher;
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getHandoverWechatAmount(Long shopId, String loginTime, String handoverTime) {
|
|
||||||
return orderInfoMapper.getHandoverWechatAmount(shopId, loginTime, handoverTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getHandoverAlipayAmount(Long shopId, String loginTime, String handoverTime) {
|
|
||||||
return orderInfoMapper.getHandoverAlipayAmount(shopId, loginTime, handoverTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getHandoverVipPayAmount(Long shopId, String loginTime, String handoverTime) {
|
|
||||||
return orderInfoMapper.getHandoverVipPayAmount(shopId, loginTime, handoverTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getHandoverVipChargeAmount(Long shopId, String loginTime, String handoverTime) {
|
|
||||||
return orderInfoMapper.getHandoverVipChargeAmount(shopId, loginTime, handoverTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getHandoverQuickPayAmount(Long shopId, String loginTime, String handoverTime) {
|
|
||||||
return orderInfoMapper.getHandoverQuickPayAmount(shopId, loginTime, handoverTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getHandoverCashAmount(Long shopId, String loginTime, String handoverTime) {
|
|
||||||
return orderInfoMapper.getHandoverCashAmount(shopId, loginTime, handoverTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getHandoverRefundAmount(Long shopId, String loginTime, String handoverTime) {
|
|
||||||
return orderInfoMapper.getHandoverRefundAmount(shopId, loginTime, handoverTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getHandoverCreditAmount(Long shopId, String loginTime, String handoverTime) {
|
|
||||||
return orderInfoMapper.getHandoverCreditAmount(shopId, loginTime, handoverTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getHandoverTotalAmount(Long shopId, String loginTime, String handoverTime) {
|
|
||||||
return orderInfoMapper.getHandoverTotalAmount(shopId, loginTime, handoverTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHandoverOrderNum(Long shopId, String loginTime, String handoverTime) {
|
|
||||||
return orderInfoMapper.getHandoverOrderNum(shopId, loginTime, handoverTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HandoverProductListVo> getHandoverDetailList(Long shopId, String loginTime, String handoverTime) {
|
public List<HandoverProductListVo> getHandoverDetailList(Long shopId, String loginTime, String handoverTime) {
|
||||||
@@ -107,6 +60,22 @@ public class OrderInfoRpcServiceImpl implements OrderInfoRpcService {
|
|||||||
return orderInfoMapper.getHandoverCategoryList(shopId, loginTime, handoverTime);
|
return orderInfoMapper.getHandoverCategoryList(shopId, loginTime, handoverTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandoverRecord getOnlinePayTypeDate(Long shopId, String loginTime, String handoverTime) {
|
||||||
|
return orderInfoMapper.getOnlinePayTypeDate(shopId, loginTime, handoverTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal countReturnDish(Long shopId, String loginTime, String handoverTime) {
|
||||||
|
return orderInfoMapper.countReturnDish(shopId, loginTime, handoverTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandoverRecord countShopUserFlow(Long shopId, String loginTime, String handoverTime) {
|
||||||
|
return orderInfoMapper.countShopUserFlow(shopId, loginTime, handoverTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@GlobalTransactional
|
@GlobalTransactional
|
||||||
public void paySuccessCallback(Long orderId) {
|
public void paySuccessCallback(Long orderId) {
|
||||||
@@ -127,16 +96,12 @@ public class OrderInfoRpcServiceImpl implements OrderInfoRpcService {
|
|||||||
}
|
}
|
||||||
Long shopId = orderInfo.getShopId();
|
Long shopId = orderInfo.getShopId();
|
||||||
// 封装扣减库存数据
|
// 封装扣减库存数据
|
||||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
List<ProductStockVO> dataList = new ArrayList<>();
|
||||||
for (OrderDetail orderDetail : detailList) {
|
for (OrderDetail orderDetail : detailList) {
|
||||||
Map<String, Object> data = new HashMap<>(16);
|
|
||||||
Long productId = orderDetail.getProductId();
|
Long productId = orderDetail.getProductId();
|
||||||
BigDecimal num = orderDetail.getNum();
|
BigDecimal num = orderDetail.getNum();
|
||||||
BigDecimal refundNum = orderDetail.getRefundNum();
|
BigDecimal refundNum = orderDetail.getRefundNum();
|
||||||
data.put("shopId", shopId);
|
dataList.add(new ProductStockVO(productId, NumberUtil.sub(num, refundNum)));
|
||||||
data.put("productId", productId);
|
|
||||||
data.put("num", NumberUtil.sub(num, refundNum));
|
|
||||||
dataList.add(data);
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// 调用商品服务扣减库存
|
// 调用商品服务扣减库存
|
||||||
@@ -162,22 +127,18 @@ public class OrderInfoRpcServiceImpl implements OrderInfoRpcService {
|
|||||||
if (CollUtil.isEmpty(detailList)) {
|
if (CollUtil.isEmpty(detailList)) {
|
||||||
throw new CzgException("该订单下不存在商品");
|
throw new CzgException("该订单下不存在商品");
|
||||||
}
|
}
|
||||||
Long shopId = orderInfo.getShopId();
|
|
||||||
// 封装扣减库存数据
|
// 封装扣减库存数据
|
||||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
List<ProductStockVO> dataList = new ArrayList<>();
|
||||||
for (OrderDetail orderDetail : detailList) {
|
for (OrderDetail orderDetail : detailList) {
|
||||||
Map<String, Object> data = new HashMap<>(16);
|
|
||||||
Long productId = orderDetail.getProductId();
|
Long productId = orderDetail.getProductId();
|
||||||
BigDecimal num = orderDetail.getNum();
|
BigDecimal num = orderDetail.getNum();
|
||||||
BigDecimal refundNum = orderDetail.getRefundNum();
|
BigDecimal refundNum = orderDetail.getRefundNum();
|
||||||
data.put("shopId", shopId);
|
BigDecimal returnNum = orderDetail.getReturnNum();
|
||||||
data.put("productId", productId);
|
dataList.add(new ProductStockVO(productId, NumberUtil.sub(num, refundNum, returnNum)));
|
||||||
data.put("num", NumberUtil.sub(num, refundNum));
|
|
||||||
dataList.add(data);
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// 调用商品服务扣减库存
|
// 调用商品服务扣减库存
|
||||||
productRpcService.orderCancelRecoverStock(shopId, orderId, dataList);
|
productRpcService.orderCancelRecoverStock(orderInfo.getShopId(), orderId, dataList);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("调用商品服务恢复库存", e);
|
log.error("调用商品服务恢复库存", e);
|
||||||
throw e;
|
throw e;
|
||||||
@@ -186,7 +147,6 @@ public class OrderInfoRpcServiceImpl implements OrderInfoRpcService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void orderRefundCallback(JSONObject data) {
|
public void orderRefundCallback(JSONObject data) {
|
||||||
log.info(">>>>>>>>>>>>>>>>>:入参:{}", data.toJSONString());
|
|
||||||
Long orderId = data.getLong("orderId");
|
Long orderId = data.getLong("orderId");
|
||||||
// 订单取消后商品库存恢复,耗材恢复,流水记录
|
// 订单取消后商品库存恢复,耗材恢复,流水记录
|
||||||
OrderInfo orderInfo = orderInfoMapper.selectOneById(orderId);
|
OrderInfo orderInfo = orderInfoMapper.selectOneById(orderId);
|
||||||
@@ -198,19 +158,7 @@ public class OrderInfoRpcServiceImpl implements OrderInfoRpcService {
|
|||||||
if (CollUtil.isEmpty(detailList)) {
|
if (CollUtil.isEmpty(detailList)) {
|
||||||
throw new CzgException("该订单下不存在商品");
|
throw new CzgException("该订单下不存在商品");
|
||||||
}
|
}
|
||||||
JSONObject obj = data.getJSONObject("returnProMap");
|
List<ProductStockVO> dataList = data.getList("returnProList", ProductStockVO.class);
|
||||||
Set<String> keys = obj.keySet();
|
|
||||||
// 封装扣减库存数据
|
|
||||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
|
||||||
for (String key : keys) {
|
|
||||||
Long productId = Convert.toLong(key);
|
|
||||||
BigDecimal num = obj.getBigDecimal(key);
|
|
||||||
Map<String, Object> row = new HashMap<>(3);
|
|
||||||
row.put("shopId", orderInfo.getShopId());
|
|
||||||
row.put("productId", productId);
|
|
||||||
row.put("num", num);
|
|
||||||
dataList.add(row);
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
// 调用商品服务回退库存
|
// 调用商品服务回退库存
|
||||||
productRpcService.orderRefundReturnStock(orderInfo.getShopId(), orderId, dataList);
|
productRpcService.orderRefundReturnStock(orderInfo.getShopId(), orderId, dataList);
|
||||||
@@ -221,7 +169,8 @@ public class OrderInfoRpcServiceImpl implements OrderInfoRpcService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendHandoverReceiptPrintMsgToMq(Long handoverRecordId) {
|
public void sendHandoverReceiptPrintMsgToMq(Long shopId, HandoverRecord record) {
|
||||||
rabbitPublisher.sendHandoverPrintMsg(Convert.toStr(handoverRecordId));
|
rabbitPublisher.sendOtherPrintMsg(shopId, record, "HANDOVER");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
package com.czg.service.order.service.impl;
|
package com.czg.service.order.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.crypto.SecureUtil;
|
import cn.hutool.crypto.SecureUtil;
|
||||||
import cn.hutool.crypto.digest.MD5;
|
import cn.hutool.crypto.digest.MD5;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.czg.PayCst;
|
import com.czg.PayCst;
|
||||||
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
||||||
import com.czg.account.entity.ShopInfo;
|
import com.czg.account.entity.ShopInfo;
|
||||||
@@ -44,7 +42,7 @@ import com.czg.resp.CzgResult;
|
|||||||
import com.czg.service.RedisService;
|
import com.czg.service.RedisService;
|
||||||
import com.czg.service.order.dto.OrderPayParamDTO;
|
import com.czg.service.order.dto.OrderPayParamDTO;
|
||||||
import com.czg.service.order.enums.OrderStatusEnums;
|
import com.czg.service.order.enums.OrderStatusEnums;
|
||||||
import com.czg.service.order.print.PrinterHandler;
|
import com.czg.service.order.print.PrintConfig;
|
||||||
import com.czg.service.order.service.OrderPayService;
|
import com.czg.service.order.service.OrderPayService;
|
||||||
import com.czg.service.order.service.PayService;
|
import com.czg.service.order.service.PayService;
|
||||||
import com.czg.utils.AssertUtil;
|
import com.czg.utils.AssertUtil;
|
||||||
@@ -94,7 +92,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
@Resource
|
@Resource
|
||||||
private RabbitPublisher rabbitPublisher;
|
private RabbitPublisher rabbitPublisher;
|
||||||
@Resource
|
@Resource
|
||||||
private PrinterHandler printerHandler;
|
private PrintConfig printConfig;
|
||||||
@Resource
|
@Resource
|
||||||
private MkShopRechargeService shopRechargeService;
|
private MkShopRechargeService shopRechargeService;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -118,6 +116,8 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
//发送打票信息
|
//发送打票信息
|
||||||
//orderId_0_0 订单ID_先付后付(1先付0后付)_订单状态 0未完成 1完成
|
//orderId_0_0 订单ID_先付后付(1先付0后付)_订单状态 0未完成 1完成
|
||||||
//orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_0"
|
//orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_0"
|
||||||
|
rabbitPublisher.sendKitchenOrderPrintMsg(orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_1",
|
||||||
|
orderInfo.getIsPrint() == 1, "0元付款");
|
||||||
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_1",
|
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_1",
|
||||||
orderInfo.getIsPrint() == 1, "0元付款");
|
orderInfo.getIsPrint() == 1, "0元付款");
|
||||||
redisService.del(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId());
|
redisService.del(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId());
|
||||||
@@ -362,6 +362,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
LocalDateTime.now(), paymentId, PayEnums.BACK_SCAN);
|
LocalDateTime.now(), paymentId, PayEnums.BACK_SCAN);
|
||||||
// 事务成功提交后执行消息发送
|
// 事务成功提交后执行消息发送
|
||||||
String printParam = orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_1";
|
String printParam = orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_1";
|
||||||
|
rabbitPublisher.sendKitchenOrderPrintMsg(printParam, orderInfo.getIsPrint() == 1, "事务环境打印");
|
||||||
rabbitPublisher.sendOrderPrintMsg(printParam, orderInfo.getIsPrint() == 1, "事务环境打印");
|
rabbitPublisher.sendOrderPrintMsg(printParam, orderInfo.getIsPrint() == 1, "事务环境打印");
|
||||||
} else {
|
} else {
|
||||||
upOrderPayInfo(orderInfo.getId(), PayEnums.BACK_SCAN, paymentId,
|
upOrderPayInfo(orderInfo.getId(), PayEnums.BACK_SCAN, paymentId,
|
||||||
@@ -380,7 +381,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
}
|
}
|
||||||
boolean isFirstRefund = orderInfo.getRefundAmount().compareTo(BigDecimal.ZERO) == 0;
|
boolean isFirstRefund = orderInfo.getRefundAmount().compareTo(BigDecimal.ZERO) == 0;
|
||||||
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
|
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
|
||||||
Map<String, BigDecimal> returnProMap = new HashMap<>();
|
Map<Long, BigDecimal> productStockMap = new HashMap<>();
|
||||||
boolean isPay = true;
|
boolean isPay = true;
|
||||||
String refPayOrderNo = "REFO" + IdUtil.getSnowflakeNextId();
|
String refPayOrderNo = "REFO" + IdUtil.getSnowflakeNextId();
|
||||||
if (orderInfo.getStatus().equals(OrderStatusEnums.UNPAID.getCode())) {
|
if (orderInfo.getStatus().equals(OrderStatusEnums.UNPAID.getCode())) {
|
||||||
@@ -440,7 +441,11 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
}
|
}
|
||||||
orderDetailService.updateById(orderDetail);
|
orderDetailService.updateById(orderDetail);
|
||||||
if (orderDetail.getProductId() != null && orderDetail.getProductId() > 0) {
|
if (orderDetail.getProductId() != null && orderDetail.getProductId() > 0) {
|
||||||
returnProMap.put(Convert.toStr(orderDetail.getProductId()), refundDetail.getNum());
|
if (productStockMap.containsKey(orderDetail.getProductId())) {
|
||||||
|
productStockMap.put(orderDetail.getProductId(), productStockMap.get(orderDetail.getProductId()).add(refundDetail.getNum()));
|
||||||
|
} else {
|
||||||
|
productStockMap.put(orderDetail.getProductId(), refundDetail.getNum());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
long count = orderDetailService.count(QueryWrapper.create().eq(OrderDetail::getOrderId, orderInfo.getId())
|
long count = orderDetailService.count(QueryWrapper.create().eq(OrderDetail::getOrderId, orderInfo.getId())
|
||||||
@@ -458,14 +463,22 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
for (OrderDetail orderDetail : orderDetails) {
|
for (OrderDetail orderDetail : orderDetails) {
|
||||||
if (isPay) {
|
if (isPay) {
|
||||||
if (orderDetail.getProductId() != null && orderDetail.getProductId() > 0) {
|
if (orderDetail.getProductId() != null && orderDetail.getProductId() > 0) {
|
||||||
returnProMap.put(Convert.toStr(orderDetail.getProductId()), orderDetail.getNum().subtract(orderDetail.getReturnNum()).subtract(orderDetail.getRefundNum()));
|
if (productStockMap.containsKey(orderDetail.getProductId())) {
|
||||||
|
productStockMap.put(orderDetail.getProductId(), productStockMap.get(orderDetail.getProductId()).add(orderDetail.getNum().subtract(orderDetail.getReturnNum()).subtract(orderDetail.getRefundNum())));
|
||||||
|
} else {
|
||||||
|
productStockMap.put(orderDetail.getProductId(), orderDetail.getNum().subtract(orderDetail.getReturnNum()).subtract(orderDetail.getRefundNum()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
orderDetail.setReturnAmount(orderDetail.getPayAmount());
|
orderDetail.setReturnAmount(orderDetail.getPayAmount());
|
||||||
orderDetail.setRefundNum(orderDetail.getNum().subtract(orderDetail.getReturnNum()));
|
orderDetail.setRefundNum(orderDetail.getNum().subtract(orderDetail.getReturnNum()));
|
||||||
orderDetail.setStatus(OrderStatusEnums.REFUND.getCode());
|
orderDetail.setStatus(OrderStatusEnums.REFUND.getCode());
|
||||||
} else {
|
} else {
|
||||||
if (orderDetail.getProductId() != null && orderDetail.getProductId() > 0) {
|
if (orderDetail.getProductId() != null && orderDetail.getProductId() > 0) {
|
||||||
returnProMap.put(Convert.toStr(orderDetail.getProductId()), orderDetail.getNum().subtract(orderDetail.getReturnNum()));
|
if (productStockMap.containsKey(orderDetail.getProductId())) {
|
||||||
|
productStockMap.put(orderDetail.getProductId(), productStockMap.get(orderDetail.getProductId()).add(orderDetail.getNum().subtract(orderDetail.getReturnNum())));
|
||||||
|
} else {
|
||||||
|
productStockMap.put(orderDetail.getProductId(), orderDetail.getNum().subtract(orderDetail.getReturnNum()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
orderDetail.setReturnNum(orderDetail.getNum());
|
orderDetail.setReturnNum(orderDetail.getNum());
|
||||||
orderDetail.setStatus(OrderStatusEnums.CANCELLED.getCode());
|
orderDetail.setStatus(OrderStatusEnums.CANCELLED.getCode());
|
||||||
@@ -510,12 +523,21 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
orderInfo.setRefundRemark(orderInfo.getRefundRemark() + param.getRefundReason());
|
orderInfo.setRefundRemark(orderInfo.getRefundRemark() + param.getRefundReason());
|
||||||
orderInfoService.updateById(orderInfo);
|
orderInfoService.updateById(orderInfo);
|
||||||
//退款后续 退款单/退菜单
|
//退款后续 退款单/退菜单
|
||||||
printerHandler.refundOrderHandler(printTitle, StrUtil.isNotBlank(param.getOperator()) ? param.getOperator() : ""
|
if (param.isPrint()) {
|
||||||
, isPay ? param.getRefundAmount().toPlainString() : "0"
|
String finalPrintTitle = printTitle;
|
||||||
, param.getRefundReason(), orderInfo.getRefundType(), orderInfo, param.getRefundDetails());
|
boolean finalIsPay = isPay;
|
||||||
|
FunUtils.safeRunVoid(() -> printConfig.refundOrderHandler(finalPrintTitle, StrUtil.isNotBlank(param.getOperator()) ? param.getOperator() : ""
|
||||||
|
, finalIsPay ? param.getRefundAmount().toPlainString() : "0"
|
||||||
|
, param.getRefundReason(), orderInfo.getRefundType(), orderInfo, param.getRefundDetails()),
|
||||||
|
"订单id:{} 退款,前台打印消息失败", orderInfo.getId());
|
||||||
|
}
|
||||||
|
//后厨退菜单
|
||||||
|
FunUtils.safeRunVoid(() -> printConfig.kitchenRefundAllHandler(StrUtil.isNotBlank(param.getOperator()) ? param.getOperator() : "", orderInfo, param.getRefundDetails()),
|
||||||
|
"订单id:{} 退款,后厨退菜单打印消息失败", orderInfo.getId());
|
||||||
//退款返还库存
|
//退款返还库存
|
||||||
if (!returnProMap.isEmpty()) {
|
if (!productStockMap.isEmpty()) {
|
||||||
rabbitPublisher.sendOrderRefundMsg(JSONObject.toJSONString(Map.of("orderId", orderInfo.getId(), "returnProMap", returnProMap)));
|
FunUtils.safeRunVoid(() -> orderInfoCustomService.refundStock(shopInfo, orderInfo.getId(), productStockMap, param.isRefundStock()),
|
||||||
|
"订单id:{} 退款,库存处理失败", orderInfo.getId());
|
||||||
}
|
}
|
||||||
refundOrderAfter(orderInfo.getId(), orderInfo.getShopId(), orderInfo.getUserId(), orderInfo.getOrderNo(),
|
refundOrderAfter(orderInfo.getId(), orderInfo.getShopId(), orderInfo.getUserId(), orderInfo.getOrderNo(),
|
||||||
orderInfo.getPointsNum(), isFirstRefund, orderInfo.getStatus().equals(OrderStatusEnums.REFUND.getCode()));
|
orderInfo.getPointsNum(), isFirstRefund, orderInfo.getStatus().equals(OrderStatusEnums.REFUND.getCode()));
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class PrintMachineLogServiceImpl extends ServiceImpl<PrintMachineLogMappe
|
|||||||
String respMsg = "打印中";
|
String respMsg = "打印中";
|
||||||
JSONObject resp = JSONObject.parseObject(respJson);
|
JSONObject resp = JSONObject.parseObject(respJson);
|
||||||
// 云想印
|
// 云想印
|
||||||
if ("云想印".equals(config.getContentType())) {
|
if ("云想印".equals(config.getBrand())) {
|
||||||
int code = resp.getIntValue("code");
|
int code = resp.getIntValue("code");
|
||||||
JSONObject respData = resp.getJSONObject("data");
|
JSONObject respData = resp.getJSONObject("data");
|
||||||
JSONObject data = respData.getJSONObject("data");
|
JSONObject data = respData.getJSONObject("data");
|
||||||
@@ -112,7 +112,7 @@ public class PrintMachineLogServiceImpl extends ServiceImpl<PrintMachineLogMappe
|
|||||||
entity.setTaskId(respData.getString("orderId"));
|
entity.setTaskId(respData.getString("orderId"));
|
||||||
}
|
}
|
||||||
// 飞鹅云打印机暂时没有适配,先return不做打印记录
|
// 飞鹅云打印机暂时没有适配,先return不做打印记录
|
||||||
} else if ("飞鹅".equals(config.getContentType())) {
|
} else if ("飞鹅".equals(config.getBrand())) {
|
||||||
int ret = resp.getIntValue("ret");
|
int ret = resp.getIntValue("ret");
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
failFlag = 1;
|
failFlag = 1;
|
||||||
@@ -170,7 +170,7 @@ public class PrintMachineLogServiceImpl extends ServiceImpl<PrintMachineLogMappe
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// 1. 云想印打印机状态查询
|
// 1. 云想印打印机状态查询
|
||||||
if ("云想印".equals(config.getContentType())) {
|
if ("云想印".equals(config.getBrand())) {
|
||||||
String jsonStr = yxyPrinter.checkPrintStatus(config.getAddress(), entity.getTaskId());
|
String jsonStr = yxyPrinter.checkPrintStatus(config.getAddress(), entity.getTaskId());
|
||||||
log.info("云想印打印状态查询结果(第{}次,虚拟线程:{}):{}",
|
log.info("云想印打印状态查询结果(第{}次,虚拟线程:{}):{}",
|
||||||
currentTimes, Thread.currentThread().getName(), jsonStr);
|
currentTimes, Thread.currentThread().getName(), jsonStr);
|
||||||
@@ -185,8 +185,8 @@ public class PrintMachineLogServiceImpl extends ServiceImpl<PrintMachineLogMappe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 2. 飞鹅云打印机状态查询
|
// 2. 飞鹅云打印机状态查询
|
||||||
else if ("飞鹅".equals(config.getContentType())) {
|
else if ("飞鹅".equals(config.getBrand())) {
|
||||||
Boolean success = feiPrinter.checkFPrintStatus(entity.getTaskId());
|
Boolean success = feiPrinter.checkPrintStatus(entity.getTaskId());
|
||||||
if (success == null) {
|
if (success == null) {
|
||||||
entity.setFailFlag(1);
|
entity.setFailFlag(1);
|
||||||
entity.setRespMsg("打印失败,未知错误");
|
entity.setRespMsg("打印失败,未知错误");
|
||||||
@@ -249,7 +249,7 @@ public class PrintMachineLogServiceImpl extends ServiceImpl<PrintMachineLogMappe
|
|||||||
//仅当是最后一次任务时,才执行更新操作
|
//仅当是最后一次任务时,才执行更新操作
|
||||||
if (isLastTask) {
|
if (isLastTask) {
|
||||||
super.updateById(entity);
|
super.updateById(entity);
|
||||||
updateOrderEntity(orderId, config, isPrintSuccess);
|
// updateOrderEntity(orderId, config, isPrintSuccess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
package com.czg.service.order.service.impl;
|
package com.czg.service.order.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import com.czg.config.RabbitPublisher;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.order.entity.ShopProdStatistic;
|
import com.czg.order.entity.ShopProdStatistic;
|
||||||
import com.czg.order.param.SaleSummaryCountParam;
|
import com.czg.order.param.SaleSummaryCountParam;
|
||||||
import com.czg.order.service.ShopProdStatisticService;
|
import com.czg.order.service.ShopProdStatisticService;
|
||||||
import com.czg.order.vo.SaleSummaryCountVo;
|
import com.czg.order.vo.SaleSummaryCountVo;
|
||||||
|
import com.czg.print.ProductReportPrintDTO;
|
||||||
|
import com.czg.product.service.ShopProdCategoryService;
|
||||||
import com.czg.service.order.mapper.ShopProdStatisticMapper;
|
import com.czg.service.order.mapper.ShopProdStatisticMapper;
|
||||||
import com.czg.utils.CzgStrUtils;
|
import com.czg.utils.CzgStrUtils;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -28,6 +34,11 @@ import java.util.stream.Stream;
|
|||||||
@Service
|
@Service
|
||||||
public class ShopProdStatisticServiceImpl extends ServiceImpl<ShopProdStatisticMapper, ShopProdStatistic> implements ShopProdStatisticService {
|
public class ShopProdStatisticServiceImpl extends ServiceImpl<ShopProdStatisticMapper, ShopProdStatistic> implements ShopProdStatisticService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RabbitPublisher rabbitPublisher;
|
||||||
|
@DubboReference
|
||||||
|
private ShopProdCategoryService shopProdCategoryService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ShopProdStatistic> getArchiveTradeDataBy10(Long shopId, Integer day) {
|
public List<ShopProdStatistic> getArchiveTradeDataBy10(Long shopId, Integer day) {
|
||||||
LocalDate currentDate = LocalDate.now();
|
LocalDate currentDate = LocalDate.now();
|
||||||
@@ -73,6 +84,91 @@ public class ShopProdStatisticServiceImpl extends ServiceImpl<ShopProdStatisticM
|
|||||||
return mergeSummaryCountVo(todaySummary, dateRangeSummary);
|
return mergeSummaryCountVo(todaySummary, dateRangeSummary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void summaryPrint(SaleSummaryCountParam param) {
|
||||||
|
// 1. 获取统计数据
|
||||||
|
SaleSummaryCountVo saleSummaryCountVo = summaryCount(param);
|
||||||
|
List<ShopProdStatistic> prodStatisticList = getArchiveTradeData(param);
|
||||||
|
LocalDate currentDate = LocalDate.now();
|
||||||
|
Map<Long, String> categoryMap = shopProdCategoryService.getCategoryIdNameMap(param.getShopId());
|
||||||
|
|
||||||
|
ProductReportPrintDTO printDTO = new ProductReportPrintDTO();
|
||||||
|
String statisticsTime = "";
|
||||||
|
if ("today".equals(param.getRangeType())) {
|
||||||
|
statisticsTime = LocalDateTimeUtil.format(currentDate, "yyyy/MM/dd");
|
||||||
|
}
|
||||||
|
if ("yesterday".equals(param.getRangeType())) {
|
||||||
|
statisticsTime = LocalDateTimeUtil.format(currentDate.minusDays(1), "yyyy/MM/dd");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (param.getBeginDate().isAfter(currentDate)) {
|
||||||
|
throw new CzgException("开始时间不能晚于当前时间");
|
||||||
|
}
|
||||||
|
if (param.getBeginDate().equals(param.getEndDate())) {
|
||||||
|
statisticsTime = LocalDateTimeUtil.format(param.getBeginDate(), "yyyy/MM/dd");
|
||||||
|
}
|
||||||
|
if (param.getEndDate().isBefore(currentDate)) {
|
||||||
|
statisticsTime = LocalDateTimeUtil.format(param.getBeginDate(), "yyyy/MM/dd") + " ~ " + LocalDateTimeUtil.format(param.getEndDate(), "yyyy/MM/dd");
|
||||||
|
}
|
||||||
|
printDTO.setStatisticsTime(statisticsTime);
|
||||||
|
printDTO.setOperator(param.getOperator());
|
||||||
|
if (saleSummaryCountVo != null) {
|
||||||
|
printDTO.setTotalProductCount(saleSummaryCountVo.getSaleCount());
|
||||||
|
printDTO.setTotalActualAmount(saleSummaryCountVo.getTotalAmount());
|
||||||
|
}else {
|
||||||
|
printDTO.setTotalProductCount(BigDecimal.ZERO);
|
||||||
|
printDTO.setTotalActualAmount(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 先按分类ID分组商品
|
||||||
|
Map<Long, List<ShopProdStatistic>> groupByCategory = prodStatisticList.stream()
|
||||||
|
.collect(Collectors.groupingBy(ShopProdStatistic::getCategoryId));
|
||||||
|
|
||||||
|
// 5. 组装成新结构 List<CategoryItem>
|
||||||
|
List<ProductReportPrintDTO.CategoryItem> categoryItems = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Map.Entry<Long, List<ShopProdStatistic>> entry : groupByCategory.entrySet()) {
|
||||||
|
Long categoryId = entry.getKey();
|
||||||
|
List<ShopProdStatistic> productList = entry.getValue();
|
||||||
|
|
||||||
|
// 分类名称
|
||||||
|
String categoryName = categoryMap.getOrDefault(categoryId, "未分类");
|
||||||
|
|
||||||
|
// 商品列表
|
||||||
|
List<ProductReportPrintDTO.ProductItem> productItems = new ArrayList<>();
|
||||||
|
BigDecimal categoryTotalNumber = BigDecimal.ZERO;
|
||||||
|
BigDecimal categoryTotalActual = BigDecimal.ZERO;
|
||||||
|
BigDecimal categoryTotalSales = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
for (ShopProdStatistic s : productList) {
|
||||||
|
ProductReportPrintDTO.ProductItem item = new ProductReportPrintDTO.ProductItem();
|
||||||
|
item.setProductName(s.getProductName());
|
||||||
|
item.setNumber(s.getValidSaleCount());
|
||||||
|
item.setActualAmount(s.getValidSaleAmount());
|
||||||
|
item.setSalesAmount(s.getSaleAmount());
|
||||||
|
productItems.add(item);
|
||||||
|
|
||||||
|
// 分类汇总累加
|
||||||
|
categoryTotalNumber = categoryTotalNumber.add(s.getValidSaleCount());
|
||||||
|
categoryTotalActual = categoryTotalActual.add(s.getValidSaleAmount());
|
||||||
|
categoryTotalSales = categoryTotalSales.add(s.getSaleAmount());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建分类项
|
||||||
|
ProductReportPrintDTO.CategoryItem categoryItem = new ProductReportPrintDTO.CategoryItem();
|
||||||
|
categoryItem.setCategoryName(categoryName);
|
||||||
|
categoryItem.setNumber(categoryTotalNumber);
|
||||||
|
categoryItem.setActualAmount(categoryTotalActual);
|
||||||
|
categoryItem.setSalesAmount(categoryTotalSales);
|
||||||
|
categoryItem.setProductItems(productItems);
|
||||||
|
|
||||||
|
categoryItems.add(categoryItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
printDTO.setItems(categoryItems);
|
||||||
|
rabbitPublisher.sendOtherPrintMsg(param.getShopId(), printDTO, "PRODUCT_REPORT");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ShopProdStatistic> getArchiveTradeData(SaleSummaryCountParam param) {
|
public List<ShopProdStatistic> getArchiveTradeData(SaleSummaryCountParam param) {
|
||||||
LocalDate currentDate = LocalDate.now();
|
LocalDate currentDate = LocalDate.now();
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -110,16 +111,9 @@ public class ShopUserServiceImpl implements ShopUserPayService {
|
|||||||
return CzgResult.failure("支付密码错误");
|
return CzgResult.failure("支付密码错误");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (shopUser.getIsVip().equals(0)) {
|
|
||||||
// //更新会员
|
|
||||||
// ShopUser updateInfo = new ShopUser();
|
|
||||||
// updateInfo.setIsVip(1);
|
|
||||||
// updateInfo.setJoinTime(LocalDateTime.now());
|
|
||||||
// updateInfo.setId(payParam.getShopUserId());
|
|
||||||
// shopUserService.updateById(updateInfo);
|
|
||||||
// }
|
|
||||||
shopRechargeService.recharge(shopUser.getMainShopId(), shopUser.getId(), payParam.getRechargeDetailId(),
|
shopRechargeService.recharge(shopUser.getMainShopId(), shopUser.getId(), payParam.getRechargeDetailId(),
|
||||||
payParam.getAmount(), null, "cash", ShopUserFlowBizEnum.CASH_IN, true);
|
payParam.getAmount(), null, "cash", LocalDateTime.now(),
|
||||||
|
ShopUserFlowBizEnum.CASH_IN, true, payParam.getOperator());
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.czg.service.order.service.impl;
|
||||||
|
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.order.entity.SysPrintData;
|
||||||
|
import com.czg.order.service.SysPrintDataService;
|
||||||
|
import com.czg.service.order.mapper.SysPrintDataMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据打印表 服务层实现。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-04-16
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysPrintDataServiceImpl extends ServiceImpl<SysPrintDataMapper, SysPrintData> implements SysPrintDataService{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
cart.product_id as productId,
|
cart.product_id as productId,
|
||||||
pros.cover_img as productImg,
|
pros.cover_img as productImg,
|
||||||
pros.type as productType,
|
pros.type as productType,
|
||||||
|
pros.is_auto_sold_stock as isAutoSoldStock,
|
||||||
cart.sku_id as skuId,
|
cart.sku_id as skuId,
|
||||||
cart.is_time_discount as isTimeDiscount,
|
cart.is_time_discount as isTimeDiscount,
|
||||||
skus.spec_info as skuName,
|
skus.spec_info as skuName,
|
||||||
|
|||||||
@@ -45,39 +45,6 @@
|
|||||||
where id = #{orderId};
|
where id = #{orderId};
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="getHandoverCashAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(t1.pay_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
and t1.pay_type = 'cash_pay'
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverRefundAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(t1.refund_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverTotalAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(t1.pay_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverOrderNum" resultType="java.lang.Integer">
|
|
||||||
SELECT
|
|
||||||
count(*)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverDetailList" resultType="com.czg.account.vo.HandoverProductListVo">
|
<select id="getHandoverDetailList" resultType="com.czg.account.vo.HandoverProductListVo">
|
||||||
SELECT
|
SELECT
|
||||||
t2.product_id,
|
t2.product_id,
|
||||||
@@ -96,53 +63,7 @@
|
|||||||
t2.product_id,
|
t2.product_id,
|
||||||
t2.sku_id
|
t2.sku_id
|
||||||
</select>
|
</select>
|
||||||
<select id="getHandoverWechatAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(t1.pay_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
and t1.pay_type = 'wechat_mini'
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverAlipayAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(t1.pay_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
and t1.pay_type = 'alipay_mini'
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverVipPayAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(t1.pay_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
and t1.pay_type = 'vip_pay'
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverVipChargeAmount" resultType="java.math.BigDecimal">
|
|
||||||
select ifnull(sum(t1.amount), 0)
|
|
||||||
from tb_shop_user_flow t1
|
|
||||||
where t1.shop_id = #{shopId}
|
|
||||||
and t1.biz_code in ('cashIn', 'wechatIn', 'alipayIn', 'adminIn')
|
|
||||||
and t1.recharge_id is not null
|
|
||||||
<![CDATA[
|
|
||||||
AND t1.create_time >= str_to_date(#{loginTime}, '%Y-%m-%d %H:%i:%s')
|
|
||||||
AND t1.create_time <= str_to_date(#{handoverTime}, '%Y-%m-%d %H:%i:%s')
|
|
||||||
]]>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverQuickPayAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(pay_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
and t1.pay_type in ('main_scan','back_scan')
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getHandoverCategoryList" resultType="com.czg.account.vo.HandoverCategoryListVo">
|
<select id="getHandoverCategoryList" resultType="com.czg.account.vo.HandoverCategoryListVo">
|
||||||
SELECT case when t3.category_id is null then 0 else t3.category_id end as category_id,
|
SELECT case when t3.category_id is null then 0 else t3.category_id end as category_id,
|
||||||
case when t4.name is null then '未分类' else t4.name end as category_name,
|
case when t4.name is null then '未分类' else t4.name end as category_name,
|
||||||
@@ -158,14 +79,26 @@
|
|||||||
</where>
|
</where>
|
||||||
GROUP BY t3.category_id
|
GROUP BY t3.category_id
|
||||||
</select>
|
</select>
|
||||||
<select id="getHandoverCreditAmount" resultType="java.math.BigDecimal">
|
|
||||||
SELECT
|
|
||||||
ifnull(sum(t1.pay_amount),0)
|
|
||||||
FROM tb_order_info t1
|
|
||||||
<where>
|
|
||||||
<include refid="handoverCommonWhere"/>
|
|
||||||
and t1.pay_type = 'credit_pay'
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getConsByProductAndNum" resultType="com.czg.product.vo.ConsStockRecord">
|
||||||
|
SELECT
|
||||||
|
r.cons_info_id AS consId,
|
||||||
|
SUM(r.surplus_stock *
|
||||||
|
CASE
|
||||||
|
<foreach collection="productUsageMap.entrySet()" item="qty" index="pid">
|
||||||
|
WHEN r.product_id = #{pid} THEN #{qty}
|
||||||
|
</foreach>
|
||||||
|
ELSE 0
|
||||||
|
END
|
||||||
|
) AS stockNumber,
|
||||||
|
cons.con_name as conName,
|
||||||
|
cons.stock_number as currentStockNumber
|
||||||
|
FROM tb_prod_cons_relation r INNER JOIN tb_cons_info cons on r.cons_info_id = cons.id and cons.is_stock = 1
|
||||||
|
WHERE r.shop_id = #{shopId} AND r.product_id IN
|
||||||
|
<foreach collection="productUsageMap.keySet()" item="pid" open="(" separator="," close=")">
|
||||||
|
#{pid}
|
||||||
|
</foreach>
|
||||||
|
GROUP BY r.cons_info_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.czg.service.account.mapper.ShopProdCategoryMapper">
|
<mapper namespace="com.czg.service.order.mapper.SysPrintDataMapper">
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -21,4 +21,6 @@ public interface ProdConsRelationMapper extends BaseMapper<ProdConsRelation> {
|
|||||||
List<ProductBriefDTO> getProductListByConId(@Param("conId") Long conId);
|
List<ProductBriefDTO> getProductListByConId(@Param("conId") Long conId);
|
||||||
|
|
||||||
List<ProdConsRelationDTO> selectListByProdId(@Param("prodId") Long prodId);
|
List<ProdConsRelationDTO> selectListByProdId(@Param("prodId") Long prodId);
|
||||||
|
|
||||||
|
List<ProdConsRelationDTO> selectStockByProdId(@Param("prodId") Long prodId);
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,6 @@ import com.mybatisflex.core.query.QueryWrapper;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,8 +37,6 @@ public interface ProductMapper extends BaseMapper<Product> {
|
|||||||
|
|
||||||
List<RecommendProVO> selectCouponProBySaleNum();
|
List<RecommendProVO> selectCouponProBySaleNum();
|
||||||
|
|
||||||
void updateProductStockNum(@Param("id") Long id, @Param("shopId") Long shopId, @Param("type") String type, @Param("num") BigDecimal num);
|
|
||||||
|
|
||||||
List<RecommendProVO> selectRecommendProductList(@Param("lng") String lng, @Param("lat") String lat, @Param("address") String address,
|
List<RecommendProVO> selectRecommendProductList(@Param("lng") String lng, @Param("lat") String lat, @Param("address") String address,
|
||||||
@Param("classify") Integer classify, @Param("orderType") Integer orderType,
|
@Param("classify") Integer classify, @Param("orderType") Integer orderType,
|
||||||
@Param("distanceType") Integer distanceType, @Param("name") String name);
|
@Param("distanceType") Integer distanceType, @Param("name") String name);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user