From db2ddd9cfd8f80629cf287e7f308e05b64b807f2 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Fri, 15 Dec 2023 11:42:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cweb/controller/TestController.java | 4 +-- .../meal/BsMealTableOrderController.java | 25 +++++++++++++++++++ .../com/hfkj/common/exception/ErrorCode.java | 1 + .../impl/BsDeviceOrderServiceImpl.java | 2 +- .../service/meal/BsMealTableOrderService.java | 10 ++++++++ .../BsMealTableOrderChildServiceImpl.java | 5 +--- .../impl/BsMealTableOrderServiceImpl.java | 19 ++++++++++++++ .../meal/impl/BsMealTableServiceImpl.java | 2 +- 8 files changed, 60 insertions(+), 8 deletions(-) diff --git a/cweb/src/main/java/com/cweb/controller/TestController.java b/cweb/src/main/java/com/cweb/controller/TestController.java index e71ca7e..38ffc0c 100644 --- a/cweb/src/main/java/com/cweb/controller/TestController.java +++ b/cweb/src/main/java/com/cweb/controller/TestController.java @@ -605,10 +605,10 @@ public class TestController { @ApiOperation(value = "saasActivity") public ResponseData saasActivity(@RequestParam(value = "code", required = false) String code) { try { - return ResponseMsgUtil.success(saasActivityService.queryAgentActivityStatus("193")); + // return ResponseMsgUtil.success(saasActivityService.queryAgentActivityStatus("193")); // return ResponseMsgUtil.success(saasActivityService.agentRegisterActivity("193")); // return ResponseMsgUtil.success(saasActivityService.queryAgentActivityList()); - // return ResponseMsgUtil.success(saasActivityService.queryCustomerRates("193", "8226900542202CG")); + return ResponseMsgUtil.success(saasActivityService.referee("8226900542202CG")); // return ResponseMsgUtil.success(saasActivityService.queryCustomerActivityStatus("73", "8226900445800HB")); /*********** 活动报名 *************/ diff --git a/cweb/src/main/java/com/cweb/controller/meal/BsMealTableOrderController.java b/cweb/src/main/java/com/cweb/controller/meal/BsMealTableOrderController.java index a76212a..72dae72 100644 --- a/cweb/src/main/java/com/cweb/controller/meal/BsMealTableOrderController.java +++ b/cweb/src/main/java/com/cweb/controller/meal/BsMealTableOrderController.java @@ -1,6 +1,8 @@ package com.cweb.controller.meal; import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; @@ -13,6 +15,7 @@ import com.hfkj.model.ResponseData; import com.hfkj.service.meal.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.models.auth.In; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -143,6 +146,28 @@ public class BsMealTableOrderController { } + @RequestMapping(value="/queryOrderList",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询订单列表") + public ResponseData queryOrderList(@RequestParam(value = "storeId" , required = true) String storeId, + @RequestParam(value = "serialNumber" , required = false) String serialNumber, + @RequestParam(value = "pageNum" , required = true) Integer pageNum, + @RequestParam(value = "pageSize" , required = true) Integer pageSize) { + try { + Map param = new HashMap<>(); + param.put("storeId", storeId); + param.put("serialNumber", serialNumber); + + PageHelper.startPage(pageNum, pageSize); + return ResponseMsgUtil.success(new PageInfo<>(mealTableOrderService.getTableOrderList(param))); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + + } diff --git a/service/src/main/java/com/hfkj/common/exception/ErrorCode.java b/service/src/main/java/com/hfkj/common/exception/ErrorCode.java index 9458393..49d7430 100644 --- a/service/src/main/java/com/hfkj/common/exception/ErrorCode.java +++ b/service/src/main/java/com/hfkj/common/exception/ErrorCode.java @@ -64,6 +64,7 @@ public enum ErrorCode { BASE_ORGANIZATION_HAS_NOT_PARENT_ERROR("2033","该部门无上级部门"), UN_MEMBER_ERROR("2034","未找到用户"), PASSWORD_ERROR("2035","账号或密码错误"), + MEAL_TABLE_CREATE_BREAK_OUT_ERROR("2036","小伙伴正在提交订单..."), STATUS_ERROR("3000","状态错误"), diff --git a/service/src/main/java/com/hfkj/service/impl/BsDeviceOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsDeviceOrderServiceImpl.java index 3a9d0ec..4f83b85 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsDeviceOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsDeviceOrderServiceImpl.java @@ -124,7 +124,7 @@ public class BsDeviceOrderServiceImpl implements BsDeviceOrderService { order.setStatus(DeviceOrderStatusEnum.status3.getNumber()); editData(order); - if (order.getDeviceType().equals(DeviceTypeEnum.type1.getNumber())) { + if (order.getDeviceType().equals(DeviceTypeEnum.type1.getNumber()) || order.getDeviceType().equals(DeviceTypeEnum.type3.getNumber())) { List deviceList = new ArrayList<>(); for (String deviceNo : deviceNoList) { // 查询设备 diff --git a/service/src/main/java/com/hfkj/service/meal/BsMealTableOrderService.java b/service/src/main/java/com/hfkj/service/meal/BsMealTableOrderService.java index be1e232..f04c45d 100644 --- a/service/src/main/java/com/hfkj/service/meal/BsMealTableOrderService.java +++ b/service/src/main/java/com/hfkj/service/meal/BsMealTableOrderService.java @@ -4,6 +4,9 @@ import com.alibaba.fastjson.JSONArray; import com.hfkj.entity.BsMealTableOrder; import com.hfkj.entity.BsTradeOrder; +import java.util.List; +import java.util.Map; + /** * @className: BsMealTableOrderService * @author: HuRui @@ -38,6 +41,13 @@ public interface BsMealTableOrderService { */ BsMealTableOrder getTableOrderByPayOrderNo(String payOrderNo); + /** + * 查询订单列表 + * @param param + * @return + */ + List getTableOrderList(Map param); + /** * 支付成功 * @param tradeOrder diff --git a/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableOrderChildServiceImpl.java b/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableOrderChildServiceImpl.java index 72a73f7..cd3087d 100644 --- a/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableOrderChildServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableOrderChildServiceImpl.java @@ -187,13 +187,10 @@ public class BsMealTableOrderChildServiceImpl implements BsMealTableOrderChildSe SpPrinterConfig sp = new SpPrinterConfig(); sp.print(device.getDeviceNo(), SpPrinterTemplate.mealOrder(tableOrder, tableOrderChild, childProductList), 1); } - redisTemplate.delete(lockKey); } else { - System.out.println("加锁失败"); - Thread.sleep(100); // 加锁失败,重试 - createChildOrder(serialNumber, remark, userIdentity); + throw ErrorHelp.genException(SysCode.System, ErrorCode.MEAL_TABLE_CREATE_BREAK_OUT_ERROR, ""); } } catch (BaseException baseException) { redisTemplate.delete(lockKey); diff --git a/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableOrderServiceImpl.java index ae72634..289b666 100644 --- a/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableOrderServiceImpl.java @@ -16,6 +16,8 @@ import com.hfkj.service.meal.*; import com.hfkj.sysenum.DeviceTypeEnum; import com.hfkj.sysenum.MealTableOrderPayStatusEnum; import com.hfkj.sysenum.MealTableOrderStatusEnum; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -100,6 +102,23 @@ public class BsMealTableOrderServiceImpl implements BsMealTableOrderService { return null; } + @Override + public List getTableOrderList(Map param) { + BsMealTableOrderExample example = new BsMealTableOrderExample(); + BsMealTableOrderExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(MealTableOrderStatusEnum.status0.getNumber()); + + if (MapUtils.getLong(param, "storeId") != null) { + criteria.andStoreIdEqualTo(MapUtils.getLong(param, "storeId")); + } + + if (StringUtils.isNotBlank(MapUtils.getString(param, "serialNumber"))) { + criteria.andSerialNumberEqualTo(MapUtils.getString(param, "serialNumber")); + } + + example.setOrderByClause("create_time desc"); + return mealTableOrderMapper.selectByExample(example); + } + @Override public void paySuccess(BsTradeOrder tradeOrder) { // 查询订单详情 diff --git a/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableServiceImpl.java b/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableServiceImpl.java index b436076..c93efcf 100644 --- a/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableServiceImpl.java @@ -118,7 +118,7 @@ public class BsMealTableServiceImpl implements BsMealTableService { // 生成二维码 String file = "/mealTableQrCode/" + storeId + "/" + mealTable.getSerialNumber() + ".png"; - mealTable.setQrCodeContent("www.baidu.com"); + mealTable.setQrCodeContent(CommonSysConst.getSysConfig().getDomainName()+"/wxqrcode/meal?sn="+mealTable.getSerialNumber()); QRCodeGenerator.generateQRCodeImage( mealTable.getQrCodeContent(), 350,