diff --git a/cweb/src/main/java/com/cweb/config/AuthConfig.java b/cweb/src/main/java/com/cweb/config/AuthConfig.java index 1fa8015..df7020b 100644 --- a/cweb/src/main/java/com/cweb/config/AuthConfig.java +++ b/cweb/src/main/java/com/cweb/config/AuthConfig.java @@ -125,6 +125,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/storeProductCategory/search") .excludePathPatterns("/mealTable/getTable") .excludePathPatterns("/mealTableOrder/*") + .excludePathPatterns("/mealTableOrderPay/*") .excludePathPatterns("/ocr/*") .excludePathPatterns("/openGroup/*") ; diff --git a/cweb/src/main/java/com/cweb/controller/BsTradeOrderController.java b/cweb/src/main/java/com/cweb/controller/BsTradeOrderController.java index e0b9983..fd2610e 100644 --- a/cweb/src/main/java/com/cweb/controller/BsTradeOrderController.java +++ b/cweb/src/main/java/com/cweb/controller/BsTradeOrderController.java @@ -184,7 +184,7 @@ public class BsTradeOrderController { param.put("deviceId", device.getId()); // 创建交易订单 - return ResponseMsgUtil.success(tradeOrderService.createOrder(store.getId(), body.getBigDecimal("totalAmount"),null,null, null, param, request)); + return ResponseMsgUtil.success(tradeOrderService.createOrder(TradeOrderCreateTypeEnum.type2, store.getId(), body.getBigDecimal("totalAmount"),null,null, null, param, request)); } catch (Exception e) { log.error(e.getMessage(), e); @@ -289,6 +289,7 @@ public class BsTradeOrderController { // 创建交易订单 return ResponseMsgUtil.success(tradeOrderService.createOrder( + TradeOrderCreateTypeEnum.type1, store.getId(), body.getBigDecimal("totalAmount"), storeDiscountActivity, diff --git a/cweb/src/main/java/com/cweb/controller/TestController.java b/cweb/src/main/java/com/cweb/controller/TestController.java index 38ffc0c..e71ca7e 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.referee("8226900542202CG")); + // return ResponseMsgUtil.success(saasActivityService.queryCustomerRates("193", "8226900542202CG")); // return ResponseMsgUtil.success(saasActivityService.queryCustomerActivityStatus("73", "8226900445800HB")); /*********** 活动报名 *************/ diff --git a/cweb/src/main/java/com/cweb/controller/WechatController.java b/cweb/src/main/java/com/cweb/controller/WechatController.java index b1accb6..0c813f7 100644 --- a/cweb/src/main/java/com/cweb/controller/WechatController.java +++ b/cweb/src/main/java/com/cweb/controller/WechatController.java @@ -1,11 +1,15 @@ package com.cweb.controller; +import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; +import com.alibaba.fastjson.JSONObject; import com.cweb.config.SysConst; import com.hfkj.common.utils.HttpsUtils; import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.config.WxMaConfig; import com.hfkj.model.ResponseData; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; @@ -37,4 +41,23 @@ public class WechatController { return ResponseMsgUtil.exception(e); } } + + @RequestMapping(value = "/wxMiniHandleCode", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "微信小程序code解析") + public ResponseData wxMiniHandleCode(@RequestBody JSONObject body) { + try { + if (body == null|| StringUtils.isBlank(body.getString("code"))) { + log.error("LoginController --> phone() error!", "请求参数校验失败"); + } + WxMaJscode2SessionResult session = WxMaConfig.getMaService().jsCode2SessionInfo(body.getString("code")); + + //保存小程序用户登录的openId及sessionKey信息 + JSONObject jo = new JSONObject(); + jo.put("openId", session.getOpenid()); + return ResponseMsgUtil.success(jo); + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } } 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 cd69873..a76212a 100644 --- a/cweb/src/main/java/com/cweb/controller/meal/BsMealTableOrderController.java +++ b/cweb/src/main/java/com/cweb/controller/meal/BsMealTableOrderController.java @@ -5,13 +5,12 @@ import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.config.SpPrinterTemplate; import com.hfkj.entity.BsMealTableOrder; +import com.hfkj.entity.BsMealTableOrderChildProduct; import com.hfkj.entity.BsMealTableOrderProduct; import com.hfkj.model.ResponseData; -import com.hfkj.service.meal.BsMealShopCartService; -import com.hfkj.service.meal.BsMealTableOrderChildService; -import com.hfkj.service.meal.BsMealTableOrderProductService; -import com.hfkj.service.meal.BsMealTableOrderService; +import com.hfkj.service.meal.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; @@ -44,6 +43,8 @@ public class BsMealTableOrderController { private BsMealTableOrderService mealTableOrderService; @Resource private BsMealTableOrderProductService mealTableOrderProductService; + @Resource + private BsMealTableOrderChildProductService mealTableOrderChildProductService; @RequestMapping(value="/createOrder",method = RequestMethod.POST) @ResponseBody @@ -54,7 +55,36 @@ public class BsMealTableOrderController { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } - mealTableOrderChildService.createChildOrder(body.getString("serialNumber"), body.getString("userIdentity")); + mealTableOrderChildService.createChildOrder(body.getString("serialNumber"), body.getString("remark"), body.getString("userIdentity")); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + + + @RequestMapping(value="/operateOrderProduct",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "操作订单产品") + public ResponseData operateOrderProduct(@RequestBody JSONObject body) { + try { + if (body == null + || StringUtils.isBlank(body.getString("orderNo")) + || body.getJSONArray("productArray") == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + for (Object obj : body.getJSONArray("productArray")) { + JSONObject product = (JSONObject) obj; + if (product == null || product.getLong("productId") == null || product.getInteger("number") == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + } + + mealTableOrderService.operateOrderProduct(body.getString("orderNo"), body.getJSONArray("productArray")); return ResponseMsgUtil.success("操作成功"); @@ -64,15 +94,39 @@ public class BsMealTableOrderController { } } + @RequestMapping(value="/queryOrderDetail",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询订单详情") + public ResponseData queryOrderDetail(@RequestParam(value = "orderNo" , required = true) String orderNo) { + try { + // 查询桌台当前订单 + BsMealTableOrder tableOrder = mealTableOrderService.getTableOrderByOrderNo(orderNo); + if (tableOrder == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的订单号"); + } + Map map = new HashMap<>(); + map.put("order", tableOrder); + + Map param = new HashMap<>(); + param.put("orderNo", tableOrder.getOrderNo()); + map.put("product", mealTableOrderProductService.getOrderProductList(param)); + return ResponseMsgUtil.success(map); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/queryCurrentOrder",method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "查询当前订单") + @ApiOperation(value = "查询桌台当前订单") public ResponseData queryCurrentOrder(@RequestParam(value = "serialNumber" , required = true) String serialNumber) { try { // 查询桌台当前订单 BsMealTableOrder tableOrder = mealTableOrderService.getCurrentTableOrder(serialNumber); if (tableOrder == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当初桌台未开台"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前桌台未开台"); } Map map = new HashMap<>(); map.put("order", tableOrder); @@ -87,6 +141,8 @@ public class BsMealTableOrderController { return ResponseMsgUtil.exception(e); } } + + } diff --git a/cweb/src/main/java/com/cweb/controller/meal/BsMealTableOrderPayController.java b/cweb/src/main/java/com/cweb/controller/meal/BsMealTableOrderPayController.java new file mode 100644 index 0000000..b1fa163 --- /dev/null +++ b/cweb/src/main/java/com/cweb/controller/meal/BsMealTableOrderPayController.java @@ -0,0 +1,181 @@ +package com.cweb.controller.meal; + +import com.alibaba.fastjson.JSONObject; +import com.hfkj.channel.lakala.LaKaLaTradeService; +import com.hfkj.channel.tianque.service.TianQueTradeService; +import com.hfkj.common.exception.BaseException; +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.config.CommonSysConst; +import com.hfkj.entity.*; +import com.hfkj.model.ResponseData; +import com.hfkj.service.BsMerPlatformNoService; +import com.hfkj.service.BsTradeOrderService; +import com.hfkj.service.meal.BsMealTableOrderService; +import com.hfkj.sysenum.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.*; + +/** + * @className: BsMealShopCartController + * @author: HuRui + * @date: 2023/11/30 + **/ +@Controller +@Api(value = "桌台订单管理") +@RequestMapping(value = "/mealTableOrderPay") +public class BsMealTableOrderPayController { + + Logger log = LoggerFactory.getLogger(BsMealTableController.class); + + @Resource + private BsTradeOrderService tradeOrderService; + @Resource + private BsMealTableOrderService mealTableOrderService; + @Resource + private BsMerPlatformNoService merPlatformNoService; + @Resource + private LaKaLaTradeService laKaLaTradeService; + @Resource + private TianQueTradeService tianQueTradeService; + @Autowired + private RedisTemplate redisTemplate; + + @RequestMapping(value="/payOrder",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "支付订单") + public ResponseData payOrder(@RequestBody JSONObject body, HttpServletRequest request) { + try { + if (body == null || StringUtils.isBlank(body.getString("orderNo")) || StringUtils.isBlank(body.getString("payUserId"))) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + // 支付订单 + BsMealTableOrder tableOrder = mealTableOrderService.getTableOrderByOrderNo(body.getString("orderNo")); + if (tableOrder == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的订单号"); + } + if (!tableOrder.getStatus().equals(MealTableOrderStatusEnum.status1.getNumber())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态异常"); + } + if (!tableOrder.getPayStatus().equals(MealTableOrderPayStatusEnum.status1.getNumber())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "小伙伴正在支付中或已支付"); + } + String lockKey = "MEAL_ORDER_PAY_" + tableOrder.getOrderNo(); + try { + Boolean lock = redisTemplate.opsForValue().setIfAbsent(lockKey, null); + if(lock) { + // 加锁成功 + // 查询交易渠道 + BsMerPlatformNo merPlatform = merPlatformNoService.getCurrentPlatform(tableOrder.getMerId()); + if (merPlatform == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知交易渠道"); + } + Map param = new HashMap<>(); + param.put("payMode", TradeOrderPayModeEnum.WECHAT.getCode()); + param.put("payUserId", body.getString("payUserId")); + param.put("transType", "JSAPI"); + param.put("sub_appid", "wxff3cbb14f62d026d"); + + // 创建订单 + Map orderMap = tradeOrderService.createOrder(TradeOrderCreateTypeEnum.type4, tableOrder.getStoreId(), tableOrder.getOrderAmount(), null, null, null, param, request); + if (merPlatform.getPlatformType().equals(PlatformTypeEnum.type1.getNumber())) { + try { + Map order = laKaLaTradeService.preorder(MapUtils.getString(orderMap, "outTradeNo")); + System.out.println("返回参数:" + JSONObject.toJSONString(order)); + if (StringUtils.isNotBlank(MapUtils.getString(order, "order"))) { + // 设置支付状态 + tableOrder.setPayOrderNo(MapUtils.getString(orderMap, "outTradeNo")); + tableOrder.setPayStatus(MealTableOrderPayStatusEnum.status2.getNumber()); + mealTableOrderService.editData(tableOrder); + + + redisTemplate.delete(lockKey); + return ResponseMsgUtil.success(order); + } + } catch (Exception e) { + log.error("拉卡拉支付失败", e.getMessage()); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, e.getMessage()); + } + } else if (merPlatform.getPlatformType().equals(PlatformTypeEnum.type5.getNumber())) { + try { + Map order = tianQueTradeService.preorder(MapUtils.getString(orderMap, "outTradeNo")); + System.out.println("返回参数:" + JSONObject.toJSONString(order)); + if (StringUtils.isNotBlank(MapUtils.getString(order, "order"))) { + // 设置支付状态 + tableOrder.setPayOrderNo(MapUtils.getString(orderMap, "outTradeNo")); + tableOrder.setPayStatus(MealTableOrderPayStatusEnum.status2.getNumber()); + mealTableOrderService.editData(tableOrder); + + redisTemplate.delete(lockKey); + return ResponseMsgUtil.success(order); + } + } catch (Exception e) { + log.error("随行付支付失败", e.getMessage()); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, e.getMessage()); + } + } + + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "小伙伴正在支付中..."); + } + } catch (BaseException baseException) { + redisTemplate.delete(lockKey); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, baseException.getErrorMsg()); + + } catch (Exception e) { + redisTemplate.delete(lockKey); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知错误"); + } + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付失败"); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/cancelPay",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "取消支付") + public ResponseData cancelPay(@RequestBody JSONObject body) { + try { + if (body == null || StringUtils.isBlank(body.getString("orderNo"))) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + // 支付订单 + BsMealTableOrder tableOrder = mealTableOrderService.getTableOrderByOrderNo(body.getString("orderNo")); + if (tableOrder == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的订单号"); + } + if (tableOrder.getStatus().equals(MealTableOrderStatusEnum.status2.getNumber())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "取消失败,订单已结账"); + } + tableOrder.setPayOrderNo(null); + tableOrder.setPayStatus(MealTableOrderPayStatusEnum.status1.getNumber()); + mealTableOrderService.editData(tableOrder); + + return ResponseMsgUtil.success("取消成功"); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + +} + + diff --git a/service/src/main/java/com/hfkj/channel/saas/utils/SaasCommon.java b/service/src/main/java/com/hfkj/channel/saas/utils/SaasCommon.java index f69a23f..a5cc23b 100644 --- a/service/src/main/java/com/hfkj/channel/saas/utils/SaasCommon.java +++ b/service/src/main/java/com/hfkj/channel/saas/utils/SaasCommon.java @@ -42,7 +42,7 @@ public class SaasCommon { * @return */ public Object getToken() { - try { + /*try { Object saasToken = redisUtil.get("SAAS_TOKEN"); if (saasToken != null) { return saasToken.toString(); @@ -72,8 +72,8 @@ public class SaasCommon { return null; } finally { log.info("==============end 获取token end =============="); - } - return null; + }*/ + return "b72a5b10-3440-460d-b3e0-f9deaa76a326"; } public Object getUpdateToken() { diff --git a/service/src/main/java/com/hfkj/config/CommonSysConfig.java b/service/src/main/java/com/hfkj/config/CommonSysConfig.java index cbd49b6..611b0b8 100644 --- a/service/src/main/java/com/hfkj/config/CommonSysConfig.java +++ b/service/src/main/java/com/hfkj/config/CommonSysConfig.java @@ -14,6 +14,9 @@ public class CommonSysConfig { private String wechat_mp_appid; private String wechat_mp_secret; + private String wechat_ma_appid; + private String wechat_ma_secret; + /** * 华为云OBS桶名称 */ diff --git a/service/src/main/java/com/hfkj/config/SpPrinterConfig.java b/service/src/main/java/com/hfkj/config/SpPrinterConfig.java new file mode 100644 index 0000000..7f0e728 --- /dev/null +++ b/service/src/main/java/com/hfkj/config/SpPrinterConfig.java @@ -0,0 +1,198 @@ +package com.hfkj.config; + +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.*; +import org.apache.http.client.utils.URLEncodedUtils; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; + +/** + * 商鹏打印机 + * @author hurui + */ +public class SpPrinterConfig { + + public static final String baseUri = "https://open.spyun.net/v1/"; + + private String appid = "sp6284a57015d78"; + + private String appsecret = "2bdca1587ead21c0569e0ed1f82b19f6"; + +/* public SpPrinterConfig(String appid, String appsecret) { + this.appid = appid; + this.appsecret = appsecret; + }*/ + + // 添加打印机 + public String addPrinter(String sn, String pkey, String name) throws IOException { + ArrayList params = new ArrayList<>(); + params.add(new BasicNameValuePair("sn", sn)); + params.add(new BasicNameValuePair("pkey", pkey)); + params.add(new BasicNameValuePair("name", name)); + + return request("POST", "printer/add", params); + } + + // 删除打印机 + public String deletePrinter(String sn) throws IOException { + ArrayList params = new ArrayList<>(); + params.add(new BasicNameValuePair("sn", sn)); + + return request("DELETE", "printer/delete", params); + } + + // 修改打印机信息 + public String updatePrinter(String sn, String name) throws IOException { + ArrayList params = new ArrayList<>(); + params.add(new BasicNameValuePair("sn", sn)); + params.add(new BasicNameValuePair("name", name)); + + return request("PATCH", "printer/update", params); + } + + // 修改打印机参数 + public String updatePrinterSetting(String sn, int auto_cut, String voice) throws IOException { + ArrayList params = new ArrayList<>(); + params.add(new BasicNameValuePair("sn", sn)); + params.add(new BasicNameValuePair("auto_cut", String.valueOf(auto_cut))); + params.add(new BasicNameValuePair("voice", voice)); + + return request("PATCH", "printer/setting", params); + } + + // 获取打印机信息 + public String getPrinter(String sn) throws IOException { + ArrayList params = new ArrayList<>(); + params.add(new BasicNameValuePair("sn", sn)); + + return request("GET", "printer/info", params); + } + + // 打印订单 + public String print(String sn, String content, int times) throws IOException { + ArrayList params = new ArrayList<>(); + params.add(new BasicNameValuePair("sn", sn)); + params.add(new BasicNameValuePair("content", content)); + params.add(new BasicNameValuePair("times", String.valueOf(times))); + + return request("POST", "printer/print", params); + } + + // 清空待打印订单 + public String deletePrints(String sn) throws IOException { + ArrayList params = new ArrayList<>(); + params.add(new BasicNameValuePair("sn", sn)); + + return request("DELETE", "printer/cleansqs", params); + } + + // 查询打印订单状态 + public String getPrintsStatus(String id) throws IOException { + ArrayList params = new ArrayList<>(); + params.add(new BasicNameValuePair("id", id)); + + return request("GET", "printer/order/status", params); + } + + // 查询打印机历史打印订单数 + public String getPrintsOrders(String sn, String date) throws IOException { + ArrayList params = new ArrayList<>(); + params.add(new BasicNameValuePair("sn", sn)); + params.add(new BasicNameValuePair("date", date)); + + return request("GET", "printer/order/number", params); + } + + // 发送请求 + private String request(String method, String uri, ArrayList params) throws IOException { + RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(4000) //读取超时 + .setConnectTimeout(1000) //连接超时 + .build(); + + CloseableHttpClient httpClient = HttpClients.custom() + .setDefaultRequestConfig(requestConfig) + .build(); + + // 公共请求参数 + params.add(new BasicNameValuePair("appid", appid)); + params.add(new BasicNameValuePair("timestamp", String.valueOf(System.currentTimeMillis() / 1000))); + params.add(new BasicNameValuePair("sign", makeSign(params))); + + CloseableHttpResponse response = null; + String url = baseUri + uri; + if (method.equals("GET")) { + HttpGet request = new HttpGet(url + "?" + URLEncodedUtils.format(params, "utf-8")); + response = httpClient.execute(request); + } else if (method.equals("DELETE")) { + HttpDelete request = new HttpDelete(url + "?" + URLEncodedUtils.format(params, "utf-8")); + response = httpClient.execute(request); + } else if (method.equals("POST")) { + HttpPost request = new HttpPost(url); + request.setEntity(new UrlEncodedFormEntity(params,"utf-8")); + response = httpClient.execute(request); + } else if (method.equals("PATCH")) { + HttpPatch request = new HttpPatch(url); + request.setEntity(new UrlEncodedFormEntity(params,"utf-8")); + response = httpClient.execute(request); + } else if (method.equals("PUT")) { + HttpPut request = new HttpPut(url); + request.setEntity(new UrlEncodedFormEntity(params,"utf-8")); + response = httpClient.execute(request); + } + + if (response == null) { + throw new ClientProtocolException(); + } + + HttpEntity httpEntity = response.getEntity(); + if (httpEntity == null) { + throw new ClientProtocolException(); + } + +/* if (response.getStatusLine().getStatusCode() != 200) { + throw new ClientProtocolException(EntityUtils.toString(httpEntity)); + }*/ + + return EntityUtils.toString(httpEntity); + } + + // 创建签名 + public String makeSign(ArrayList params) { + int size = params.size(); + String[] keys = new String[params.size()]; + HashMap values = new HashMap<>(); + for (int i = 0; i < size; i++) { + NameValuePair p = params.get(i); + keys[i] = p.getName(); + values.put(p.getName(), p.getValue()); + } + Arrays.sort(keys); + + String sign = ""; + for (int i = 0; i < keys.length; i++) { + String v = values.get(keys[i]); + if (!keys[i].equals("sign") && !keys[i].equals("appsecret") && !v.equals("")) { + if (i > 0) { + sign += "&"; + } + sign += keys[i] + "=" + v; + } + } + sign += "&appsecret=" + appsecret; + + return DigestUtils.md5Hex(sign).toUpperCase(); + } +} diff --git a/service/src/main/java/com/hfkj/config/SpPrinterTemplate.java b/service/src/main/java/com/hfkj/config/SpPrinterTemplate.java new file mode 100644 index 0000000..e690e52 --- /dev/null +++ b/service/src/main/java/com/hfkj/config/SpPrinterTemplate.java @@ -0,0 +1,81 @@ +package com.hfkj.config; + +import com.hfkj.common.utils.DateUtil; +import com.hfkj.entity.BsMealTableOrder; +import com.hfkj.entity.BsMealTableOrderChild; +import com.hfkj.entity.BsMealTableOrderChildProduct; +import com.hfkj.entity.BsMealTableOrderProduct; +import org.apache.commons.lang3.StringUtils; + +import java.util.Date; +import java.util.List; + +/** + * 商鹏打印机模板 + * @author hurui + */ +public class SpPrinterTemplate { + + + /** + * 扫码点餐,点餐订单 + * @param mealTableOrder 交易订单 + * @param productList 产品列表 + * @return + */ + public static String mealOrder(BsMealTableOrder mealTableOrder, BsMealTableOrderChild mealTableOrderChild,List productList) { + String str = "(点菜单)\n" + + ""+mealTableOrder.getTableName()+"\n" + + "订单号:"+mealTableOrder.getOrderNo() +"\n"+ + "用餐人数:"+mealTableOrder.getPeopleNum()+"人\n" + + "================================\n" + + "品名 数量\n" + + "================================\n"; + for (BsMealTableOrderChildProduct product : productList) { + str+=limitStr(13,product.getProductName())+" "+product.getProductNum()+"\n"; + } + str+="================================\n" + + "备注:" + (mealTableOrderChild.getRemark()==null?"":mealTableOrderChild.getRemark())+"\n" + + "打印时间:" + DateUtil.date2String(new Date(), DateUtil.Y_M_D_HMS) +"\n"; + return str; + } + + /** + * 加油站客户存根模板 + * @param mealTableOrder 交易订单 + * @param productList 产品列表 + * @return + */ + public static String mealOrderBill(BsMealTableOrder mealTableOrder,List productList) { + String str = ""+mealTableOrder.getStoreName()+"\n" + + ""+mealTableOrder.getTableName()+"\n" + + "订单号:"+mealTableOrder.getOrderNo() +"\n"+ + "用餐人数:"+mealTableOrder.getPeopleNum()+"人\n" + + "开台时间:" + DateUtil.date2String(mealTableOrder.getCreateTime(), DateUtil.Y_M_D_HMS) +"\n"+ + "打印时间:" + DateUtil.date2String(new Date(), DateUtil.Y_M_D_HMS) +"\n"+ + "================================\n" + + "品名 数量 单价 金额\n" + + "================================\n"; + for (BsMealTableOrderProduct product : productList) { + str+=limitStr(8,product.getProductName())+" "+product.getProductNum()+" "+product.getProductPrice()+" "+product.getProductTotalPrice()+"\n"; + } + str+="================================\n" + + "合计:"+mealTableOrder.getOrderAmount()+"元\n" + + "--------------------------------\n" + + "谢谢光临,欢迎下次惠顾!\n"; + return str; + } + + private static String limitStr(int limit,String str) { + if (str.length() >= limit) { + return str.substring(0, limit-1); + } + // 补位长度 + int repairLength = limit - str.length(); + for (int i = 0; i < repairLength;i++) { + str+=" "; + } + return str; + } + +} diff --git a/service/src/main/java/com/hfkj/config/WxMaConfig.java b/service/src/main/java/com/hfkj/config/WxMaConfig.java new file mode 100644 index 0000000..e3b4a72 --- /dev/null +++ b/service/src/main/java/com/hfkj/config/WxMaConfig.java @@ -0,0 +1,32 @@ +package com.hfkj.config; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; +import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; +import org.springframework.context.annotation.Configuration; + +import javax.annotation.PostConstruct; + +@Configuration +public class WxMaConfig { + + private static WxMaService maService; + + public static WxMaService getMaService() { + if (maService == null) { + throw new IllegalArgumentException(String.format("未找到对应的配置,请核实!")); + } + + return maService; + } + + @PostConstruct + public void init() { + WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); + config.setAppid(CommonSysConst.getSysConfig().getWechat_ma_appid()); + config.setSecret(CommonSysConst.getSysConfig().getWechat_ma_secret()); + maService = new WxMaServiceImpl(); + maService.setWxMaConfig(config); + } + +} diff --git a/service/src/main/java/com/hfkj/dao/BsMealTableOrderChildMapper.java b/service/src/main/java/com/hfkj/dao/BsMealTableOrderChildMapper.java index f70c5aa..6ce8472 100644 --- a/service/src/main/java/com/hfkj/dao/BsMealTableOrderChildMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsMealTableOrderChildMapper.java @@ -45,18 +45,18 @@ public interface BsMealTableOrderChildMapper extends BsMealTableOrderChildMapper "serial_number, table_number, ", "`table_name`, order_no, ", "child_order_no, child_order_amount, ", - "`status`, create_time, ", - "update_time, ext_1, ", - "ext_2, ext_3)", + "remark, `status`, ", + "create_time, update_time, ", + "ext_1, ext_2, ext_3)", "values (#{merId,jdbcType=BIGINT}, #{merNo,jdbcType=VARCHAR}, ", "#{merName,jdbcType=VARCHAR}, #{merAbbreviate,jdbcType=VARCHAR}, ", "#{storeId,jdbcType=BIGINT}, #{storeName,jdbcType=VARCHAR}, ", "#{serialNumber,jdbcType=VARCHAR}, #{tableNumber,jdbcType=INTEGER}, ", "#{tableName,jdbcType=VARCHAR}, #{orderNo,jdbcType=VARCHAR}, ", "#{childOrderNo,jdbcType=VARCHAR}, #{childOrderAmount,jdbcType=DECIMAL}, ", - "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", - "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{remark,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(BsMealTableOrderChild record); @@ -80,6 +80,7 @@ public interface BsMealTableOrderChildMapper extends BsMealTableOrderChildMapper @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), @Result(column="child_order_no", property="childOrderNo", jdbcType=JdbcType.VARCHAR), @Result(column="child_order_amount", property="childOrderAmount", jdbcType=JdbcType.DECIMAL), + @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @@ -92,8 +93,8 @@ public interface BsMealTableOrderChildMapper extends BsMealTableOrderChildMapper @Select({ "select", "id, mer_id, mer_no, mer_name, mer_abbreviate, store_id, store_name, serial_number, ", - "table_number, `table_name`, order_no, child_order_no, child_order_amount, `status`, ", - "create_time, update_time, ext_1, ext_2, ext_3", + "table_number, `table_name`, order_no, child_order_no, child_order_amount, remark, ", + "`status`, create_time, update_time, ext_1, ext_2, ext_3", "from bs_meal_table_order_child", "where id = #{id,jdbcType=BIGINT}" }) @@ -111,6 +112,7 @@ public interface BsMealTableOrderChildMapper extends BsMealTableOrderChildMapper @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), @Result(column="child_order_no", property="childOrderNo", jdbcType=JdbcType.VARCHAR), @Result(column="child_order_amount", property="childOrderAmount", jdbcType=JdbcType.DECIMAL), + @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @@ -143,6 +145,7 @@ public interface BsMealTableOrderChildMapper extends BsMealTableOrderChildMapper "order_no = #{orderNo,jdbcType=VARCHAR},", "child_order_no = #{childOrderNo,jdbcType=VARCHAR},", "child_order_amount = #{childOrderAmount,jdbcType=DECIMAL},", + "remark = #{remark,jdbcType=VARCHAR},", "`status` = #{status,jdbcType=INTEGER},", "create_time = #{createTime,jdbcType=TIMESTAMP},", "update_time = #{updateTime,jdbcType=TIMESTAMP},", diff --git a/service/src/main/java/com/hfkj/dao/BsMealTableOrderChildSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsMealTableOrderChildSqlProvider.java index eff01e3..2387ddc 100644 --- a/service/src/main/java/com/hfkj/dao/BsMealTableOrderChildSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsMealTableOrderChildSqlProvider.java @@ -76,6 +76,10 @@ public class BsMealTableOrderChildSqlProvider { sql.VALUES("child_order_amount", "#{childOrderAmount,jdbcType=DECIMAL}"); } + if (record.getRemark() != null) { + sql.VALUES("remark", "#{remark,jdbcType=VARCHAR}"); + } + if (record.getStatus() != null) { sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); } @@ -122,6 +126,7 @@ public class BsMealTableOrderChildSqlProvider { sql.SELECT("order_no"); sql.SELECT("child_order_no"); sql.SELECT("child_order_amount"); + sql.SELECT("remark"); sql.SELECT("`status`"); sql.SELECT("create_time"); sql.SELECT("update_time"); @@ -197,6 +202,10 @@ public class BsMealTableOrderChildSqlProvider { sql.SET("child_order_amount = #{record.childOrderAmount,jdbcType=DECIMAL}"); } + if (record.getRemark() != null) { + sql.SET("remark = #{record.remark,jdbcType=VARCHAR}"); + } + if (record.getStatus() != null) { sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); } @@ -242,6 +251,7 @@ public class BsMealTableOrderChildSqlProvider { sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}"); sql.SET("child_order_no = #{record.childOrderNo,jdbcType=VARCHAR}"); sql.SET("child_order_amount = #{record.childOrderAmount,jdbcType=DECIMAL}"); + sql.SET("remark = #{record.remark,jdbcType=VARCHAR}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); @@ -306,6 +316,10 @@ public class BsMealTableOrderChildSqlProvider { sql.SET("child_order_amount = #{childOrderAmount,jdbcType=DECIMAL}"); } + if (record.getRemark() != null) { + sql.SET("remark = #{remark,jdbcType=VARCHAR}"); + } + if (record.getStatus() != null) { sql.SET("`status` = #{status,jdbcType=INTEGER}"); } diff --git a/service/src/main/java/com/hfkj/dao/BsMealTableOrderMapper.java b/service/src/main/java/com/hfkj/dao/BsMealTableOrderMapper.java index a11992c..3402a6d 100644 --- a/service/src/main/java/com/hfkj/dao/BsMealTableOrderMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsMealTableOrderMapper.java @@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.DeleteProvider; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.InsertProvider; +import org.apache.ibatis.annotations.Options; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Results; @@ -38,30 +39,34 @@ public interface BsMealTableOrderMapper extends BsMealTableOrderMapperExt { int deleteByPrimaryKey(Long id); @Insert({ - "insert into bs_meal_table_order (id, mer_id, ", - "mer_no, mer_name, ", - "mer_abbreviate, store_id, ", - "store_name, serial_number, ", - "table_number, `table_name`, ", - "people_num, order_no, ", - "order_amount, `status`, ", - "pay_time, create_time, ", + "insert into bs_meal_table_order (mer_id, mer_no, ", + "mer_name, mer_abbreviate, ", + "store_id, store_name, ", + "serial_number, table_number, ", + "`table_name`, people_num, ", + "order_no, order_amount, ", + "`status`, pay_status, ", + "pay_time, pay_order_no, ", + "pay_price, create_time, ", "update_time, ext_1, ", "ext_2, ext_3)", - "values (#{id,jdbcType=BIGINT}, #{merId,jdbcType=BIGINT}, ", - "#{merNo,jdbcType=VARCHAR}, #{merName,jdbcType=VARCHAR}, ", - "#{merAbbreviate,jdbcType=VARCHAR}, #{storeId,jdbcType=BIGINT}, ", - "#{storeName,jdbcType=VARCHAR}, #{serialNumber,jdbcType=VARCHAR}, ", - "#{tableNumber,jdbcType=INTEGER}, #{tableName,jdbcType=VARCHAR}, ", - "#{peopleNum,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, ", - "#{orderAmount,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER}, ", - "#{payTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, ", + "values (#{merId,jdbcType=BIGINT}, #{merNo,jdbcType=VARCHAR}, ", + "#{merName,jdbcType=VARCHAR}, #{merAbbreviate,jdbcType=VARCHAR}, ", + "#{storeId,jdbcType=BIGINT}, #{storeName,jdbcType=VARCHAR}, ", + "#{serialNumber,jdbcType=VARCHAR}, #{tableNumber,jdbcType=INTEGER}, ", + "#{tableName,jdbcType=VARCHAR}, #{peopleNum,jdbcType=INTEGER}, ", + "#{orderNo,jdbcType=VARCHAR}, #{orderAmount,jdbcType=DECIMAL}, ", + "#{status,jdbcType=INTEGER}, #{payStatus,jdbcType=INTEGER}, ", + "#{payTime,jdbcType=TIMESTAMP}, #{payOrderNo,jdbcType=VARCHAR}, ", + "#{payPrice,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, ", "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) + @Options(useGeneratedKeys=true,keyProperty="id") int insert(BsMealTableOrder record); @InsertProvider(type=BsMealTableOrderSqlProvider.class, method="insertSelective") + @Options(useGeneratedKeys=true,keyProperty="id") int insertSelective(BsMealTableOrder record); @SelectProvider(type=BsMealTableOrderSqlProvider.class, method="selectByExample") @@ -80,7 +85,10 @@ public interface BsMealTableOrderMapper extends BsMealTableOrderMapperExt { @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), @Result(column="order_amount", property="orderAmount", jdbcType=JdbcType.DECIMAL), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="pay_status", property="payStatus", jdbcType=JdbcType.INTEGER), @Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="pay_order_no", property="payOrderNo", jdbcType=JdbcType.VARCHAR), + @Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @@ -92,8 +100,8 @@ public interface BsMealTableOrderMapper extends BsMealTableOrderMapperExt { @Select({ "select", "id, mer_id, mer_no, mer_name, mer_abbreviate, store_id, store_name, serial_number, ", - "table_number, `table_name`, people_num, order_no, order_amount, `status`, pay_time, ", - "create_time, update_time, ext_1, ext_2, ext_3", + "table_number, `table_name`, people_num, order_no, order_amount, `status`, pay_status, ", + "pay_time, pay_order_no, pay_price, create_time, update_time, ext_1, ext_2, ext_3", "from bs_meal_table_order", "where id = #{id,jdbcType=BIGINT}" }) @@ -112,7 +120,10 @@ public interface BsMealTableOrderMapper extends BsMealTableOrderMapperExt { @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), @Result(column="order_amount", property="orderAmount", jdbcType=JdbcType.DECIMAL), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="pay_status", property="payStatus", jdbcType=JdbcType.INTEGER), @Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="pay_order_no", property="payOrderNo", jdbcType=JdbcType.VARCHAR), + @Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @@ -145,7 +156,10 @@ public interface BsMealTableOrderMapper extends BsMealTableOrderMapperExt { "order_no = #{orderNo,jdbcType=VARCHAR},", "order_amount = #{orderAmount,jdbcType=DECIMAL},", "`status` = #{status,jdbcType=INTEGER},", + "pay_status = #{payStatus,jdbcType=INTEGER},", "pay_time = #{payTime,jdbcType=TIMESTAMP},", + "pay_order_no = #{payOrderNo,jdbcType=VARCHAR},", + "pay_price = #{payPrice,jdbcType=DECIMAL},", "create_time = #{createTime,jdbcType=TIMESTAMP},", "update_time = #{updateTime,jdbcType=TIMESTAMP},", "ext_1 = #{ext1,jdbcType=VARCHAR},", diff --git a/service/src/main/java/com/hfkj/dao/BsMealTableOrderSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsMealTableOrderSqlProvider.java index 526ce75..9572b26 100644 --- a/service/src/main/java/com/hfkj/dao/BsMealTableOrderSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsMealTableOrderSqlProvider.java @@ -28,10 +28,6 @@ public class BsMealTableOrderSqlProvider { SQL sql = new SQL(); sql.INSERT_INTO("bs_meal_table_order"); - if (record.getId() != null) { - sql.VALUES("id", "#{id,jdbcType=BIGINT}"); - } - if (record.getMerId() != null) { sql.VALUES("mer_id", "#{merId,jdbcType=BIGINT}"); } @@ -84,10 +80,22 @@ public class BsMealTableOrderSqlProvider { sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); } + if (record.getPayStatus() != null) { + sql.VALUES("pay_status", "#{payStatus,jdbcType=INTEGER}"); + } + if (record.getPayTime() != null) { sql.VALUES("pay_time", "#{payTime,jdbcType=TIMESTAMP}"); } + if (record.getPayOrderNo() != null) { + sql.VALUES("pay_order_no", "#{payOrderNo,jdbcType=VARCHAR}"); + } + + if (record.getPayPrice() != null) { + sql.VALUES("pay_price", "#{payPrice,jdbcType=DECIMAL}"); + } + if (record.getCreateTime() != null) { sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); } @@ -131,7 +139,10 @@ public class BsMealTableOrderSqlProvider { sql.SELECT("order_no"); sql.SELECT("order_amount"); sql.SELECT("`status`"); + sql.SELECT("pay_status"); sql.SELECT("pay_time"); + sql.SELECT("pay_order_no"); + sql.SELECT("pay_price"); sql.SELECT("create_time"); sql.SELECT("update_time"); sql.SELECT("ext_1"); @@ -210,10 +221,22 @@ public class BsMealTableOrderSqlProvider { sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); } + if (record.getPayStatus() != null) { + sql.SET("pay_status = #{record.payStatus,jdbcType=INTEGER}"); + } + if (record.getPayTime() != null) { sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}"); } + if (record.getPayOrderNo() != null) { + sql.SET("pay_order_no = #{record.payOrderNo,jdbcType=VARCHAR}"); + } + + if (record.getPayPrice() != null) { + sql.SET("pay_price = #{record.payPrice,jdbcType=DECIMAL}"); + } + if (record.getCreateTime() != null) { sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); } @@ -256,7 +279,10 @@ public class BsMealTableOrderSqlProvider { sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}"); sql.SET("order_amount = #{record.orderAmount,jdbcType=DECIMAL}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); + sql.SET("pay_status = #{record.payStatus,jdbcType=INTEGER}"); sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}"); + sql.SET("pay_order_no = #{record.payOrderNo,jdbcType=VARCHAR}"); + sql.SET("pay_price = #{record.payPrice,jdbcType=DECIMAL}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); @@ -324,10 +350,22 @@ public class BsMealTableOrderSqlProvider { sql.SET("`status` = #{status,jdbcType=INTEGER}"); } + if (record.getPayStatus() != null) { + sql.SET("pay_status = #{payStatus,jdbcType=INTEGER}"); + } + if (record.getPayTime() != null) { sql.SET("pay_time = #{payTime,jdbcType=TIMESTAMP}"); } + if (record.getPayOrderNo() != null) { + sql.SET("pay_order_no = #{payOrderNo,jdbcType=VARCHAR}"); + } + + if (record.getPayPrice() != null) { + sql.SET("pay_price = #{payPrice,jdbcType=DECIMAL}"); + } + if (record.getCreateTime() != null) { sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); } diff --git a/service/src/main/java/com/hfkj/entity/BsMealTableOrder.java b/service/src/main/java/com/hfkj/entity/BsMealTableOrder.java index afbb8c9..de970ee 100644 --- a/service/src/main/java/com/hfkj/entity/BsMealTableOrder.java +++ b/service/src/main/java/com/hfkj/entity/BsMealTableOrder.java @@ -81,11 +81,26 @@ public class BsMealTableOrder implements Serializable { */ private Integer status; + /** + * 支付状态 1:未支付 2:支付中 3:支付成功 + */ + private Integer payStatus; + /** * 支付时间 */ private Date payTime; + /** + * 支付订单号 + */ + private String payOrderNo; + + /** + * 支付金额 + */ + private BigDecimal payPrice; + /** * 创建时间 */ @@ -216,6 +231,14 @@ public class BsMealTableOrder implements Serializable { this.status = status; } + public Integer getPayStatus() { + return payStatus; + } + + public void setPayStatus(Integer payStatus) { + this.payStatus = payStatus; + } + public Date getPayTime() { return payTime; } @@ -224,6 +247,22 @@ public class BsMealTableOrder implements Serializable { this.payTime = payTime; } + public String getPayOrderNo() { + return payOrderNo; + } + + public void setPayOrderNo(String payOrderNo) { + this.payOrderNo = payOrderNo; + } + + public BigDecimal getPayPrice() { + return payPrice; + } + + public void setPayPrice(BigDecimal payPrice) { + this.payPrice = payPrice; + } + public Date getCreateTime() { return createTime; } @@ -290,7 +329,10 @@ public class BsMealTableOrder implements Serializable { && (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo())) && (this.getOrderAmount() == null ? other.getOrderAmount() == null : this.getOrderAmount().equals(other.getOrderAmount())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) + && (this.getPayStatus() == null ? other.getPayStatus() == null : this.getPayStatus().equals(other.getPayStatus())) && (this.getPayTime() == null ? other.getPayTime() == null : this.getPayTime().equals(other.getPayTime())) + && (this.getPayOrderNo() == null ? other.getPayOrderNo() == null : this.getPayOrderNo().equals(other.getPayOrderNo())) + && (this.getPayPrice() == null ? other.getPayPrice() == null : this.getPayPrice().equals(other.getPayPrice())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) @@ -316,7 +358,10 @@ public class BsMealTableOrder implements Serializable { result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode()); result = prime * result + ((getOrderAmount() == null) ? 0 : getOrderAmount().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); + result = prime * result + ((getPayStatus() == null) ? 0 : getPayStatus().hashCode()); result = prime * result + ((getPayTime() == null) ? 0 : getPayTime().hashCode()); + result = prime * result + ((getPayOrderNo() == null) ? 0 : getPayOrderNo().hashCode()); + result = prime * result + ((getPayPrice() == null) ? 0 : getPayPrice().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); @@ -345,7 +390,10 @@ public class BsMealTableOrder implements Serializable { sb.append(", orderNo=").append(orderNo); sb.append(", orderAmount=").append(orderAmount); sb.append(", status=").append(status); + sb.append(", payStatus=").append(payStatus); sb.append(", payTime=").append(payTime); + sb.append(", payOrderNo=").append(payOrderNo); + sb.append(", payPrice=").append(payPrice); sb.append(", createTime=").append(createTime); sb.append(", updateTime=").append(updateTime); sb.append(", ext1=").append(ext1); diff --git a/service/src/main/java/com/hfkj/entity/BsMealTableOrderChild.java b/service/src/main/java/com/hfkj/entity/BsMealTableOrderChild.java index 700bd25..acdcf32 100644 --- a/service/src/main/java/com/hfkj/entity/BsMealTableOrderChild.java +++ b/service/src/main/java/com/hfkj/entity/BsMealTableOrderChild.java @@ -76,6 +76,11 @@ public class BsMealTableOrderChild implements Serializable { */ private BigDecimal childOrderAmount; + /** + * 备注 + */ + private String remark; + /** * 状态 0:不可用 1:未结账 2:已结账 */ @@ -203,6 +208,14 @@ public class BsMealTableOrderChild implements Serializable { this.childOrderAmount = childOrderAmount; } + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + public Integer getStatus() { return status; } @@ -276,6 +289,7 @@ public class BsMealTableOrderChild implements Serializable { && (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo())) && (this.getChildOrderNo() == null ? other.getChildOrderNo() == null : this.getChildOrderNo().equals(other.getChildOrderNo())) && (this.getChildOrderAmount() == null ? other.getChildOrderAmount() == null : this.getChildOrderAmount().equals(other.getChildOrderAmount())) + && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) @@ -301,6 +315,7 @@ public class BsMealTableOrderChild implements Serializable { result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode()); result = prime * result + ((getChildOrderNo() == null) ? 0 : getChildOrderNo().hashCode()); result = prime * result + ((getChildOrderAmount() == null) ? 0 : getChildOrderAmount().hashCode()); + result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); @@ -329,6 +344,7 @@ public class BsMealTableOrderChild implements Serializable { sb.append(", orderNo=").append(orderNo); sb.append(", childOrderNo=").append(childOrderNo); sb.append(", childOrderAmount=").append(childOrderAmount); + sb.append(", remark=").append(remark); sb.append(", status=").append(status); sb.append(", createTime=").append(createTime); sb.append(", updateTime=").append(updateTime); diff --git a/service/src/main/java/com/hfkj/entity/BsMealTableOrderChildExample.java b/service/src/main/java/com/hfkj/entity/BsMealTableOrderChildExample.java index 891605a..cb43845 100644 --- a/service/src/main/java/com/hfkj/entity/BsMealTableOrderChildExample.java +++ b/service/src/main/java/com/hfkj/entity/BsMealTableOrderChildExample.java @@ -986,6 +986,76 @@ public class BsMealTableOrderChildExample { return (Criteria) this; } + public Criteria andRemarkIsNull() { + addCriterion("remark is null"); + return (Criteria) this; + } + + public Criteria andRemarkIsNotNull() { + addCriterion("remark is not null"); + return (Criteria) this; + } + + public Criteria andRemarkEqualTo(String value) { + addCriterion("remark =", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotEqualTo(String value) { + addCriterion("remark <>", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkGreaterThan(String value) { + addCriterion("remark >", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkGreaterThanOrEqualTo(String value) { + addCriterion("remark >=", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkLessThan(String value) { + addCriterion("remark <", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkLessThanOrEqualTo(String value) { + addCriterion("remark <=", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkLike(String value) { + addCriterion("remark like", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotLike(String value) { + addCriterion("remark not like", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkIn(List values) { + addCriterion("remark in", values, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotIn(List values) { + addCriterion("remark not in", values, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkBetween(String value1, String value2) { + addCriterion("remark between", value1, value2, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotBetween(String value1, String value2) { + addCriterion("remark not between", value1, value2, "remark"); + return (Criteria) this; + } + public Criteria andStatusIsNull() { addCriterion("`status` is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/entity/BsMealTableOrderExample.java b/service/src/main/java/com/hfkj/entity/BsMealTableOrderExample.java index 72eb0a8..b7373bf 100644 --- a/service/src/main/java/com/hfkj/entity/BsMealTableOrderExample.java +++ b/service/src/main/java/com/hfkj/entity/BsMealTableOrderExample.java @@ -1036,6 +1036,66 @@ public class BsMealTableOrderExample { return (Criteria) this; } + public Criteria andPayStatusIsNull() { + addCriterion("pay_status is null"); + return (Criteria) this; + } + + public Criteria andPayStatusIsNotNull() { + addCriterion("pay_status is not null"); + return (Criteria) this; + } + + public Criteria andPayStatusEqualTo(Integer value) { + addCriterion("pay_status =", value, "payStatus"); + return (Criteria) this; + } + + public Criteria andPayStatusNotEqualTo(Integer value) { + addCriterion("pay_status <>", value, "payStatus"); + return (Criteria) this; + } + + public Criteria andPayStatusGreaterThan(Integer value) { + addCriterion("pay_status >", value, "payStatus"); + return (Criteria) this; + } + + public Criteria andPayStatusGreaterThanOrEqualTo(Integer value) { + addCriterion("pay_status >=", value, "payStatus"); + return (Criteria) this; + } + + public Criteria andPayStatusLessThan(Integer value) { + addCriterion("pay_status <", value, "payStatus"); + return (Criteria) this; + } + + public Criteria andPayStatusLessThanOrEqualTo(Integer value) { + addCriterion("pay_status <=", value, "payStatus"); + return (Criteria) this; + } + + public Criteria andPayStatusIn(List values) { + addCriterion("pay_status in", values, "payStatus"); + return (Criteria) this; + } + + public Criteria andPayStatusNotIn(List values) { + addCriterion("pay_status not in", values, "payStatus"); + return (Criteria) this; + } + + public Criteria andPayStatusBetween(Integer value1, Integer value2) { + addCriterion("pay_status between", value1, value2, "payStatus"); + return (Criteria) this; + } + + public Criteria andPayStatusNotBetween(Integer value1, Integer value2) { + addCriterion("pay_status not between", value1, value2, "payStatus"); + return (Criteria) this; + } + public Criteria andPayTimeIsNull() { addCriterion("pay_time is null"); return (Criteria) this; @@ -1096,6 +1156,136 @@ public class BsMealTableOrderExample { return (Criteria) this; } + public Criteria andPayOrderNoIsNull() { + addCriterion("pay_order_no is null"); + return (Criteria) this; + } + + public Criteria andPayOrderNoIsNotNull() { + addCriterion("pay_order_no is not null"); + return (Criteria) this; + } + + public Criteria andPayOrderNoEqualTo(String value) { + addCriterion("pay_order_no =", value, "payOrderNo"); + return (Criteria) this; + } + + public Criteria andPayOrderNoNotEqualTo(String value) { + addCriterion("pay_order_no <>", value, "payOrderNo"); + return (Criteria) this; + } + + public Criteria andPayOrderNoGreaterThan(String value) { + addCriterion("pay_order_no >", value, "payOrderNo"); + return (Criteria) this; + } + + public Criteria andPayOrderNoGreaterThanOrEqualTo(String value) { + addCriterion("pay_order_no >=", value, "payOrderNo"); + return (Criteria) this; + } + + public Criteria andPayOrderNoLessThan(String value) { + addCriterion("pay_order_no <", value, "payOrderNo"); + return (Criteria) this; + } + + public Criteria andPayOrderNoLessThanOrEqualTo(String value) { + addCriterion("pay_order_no <=", value, "payOrderNo"); + return (Criteria) this; + } + + public Criteria andPayOrderNoLike(String value) { + addCriterion("pay_order_no like", value, "payOrderNo"); + return (Criteria) this; + } + + public Criteria andPayOrderNoNotLike(String value) { + addCriterion("pay_order_no not like", value, "payOrderNo"); + return (Criteria) this; + } + + public Criteria andPayOrderNoIn(List values) { + addCriterion("pay_order_no in", values, "payOrderNo"); + return (Criteria) this; + } + + public Criteria andPayOrderNoNotIn(List values) { + addCriterion("pay_order_no not in", values, "payOrderNo"); + return (Criteria) this; + } + + public Criteria andPayOrderNoBetween(String value1, String value2) { + addCriterion("pay_order_no between", value1, value2, "payOrderNo"); + return (Criteria) this; + } + + public Criteria andPayOrderNoNotBetween(String value1, String value2) { + addCriterion("pay_order_no not between", value1, value2, "payOrderNo"); + return (Criteria) this; + } + + public Criteria andPayPriceIsNull() { + addCriterion("pay_price is null"); + return (Criteria) this; + } + + public Criteria andPayPriceIsNotNull() { + addCriterion("pay_price is not null"); + return (Criteria) this; + } + + public Criteria andPayPriceEqualTo(BigDecimal value) { + addCriterion("pay_price =", value, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceNotEqualTo(BigDecimal value) { + addCriterion("pay_price <>", value, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceGreaterThan(BigDecimal value) { + addCriterion("pay_price >", value, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("pay_price >=", value, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceLessThan(BigDecimal value) { + addCriterion("pay_price <", value, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceLessThanOrEqualTo(BigDecimal value) { + addCriterion("pay_price <=", value, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceIn(List values) { + addCriterion("pay_price in", values, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceNotIn(List values) { + addCriterion("pay_price not in", values, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("pay_price between", value1, value2, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("pay_price not between", value1, value2, "payPrice"); + return (Criteria) this; + } + public Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/service/BsTradeOrderService.java b/service/src/main/java/com/hfkj/service/BsTradeOrderService.java index aedc23f..5c1c257 100644 --- a/service/src/main/java/com/hfkj/service/BsTradeOrderService.java +++ b/service/src/main/java/com/hfkj/service/BsTradeOrderService.java @@ -4,6 +4,7 @@ import com.hfkj.entity.BsStoreDiscountActivity; import com.hfkj.entity.BsTradeOrder; import com.hfkj.model.UserDiscount; import com.hfkj.sysenum.PlatformTypeEnum; +import com.hfkj.sysenum.TradeOrderCreateTypeEnum; import com.hfkj.sysenum.TradeOrderMsgTypeEnum; import com.hfkj.sysenum.TradeOrderPayModeEnum; @@ -31,7 +32,7 @@ public interface BsTradeOrderService { * @param tradeAmount 交易金额 * @param param 其他参数 */ - Map createOrder(Long storeId, BigDecimal tradeAmount, BsStoreDiscountActivity storeDiscount, String userPhone, UserDiscount userDiscount, Map param, HttpServletRequest request); + Map createOrder(TradeOrderCreateTypeEnum createType, Long storeId, BigDecimal tradeAmount, BsStoreDiscountActivity storeDiscount, String userPhone, UserDiscount userDiscount, Map param, HttpServletRequest request); /** * 取消订单 diff --git a/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java index cfbfcd8..a1d7669 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java @@ -17,6 +17,7 @@ import com.hfkj.dao.BsTradeOrderMapper; import com.hfkj.entity.*; import com.hfkj.model.UserDiscount; import com.hfkj.service.*; +import com.hfkj.service.meal.BsMealTableOrderService; import com.hfkj.service.rebate.BsRebateActivityAccountService; import com.hfkj.service.rebate.BsRebateActivityService; import com.hfkj.service.rebate.model.RebateActivityAccountTradeObject; @@ -39,9 +40,6 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService { @Resource private BsMerService merService; - @Resource - private BsSalesmanService salesmanService; - @Resource private BsStoreCidService bsStoreCidService; @@ -69,6 +67,10 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService { @Resource private RedisUtil redisUtil; + + @Resource + private BsMealTableOrderService mealTableOrderService; + private final static String TRADE_ORDER = "TRADE_ORDER:"; @Override @@ -86,7 +88,7 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService { } @Override - public Map createOrder(Long storeId, BigDecimal tradeAmount, BsStoreDiscountActivity storeDiscount, String userPhone, UserDiscount userDiscount, Map param, HttpServletRequest request) { + public Map createOrder(TradeOrderCreateTypeEnum createType, Long storeId, BigDecimal tradeAmount, BsStoreDiscountActivity storeDiscount, String userPhone, UserDiscount userDiscount, Map param, HttpServletRequest request) { // 查询门店信息 BsStore store = storeService.getStoreById(storeId); if (store == null) { @@ -105,7 +107,7 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService { } BsTradeOrder tradeOrder = new BsTradeOrder(); - tradeOrder.setCreateType(TradeOrderCreateTypeEnum.type1.getCode()); + tradeOrder.setCreateType(createType.getCode()); tradeOrder.setCompanyId(mer.getCompanyId()); tradeOrder.setAgentId(mer.getAgentId()); tradeOrder.setSalesmanId(mer.getSalesmanId()); @@ -221,6 +223,15 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService { tradeOrder.setTransType(MapUtils.getString(param, "transType")); } + + if (StringUtils.isNotBlank(MapUtils.getString(param, "payNotifyUrl"))) { + tradeOrder.setPayNotifyUrl(MapUtils.getString(param, "payNotifyUrl")); + } + + if (StringUtils.isNotBlank(MapUtils.getString(param, "sub_appid"))) { + tradeOrder.setPayAppid(MapUtils.getString(param, "sub_appid")); + } + editOrder(tradeOrder); @@ -447,6 +458,11 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService { soundService.sendPayMsg(device.getDeviceNo(), tradeOrder.getTradeAmount()); } + // 处理不同类型的业务 + if (tradeOrder.getCreateType().equals(TradeOrderCreateTypeEnum.type4.getCode())) { + mealTableOrderService.paySuccess(tradeOrder); + } + if (tradeOrder.getStoreDiscountId() != null && StringUtils.isNotBlank(tradeOrder.getUserPhone())) { // 支付返积分 HsgIntegralService.rebate(RebateProductTypeEnum.type2, @@ -480,8 +496,8 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService { tradeOrder.getCreateTime()); } + // APP消息 JSONObject objectPush = new JSONObject(); - objectPush.put("storeId" , tradeOrder.getStoreId()); objectPush.put("price" , tradeOrder.getTradeAmount()); bsStoreCidService.storePush(objectPush); diff --git a/service/src/main/java/com/hfkj/service/meal/BsMealTableOrderChildProductService.java b/service/src/main/java/com/hfkj/service/meal/BsMealTableOrderChildProductService.java index 3a4ef66..9058bbf 100644 --- a/service/src/main/java/com/hfkj/service/meal/BsMealTableOrderChildProductService.java +++ b/service/src/main/java/com/hfkj/service/meal/BsMealTableOrderChildProductService.java @@ -1,6 +1,9 @@ package com.hfkj.service.meal; -import com.hfkj.entity.BsMealTableOrderChild; +import com.hfkj.entity.BsMealTableOrderChildProduct; + +import java.util.List; +import java.util.Map; /** * @className: BsMealTableOrderChildProductService @@ -13,6 +16,13 @@ public interface BsMealTableOrderChildProductService { * 编辑数据 * @param data */ - void editData(BsMealTableOrderChild data); + void editData(BsMealTableOrderChildProduct data); + + /** + * 查询产品列表 + * @param param + * @return + */ + List getProductList(Map param); } diff --git a/service/src/main/java/com/hfkj/service/meal/BsMealTableOrderChildService.java b/service/src/main/java/com/hfkj/service/meal/BsMealTableOrderChildService.java index 24168f9..c8cedc4 100644 --- a/service/src/main/java/com/hfkj/service/meal/BsMealTableOrderChildService.java +++ b/service/src/main/java/com/hfkj/service/meal/BsMealTableOrderChildService.java @@ -25,7 +25,6 @@ public interface BsMealTableOrderChildService { * @param userIdentity * @return */ - void createChildOrder(String serialNumber, String userIdentity); - + void createChildOrder(String serialNumber, String remark, String userIdentity); } 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 a59a8aa..be1e232 100644 --- a/service/src/main/java/com/hfkj/service/meal/BsMealTableOrderService.java +++ b/service/src/main/java/com/hfkj/service/meal/BsMealTableOrderService.java @@ -1,6 +1,8 @@ package com.hfkj.service.meal; +import com.alibaba.fastjson.JSONArray; import com.hfkj.entity.BsMealTableOrder; +import com.hfkj.entity.BsTradeOrder; /** * @className: BsMealTableOrderService @@ -22,4 +24,30 @@ public interface BsMealTableOrderService { */ BsMealTableOrder getCurrentTableOrder(String serialNumber); + /** + * 查询订单 + * @param orderNo + * @return + */ + BsMealTableOrder getTableOrderByOrderNo(String orderNo); + + /** + * 查询订单 + * @param payOrderNo + * @return + */ + BsMealTableOrder getTableOrderByPayOrderNo(String payOrderNo); + + /** + * 支付成功 + * @param tradeOrder + */ + void paySuccess(BsTradeOrder tradeOrder); + + /** + * 操作订单产品 + * @param orderNo + * @param productArray + */ + void operateOrderProduct(String orderNo, JSONArray productArray); } diff --git a/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableOrderChildProductServiceImpl.java b/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableOrderChildProductServiceImpl.java new file mode 100644 index 0000000..ef79f72 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableOrderChildProductServiceImpl.java @@ -0,0 +1,53 @@ +package com.hfkj.service.meal.impl; + +import com.hfkj.dao.BsMealTableOrderChildMapper; +import com.hfkj.dao.BsMealTableOrderChildProductMapper; +import com.hfkj.entity.BsMealTableOrderChild; +import com.hfkj.entity.BsMealTableOrderChildProduct; +import com.hfkj.entity.BsMealTableOrderChildProductExample; +import com.hfkj.service.meal.BsMealTableOrderChildProductService; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @className: BsMealTableOrderChildProductServiceImpl + * @author: HuRui + * @date: 2023/12/11 + **/ +@Service("mealTableOrderChildProductService") +public class BsMealTableOrderChildProductServiceImpl implements BsMealTableOrderChildProductService { + + @Resource + private BsMealTableOrderChildProductMapper mealTableOrderChildProductMapper; + + @Override + public void editData(BsMealTableOrderChildProduct data) { + if (data.getId() == null) { + data.setCreateTime(new Date()); + data.setUpdateTime(new Date()); + mealTableOrderChildProductMapper.insert(data); + } else { + data.setUpdateTime(new Date()); + mealTableOrderChildProductMapper.updateByPrimaryKeySelective(data); + } + } + + @Override + public List getProductList(Map param) { + BsMealTableOrderChildProductExample example = new BsMealTableOrderChildProductExample(); + BsMealTableOrderChildProductExample.Criteria criteria = example.createCriteria(); + + if (StringUtils.isNotBlank(MapUtils.getString(param, "childOrderNo"))) { + criteria.andChildOrderNoEqualTo(MapUtils.getString(param, "childOrderNo")); + } + + example.setOrderByClause("create_time desc"); + return mealTableOrderChildProductMapper.selectByExample(example); + } +} 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 460c774..72a73f7 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 @@ -7,6 +7,8 @@ import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; import com.hfkj.common.utils.GenerateUtil; +import com.hfkj.config.SpPrinterConfig; +import com.hfkj.config.SpPrinterTemplate; import com.hfkj.config.mqtt.MqttProviderService; import com.hfkj.dao.BsMealTableOrderChildMapper; import com.hfkj.dao.BsMealTableOrderChildProductMapper; @@ -15,6 +17,7 @@ import com.hfkj.entity.*; import com.hfkj.service.BsDeviceService; import com.hfkj.service.group.BsStoreGroupService; import com.hfkj.service.meal.*; +import com.hfkj.sysenum.DeviceTypeEnum; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -73,17 +76,17 @@ public class BsMealTableOrderChildServiceImpl implements BsMealTableOrderChildSe @Override @Transactional(propagation= Propagation.REQUIRES_NEW) - public void createChildOrder(String serialNumber, String userIdentity) { - String lockKey = "MEAL_SHOP_CART_" + serialNumber; + public void createChildOrder(String serialNumber, String remark, String userIdentity) { + // 查询当前开台订单 + BsMealTableOrder tableOrder = mealTableOrderService.getCurrentTableOrder(serialNumber); + if (tableOrder == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "桌台未开台,订单创建失败!"); + } + String lockKey = "MEAL_ORDER_" + tableOrder.getOrderNo(); try { Boolean lock = redisTemplate.opsForValue().setIfAbsent(lockKey, null); if(lock) { // 加锁成功 - // 查询当前开台订单 - BsMealTableOrder tableOrder = mealTableOrderService.getCurrentTableOrder(serialNumber); - if (tableOrder == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "桌台未开台,订单创建失败!"); - } BsMealTableOrderChild tableOrderChild = new BsMealTableOrderChild(); tableOrderChild.setMerId(tableOrder.getMerId()); tableOrderChild.setMerNo(tableOrder.getMerNo()); @@ -98,6 +101,7 @@ public class BsMealTableOrderChildServiceImpl implements BsMealTableOrderChildSe tableOrderChild.setChildOrderNo(System.currentTimeMillis()+ GenerateUtil.generateRandomString(1)); tableOrderChild.setChildOrderAmount(new BigDecimal("0")); tableOrderChild.setStatus(1); + tableOrderChild.setRemark(remark); editData(tableOrderChild); List childProductList = new ArrayList<>(); @@ -115,11 +119,11 @@ public class BsMealTableOrderChildServiceImpl implements BsMealTableOrderChildSe BsMealTableOrderProduct orderProduct = mealTableOrderProductService.getOrderProduct(tableOrder.getOrderNo(), cartProduct.getProductId()); if (orderProduct == null) { orderProduct = new BsMealTableOrderProduct(); - orderProduct.setOrderId(tableOrderChild.getStoreId()); - orderProduct.setOrderNo(tableOrderChild.getStoreName()); + orderProduct.setOrderId(tableOrder.getId()); + orderProduct.setOrderNo(tableOrder.getOrderNo()); orderProduct.setProductCategoryId(cartProduct.getProductCategoryId()); orderProduct.setProductCategoryName(cartProduct.getProductCategoryName()); - orderProduct.setProductId(cartProduct.getId()); + orderProduct.setProductId(cartProduct.getProductId()); orderProduct.setProductImg(cartProduct.getProductImg()); orderProduct.setProductName(cartProduct.getProductName()); orderProduct.setProductSpec(cartProduct.getProductSpec()); @@ -141,7 +145,7 @@ public class BsMealTableOrderChildServiceImpl implements BsMealTableOrderChildSe childProduct.setChildOrderNo(tableOrderChild.getChildOrderNo()); childProduct.setProductCategoryId(cartProduct.getProductCategoryId()); childProduct.setProductCategoryName(cartProduct.getProductCategoryName()); - childProduct.setProductId(cartProduct.getId()); + childProduct.setProductId(cartProduct.getProductId()); childProduct.setProductImg(cartProduct.getProductImg()); childProduct.setProductName(cartProduct.getProductName()); childProduct.setProductSpec(cartProduct.getProductSpec()); @@ -174,29 +178,22 @@ public class BsMealTableOrderChildServiceImpl implements BsMealTableOrderChildSe pushParam.put("productList", new JSONArray()); mqttProviderService.publish(2, false, "MEAL_TABLE_" + serialNumber, JSONObject.toJSONString(pushParam)); - // todo 打印小票 - - - - - - - - - - - - - - - + // TODO 打印小票 + Map deviceParam = new HashMap<>(); + deviceParam.put("storeId", tableOrder.getStoreId()); + deviceParam.put("deviceType", DeviceTypeEnum.type3.getNumber()); + List deviceList = deviceService.getDeviceList(deviceParam); + for (BsDevice device : deviceList) { + 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, userIdentity); + createChildOrder(serialNumber, remark, userIdentity); } } catch (BaseException baseException) { redisTemplate.delete(lockKey); diff --git a/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableOrderProductServiceImpl.java b/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableOrderProductServiceImpl.java index 255ea91..e8ec72d 100644 --- a/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableOrderProductServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/meal/impl/BsMealTableOrderProductServiceImpl.java @@ -53,7 +53,7 @@ public class BsMealTableOrderProductServiceImpl implements BsMealTableOrderProdu @Override public BsMealTableOrderProduct getOrderProduct(String orderNo, Long productId) { BsMealTableOrderProductExample example = new BsMealTableOrderProductExample(); - example.createCriteria().andOrderNoEqualTo(orderNo).andStatusNotEqualTo(0); + example.createCriteria().andOrderNoEqualTo(orderNo).andProductIdEqualTo(productId).andStatusNotEqualTo(0); List list = mealTableOrderProductMapper.selectByExample(example); if (!list.isEmpty()) { return list.get(0); 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 f3d4325..ae72634 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 @@ -1,16 +1,30 @@ package com.hfkj.service.meal.impl; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hfkj.common.exception.BaseException; +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.config.SpPrinterConfig; +import com.hfkj.config.SpPrinterTemplate; import com.hfkj.dao.BsMealTableOrderMapper; -import com.hfkj.entity.BsMealTableOrder; -import com.hfkj.entity.BsMealTableOrderExample; -import com.hfkj.service.meal.BsMealTableOrderService; +import com.hfkj.entity.*; +import com.hfkj.service.BsDeviceService; +import com.hfkj.service.group.BsStoreGroupService; +import com.hfkj.service.meal.*; +import com.hfkj.sysenum.DeviceTypeEnum; +import com.hfkj.sysenum.MealTableOrderPayStatusEnum; import com.hfkj.sysenum.MealTableOrderStatusEnum; -import com.hfkj.sysenum.MealTableStatusEnum; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.Date; -import java.util.List; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.*; /** * @className: BsMealTableOrderServiceImpl @@ -23,6 +37,22 @@ public class BsMealTableOrderServiceImpl implements BsMealTableOrderService { @Resource private BsMealTableOrderMapper mealTableOrderMapper; + @Resource + private BsMealTableOrderProductService mealTableOrderProductService; + + @Resource + private BsMealTableService mealTableService; + + @Resource + private BsStoreGroupService storeGroupService; + + @Resource + private BsDeviceService deviceService; + + + @Resource + private RedisTemplate redisTemplate; + @Override public void editData(BsMealTableOrder mealTableOrder) { if (mealTableOrder.getId() == null) { @@ -47,4 +77,111 @@ public class BsMealTableOrderServiceImpl implements BsMealTableOrderService { } return null; } + + @Override + public BsMealTableOrder getTableOrderByOrderNo(String orderNo) { + BsMealTableOrderExample example = new BsMealTableOrderExample(); + example.createCriteria().andOrderNoEqualTo(orderNo); + List orderList = mealTableOrderMapper.selectByExample(example); + if (!orderList.isEmpty()) { + return orderList.get(0); + } + return null; + } + + @Override + public BsMealTableOrder getTableOrderByPayOrderNo(String payOrderNo) { + BsMealTableOrderExample example = new BsMealTableOrderExample(); + example.createCriteria().andPayOrderNoEqualTo(payOrderNo); + List orderList = mealTableOrderMapper.selectByExample(example); + if (!orderList.isEmpty()) { + return orderList.get(0); + } + return null; + } + + @Override + public void paySuccess(BsTradeOrder tradeOrder) { + // 查询订单详情 + BsMealTableOrder mealTableOrder = getTableOrderByPayOrderNo(tradeOrder.getOutTradeNo()); + if (mealTableOrder != null) { + // 关台 + mealTableService.endTable(mealTableOrder.getSerialNumber()); + } + } + + @Override + @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) + public void operateOrderProduct(String orderNo, JSONArray productArray) { + // 查询订单 + BsMealTableOrder order = getTableOrderByOrderNo(orderNo); + if (order == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "未知的的订单号"); + } + String lockKey = "MEAL_ORDER_" + order.getOrderNo(); + try { + Boolean lock = redisTemplate.opsForValue().setIfAbsent(lockKey, null); + if(lock) { + // 加锁成功 + // 操作类型 1:添加 2:减少 + for (Object obj : productArray) { + JSONObject product = (JSONObject) obj; + // 查询产品 + BsStoreProduct storeProduct = storeGroupService.findStoreProduct(product.getLong("productId")); + if (storeProduct == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "未知的的产品"); + } + // 查询交易订单中的产品 + BsMealTableOrderProduct orderProduct = mealTableOrderProductService.getOrderProduct(orderNo, storeProduct.getId()); + if (orderProduct == null) { + orderProduct = new BsMealTableOrderProduct(); + orderProduct.setOrderId(order.getId()); + orderProduct.setOrderNo(order.getOrderNo()); + orderProduct.setProductCategoryId(storeProduct.getProductCategoryId()); + orderProduct.setProductCategoryName(storeProduct.getProductCategoryName()); + orderProduct.setProductId(storeProduct.getId()); + orderProduct.setProductImg(storeProduct.getImg()); + orderProduct.setProductName(storeProduct.getName()); + orderProduct.setProductSpec(storeProduct.getSpec()); + orderProduct.setProductPrice(storeProduct.getPrice()); + orderProduct.setProductNum(product.getInteger("number")); + orderProduct.setProductTotalPrice(new BigDecimal(orderProduct.getProductNum().toString()).multiply(orderProduct.getProductPrice())); + orderProduct.setStatus(1); + } else { + if (product.getInteger("number") <= 0) { + orderProduct.setStatus(0); + } + orderProduct.setProductNum(product.getInteger("number")); + orderProduct.setProductTotalPrice(new BigDecimal(orderProduct.getProductNum().toString()).multiply(orderProduct.getProductPrice())); + } + mealTableOrderProductService.editData(orderProduct); + } + // 重新计算交易总价 + order.setOrderAmount(new BigDecimal("0")); + + Map param = new HashMap<>(); + param.put("orderNo", order.getOrderNo()); + List orderProductList = mealTableOrderProductService.getOrderProductList(param); + for (BsMealTableOrderProduct product : orderProductList) { + order.setOrderAmount(order.getOrderAmount().add(product.getProductTotalPrice())); + } + editData(order); + + redisTemplate.delete(lockKey); + + } else { + System.out.println("加锁失败"); + Thread.sleep(100); // 加锁失败,重试 + operateOrderProduct(orderNo, productArray); + } + } catch (BaseException baseException) { + redisTemplate.delete(lockKey); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, baseException.getErrorMsg()); + + } catch (Exception e) { + redisTemplate.delete(lockKey); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知错误"); + } + + } } 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 0ac18c9..b436076 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 @@ -9,12 +9,16 @@ import com.hfkj.common.utils.DateUtil; import com.hfkj.common.utils.GenerateUtil; import com.hfkj.common.utils.IDGenerator; import com.hfkj.config.CommonSysConst; +import com.hfkj.config.SpPrinterConfig; +import com.hfkj.config.SpPrinterTemplate; import com.hfkj.dao.BsMealTableMapper; import com.hfkj.entity.*; import com.hfkj.model.MerBasisModel; import com.hfkj.service.BsDeviceService; import com.hfkj.service.BsMerService; import com.hfkj.service.BsStoreService; +import com.hfkj.service.meal.BsMealShopCartService; +import com.hfkj.service.meal.BsMealTableOrderProductService; import com.hfkj.service.meal.BsMealTableOrderService; import com.hfkj.service.meal.BsMealTableService; import com.hfkj.sysenum.*; @@ -26,11 +30,9 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.io.IOException; import java.math.BigDecimal; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Random; +import java.util.*; /** * @className: BsMealTableServiceImpl @@ -52,6 +54,12 @@ public class BsMealTableServiceImpl implements BsMealTableService { @Resource private BsMealTableOrderService mealTableOrderService; + @Resource + private BsMealTableOrderProductService mealTableOrderProductService; + + @Resource + private BsMealShopCartService mealShopCartService; + @Resource private BsDeviceService deviceService; @@ -211,6 +219,7 @@ public class BsMealTableServiceImpl implements BsMealTableService { order.setOrderNo(DateUtil.format(new Date(), DateUtil.YMDHMS) + IDGenerator.nextId(10)); order.setOrderAmount(new BigDecimal("0")); order.setStatus(MealTableOrderStatusEnum.status1.getNumber()); + order.setPayStatus(MealTableOrderPayStatusEnum.status1.getNumber()); mealTableOrderService.editData(order); } @@ -232,11 +241,31 @@ public class BsMealTableServiceImpl implements BsMealTableService { BsMealTableOrder tableOrder = mealTableOrderService.getCurrentTableOrder(serialNumber); if (tableOrder != null) { tableOrder.setStatus(MealTableOrderStatusEnum.status2.getNumber()); + tableOrder.setPayStatus(MealTableOrderPayStatusEnum.status2.getNumber()); tableOrder.setPayTime(new Date()); mealTableOrderService.editData(tableOrder); - // TODO 打印小票订单 + // 清空购物车 + mealShopCartService.clearData(tableOrder.getSerialNumber()); + // 订单产品 + Map orderProductMap = new HashMap<>(); + orderProductMap.put("orderNo", tableOrder.getOrderNo()); + List productList = mealTableOrderProductService.getOrderProductList(orderProductMap); + + // 打印小票 + Map deviceParam = new HashMap<>(); + deviceParam.put("storeId", tableOrder.getStoreId()); + deviceParam.put("deviceType", DeviceTypeEnum.type3.getNumber()); + List deviceList = deviceService.getDeviceList(deviceParam); + for (BsDevice device : deviceList) { + SpPrinterConfig sp = new SpPrinterConfig(); + try { + sp.print(device.getDeviceNo(), SpPrinterTemplate.mealOrderBill(tableOrder, productList), 1); + } catch (IOException e) { + throw new RuntimeException(e); + } + } } } } diff --git a/service/src/main/java/com/hfkj/sysenum/DeviceTypeEnum.java b/service/src/main/java/com/hfkj/sysenum/DeviceTypeEnum.java index c5c7585..f8e849a 100644 --- a/service/src/main/java/com/hfkj/sysenum/DeviceTypeEnum.java +++ b/service/src/main/java/com/hfkj/sysenum/DeviceTypeEnum.java @@ -9,6 +9,7 @@ import java.util.Objects; public enum DeviceTypeEnum { type1(1, "4G收款音响"), type2(2, "桌码(支付码)"), + type3(3, "小票打印机"), ; private Integer number; diff --git a/service/src/main/java/com/hfkj/sysenum/MealTableOrderPayStatusEnum.java b/service/src/main/java/com/hfkj/sysenum/MealTableOrderPayStatusEnum.java new file mode 100644 index 0000000..146e685 --- /dev/null +++ b/service/src/main/java/com/hfkj/sysenum/MealTableOrderPayStatusEnum.java @@ -0,0 +1,51 @@ +package com.hfkj.sysenum; + +import java.util.Objects; + +/** + * @className: MealTableOrderStatus + * @author: HuRui + * @date: 2023/11/30 + **/ +public enum MealTableOrderPayStatusEnum { + + status1(1, "待支付"), + status2(2, "支付中"), + status3(3, "已支付"), + ; + + private Integer number; + + private String name; + + MealTableOrderPayStatusEnum(int number, String name) { + this.number = number; + this.name = name; + } + + public static MealTableOrderPayStatusEnum getDataByNumber(Integer number) { + for (MealTableOrderPayStatusEnum ele : values()) { + if (Objects.equals(number,ele.getNumber())) { + return ele; + } + } + return null; + } + + + public Integer getNumber() { + return number; + } + + public void setNumber(Integer number) { + this.number = number; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/service/src/main/java/com/hfkj/sysenum/TradeOrderCreateTypeEnum.java b/service/src/main/java/com/hfkj/sysenum/TradeOrderCreateTypeEnum.java index 583bd01..93a518a 100644 --- a/service/src/main/java/com/hfkj/sysenum/TradeOrderCreateTypeEnum.java +++ b/service/src/main/java/com/hfkj/sysenum/TradeOrderCreateTypeEnum.java @@ -11,7 +11,8 @@ import java.util.Objects; public enum TradeOrderCreateTypeEnum { type1(1, "扫一扫"), type2(2, "被扫"), - type3(3, "API"); + type3(3, "API"), + type4(4, "扫码点餐"); private Integer code; diff --git a/service/src/main/resources/dev/commonConfig.properties b/service/src/main/resources/dev/commonConfig.properties index f8d9a83..a90b75d 100644 --- a/service/src/main/resources/dev/commonConfig.properties +++ b/service/src/main/resources/dev/commonConfig.properties @@ -1,6 +1,9 @@ wechat_mp_appid=wxa075e8509802f826 wechat_mp_secret=0e606fc1378d35e359fcf3f15570b2c5 +wechat_ma_appid=wxff3cbb14f62d026d +wechat_ma_secret=f6ae84c8bbf8a702f88a064e96918c09 + obs_bucket_name=gratia-pay-test obs_end_point=https://obs.cn-east-3.myhuaweicloud.com obs_url=https://gratia-pay-test.obs.cn-east-3.myhuaweicloud.com @@ -48,13 +51,18 @@ lkl_saas_public_key=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAUkzRA+4GOS5OzYqxD/UJ lkl_saas_private_key=MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMBSTNED7gY5Lk7NirEP9QnAzqn22jV0+960v/tFsxr3ejjqpOg+U+1pbrUS9uU6V0dwEQejsAZdcqYhivu3ZSnU9kLSDtQymej9vlaRPqJ4nrTVet66PyGHJ/b/Gh6Pm+mLj/6UCv1gX7kZzJpV/iB/NM0muYqP09+9fkHetQfZAgMBAAECgYB42D3kaC+8QVnTsluffoNeKYSyT6Y1SNiqy7CGVvl/zFlEQkx0khVybHlf1hbFWq9U+Bn7TuNgXH+Z3CHUoRwy4Ap/kMx637iRatoC8F/kcPaiB7JFQfdrxhgK858dSyHCQ2OXXQDJgJdth+oF9FylVsrDu5Sw3ha4OuzrmufuwQJBAPnPPSeFr1wu7kH6I+A5E49fMbAm7EU+3TYVzxNH1lr3X/LWuK9pi/LVPrSR4eNgAypyQWREIqdpBIiJ9bOnwa0CQQDFFl0zTQTVTWf5r/hwgCUMo4gHr2y/q7XMNe6n5fh4SQuQ+o4gW+BGHzDrT97G5hFGPL+w5niGuEBHWSo5/9xdAkEAnrxdM7vzDjSUGUCFg3lBQJ1QyYoyIF4t2qxJBQtk3jDKu1hNysjasNdoHP2F+CGOYW5wtvHEw3Qr+UcQ5bP3kQJABPAcga6KUnXQBxd7mAX956UpQVgJ13uL4IPxaM+APDNIUOeWLAVhRyB870hfAoi9Ig9fliUQG//9zEvVnQJmGQJBAOb8Z0mGMEbEeAyEKjqoNiQkkIcoBdmPKNFUoUJ6ohcBNOoMfklvNsf2+BPfuhs26tvhYDBRgCAfOVhqTQcGj6I= # TianQue config -tianque_request_url=https://openapi-test.tianquetech.com -tianque_org_id=00205462 -tianque_private_key=MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQD7amtTqsq2cKBv5YpAL49dEXyx76LB2c6G9tGPfOVBk5skOxmII1bFIvUyrQsmLtM+sRg0tzi6EXBu40YW7scTKqe6UA1XHSVYHvooDL1P6E3luJu0eNh7x2yiS8vqq4v8xceRVjXBf1aBe/bPuEqG3W1v76Gw8PqNn+QUeLQrv6QCYBJC5I3Vg2AHrN4udFKnzvIZjV92gx/D9FWTpwU338I1Mw5twRbCCu8f91kmRsOa9atWbN3kM/fZI+uzaEFf9soolKNfhlP7Qhbm0/e6sciv6UDHgpSuXNl/uCYDxZ9YsSyUTJR0Ep+M7l8b4AITFjyE26jqSkUYHcGBRy5ZAgMBAAECggEAfCMMgVA4LSKpJPbab1zMVbC3uAfRfhO0NNGToVySufFOzfHcZmrEgiwDk5T7h0vhg/ffMtAw0zafJDFVvycA5obOMGEsZRIACWWqMLIxm03hgIbJYq+0fFF4Yx43vlQbl6B0LF+7xSHBrcdukxu0uKiGS5mvZXVm0RzcefsrQtmvcGFMcAAeC34aBMOnA/rfSGU82aKoy5A4WcAUSU8r6fOwQMV3aUsyI1z3QbG0RJeE1qPNAs/cVjSVlepLo0BgmePl4DDmBP21AOxnoE70XbVJdFEYGjiF/A1bZID5DEo0rqnvWCUQdWaBUT1QwDFoMITv7CgsaQyG1rlKewaJ/QKBgQD/y7qCsQjpKLHR8Y1tTIDOPedaJTaysWVadTxaVAtjlWnik1V5q+VHtOYN/14p7X587CtTD5MiN6PHRjAWTPHIr8Y87Z2ipqljscDkZb5sOsN3RzriZERLg8bcB6GRlcHkeNUNGLpBPTObIvpWTLvL+mnt4cTF/1ck2li/fX/fywKBgQD7ncutu6QK7FAlkGjX3cBSTT76sBOJYZe7LmvsJJBM+7nmly3/WO1OF/dAFrWqTXjP6PTtCPQ1+z2/kNtgJLJMJVPYeTZauq9OfT+4Ls1318vEr9KXSm/E3rTZLmpxSzgKEzDoYVeyrPh0QdaWvaP5k3BUGl3Scd5cHJKsxshd6wKBgAq+wyH0T9yDghzAmeFKgmqnfQ1zXL3a59gJ7rQYrbXMM/t5lvCagPInLjbOUGVQfay/uv4tPFAGqFGZqDF3n/x/LcOnc6S+fYUblW/CumIPgeCD1HxoG9pUOclKZMYZ1WBElyaKsGBHMuDEcmGnrYffCA4fGsX6eO2qYmoA2ptLAoGBALpQTdGHcCDmezJVjEzL1u0aZdgbKVxA96mS5jclm/RlMXKd32GE57M768l5B2vjkeHiDfq29p5CO6buDINUqPHZcgyJNMZaFhV4iQZJIbvr/ubVioqcg8azYhavWAIsQIK1UzG/YsDbc94iIlPceN8FXdfo7jA2QQDT54goaZWhAoGAQPk/qXBTzJzE6yeDVSC6edYzrVMRTqqNR70HgSY+7GqDsNWb+9otKUkyhCSDOMT8GOFQzNqPRgPBC9LD/Jf8owPExjdl3x/lmmnnc+WeaYyPYpbRuaz1eMmsCLXBMcPmLgj+xOp7J/xtLFGXTfIk7ozRDGJ2BFUJvBOUFLSSNeY= -tianque_public_key=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCOmsrFtFPTnEzfpJ/hDl5RODBxw4i9Ex3NmmG/N7A1+by032zZZgLLpdNh8y5otjFY0E37Nyr4FGKFRSSuDiTk8vfx3pv6ImS1Rxjjg4qdVHIfqhCeB0Z2ZPuBD3Gbj8hHFEtXZq8+msAFu/5ZQjiVhgs5WWBjh54LYWSum+d9+wIDAQAB +# tianque_request_url=https://openapi-test.tianquetech.com +# tianque_org_id=00205462 +# tianque_private_key=MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQD7amtTqsq2cKBv5YpAL49dEXyx76LB2c6G9tGPfOVBk5skOxmII1bFIvUyrQsmLtM+sRg0tzi6EXBu40YW7scTKqe6UA1XHSVYHvooDL1P6E3luJu0eNh7x2yiS8vqq4v8xceRVjXBf1aBe/bPuEqG3W1v76Gw8PqNn+QUeLQrv6QCYBJC5I3Vg2AHrN4udFKnzvIZjV92gx/D9FWTpwU338I1Mw5twRbCCu8f91kmRsOa9atWbN3kM/fZI+uzaEFf9soolKNfhlP7Qhbm0/e6sciv6UDHgpSuXNl/uCYDxZ9YsSyUTJR0Ep+M7l8b4AITFjyE26jqSkUYHcGBRy5ZAgMBAAECggEAfCMMgVA4LSKpJPbab1zMVbC3uAfRfhO0NNGToVySufFOzfHcZmrEgiwDk5T7h0vhg/ffMtAw0zafJDFVvycA5obOMGEsZRIACWWqMLIxm03hgIbJYq+0fFF4Yx43vlQbl6B0LF+7xSHBrcdukxu0uKiGS5mvZXVm0RzcefsrQtmvcGFMcAAeC34aBMOnA/rfSGU82aKoy5A4WcAUSU8r6fOwQMV3aUsyI1z3QbG0RJeE1qPNAs/cVjSVlepLo0BgmePl4DDmBP21AOxnoE70XbVJdFEYGjiF/A1bZID5DEo0rqnvWCUQdWaBUT1QwDFoMITv7CgsaQyG1rlKewaJ/QKBgQD/y7qCsQjpKLHR8Y1tTIDOPedaJTaysWVadTxaVAtjlWnik1V5q+VHtOYN/14p7X587CtTD5MiN6PHRjAWTPHIr8Y87Z2ipqljscDkZb5sOsN3RzriZERLg8bcB6GRlcHkeNUNGLpBPTObIvpWTLvL+mnt4cTF/1ck2li/fX/fywKBgQD7ncutu6QK7FAlkGjX3cBSTT76sBOJYZe7LmvsJJBM+7nmly3/WO1OF/dAFrWqTXjP6PTtCPQ1+z2/kNtgJLJMJVPYeTZauq9OfT+4Ls1318vEr9KXSm/E3rTZLmpxSzgKEzDoYVeyrPh0QdaWvaP5k3BUGl3Scd5cHJKsxshd6wKBgAq+wyH0T9yDghzAmeFKgmqnfQ1zXL3a59gJ7rQYrbXMM/t5lvCagPInLjbOUGVQfay/uv4tPFAGqFGZqDF3n/x/LcOnc6S+fYUblW/CumIPgeCD1HxoG9pUOclKZMYZ1WBElyaKsGBHMuDEcmGnrYffCA4fGsX6eO2qYmoA2ptLAoGBALpQTdGHcCDmezJVjEzL1u0aZdgbKVxA96mS5jclm/RlMXKd32GE57M768l5B2vjkeHiDfq29p5CO6buDINUqPHZcgyJNMZaFhV4iQZJIbvr/ubVioqcg8azYhavWAIsQIK1UzG/YsDbc94iIlPceN8FXdfo7jA2QQDT54goaZWhAoGAQPk/qXBTzJzE6yeDVSC6edYzrVMRTqqNR70HgSY+7GqDsNWb+9otKUkyhCSDOMT8GOFQzNqPRgPBC9LD/Jf8owPExjdl3x/lmmnnc+WeaYyPYpbRuaz1eMmsCLXBMcPmLgj+xOp7J/xtLFGXTfIk7ozRDGJ2BFUJvBOUFLSSNeY= +# tianque_public_key=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCOmsrFtFPTnEzfpJ/hDl5RODBxw4i9Ex3NmmG/N7A1+by032zZZgLLpdNh8y5otjFY0E37Nyr4FGKFRSSuDiTk8vfx3pv6ImS1Rxjjg4qdVHIfqhCeB0Z2ZPuBD3Gbj8hHFEtXZq8+msAFu/5ZQjiVhgs5WWBjh54LYWSum+d9+wIDAQAB tianque_micro_pay_ret_url=https://gratia-pay.dctpay.com/crest/tianqueNotify/microPay tianque_open_api_pay_notify_url=https://gratia-pay.dctpay.com/openApi/v1/payNotify/tianque +tianque_request_url=https://openapi.tianquetech.com +tianque_org_id=65749201 +tianque_private_key=MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDlAa7Xw1w16H6xmZgxwEN+UPm72s7PisVkbWFbDexeqQkpSvrouHVswte1qlQyOivhZU21KbuklCOMAuJ4/kcZJ4KlvSckzpAnOrFmA7M3x76zK+GWmOfgHvT208XAGx9mjh5mXHmOUZcyhXmgMnHMQdwTUi0vdk2ni/yHQqBUK1fH8jGI5eWwuzP6oSu7/gqaF/vZyF7TP0dvjgDPuDI6iMRVb4At10yxcZIvFTKuKsMksf2YKgtlvhidvHicnr93RksclSaVbw9VjuXrdYd1hlLJson3xTUr+l96aGMfefiK94f0Jrx81zWqD7BaKtgdE+x0VXPuaM0Tv5HBdCHxAgMBAAECggEABeX9MuF9RoYufTSPjvh8xIwhYo1INmBEpUmL8GRzahzAd6fOvp/BpoN+OtegQ4rsBmotjjT8+Eg4giqw2pzyB9vUqaAtme0YGWqRlycRPqaOat7+eHqHvmYNuS3LMh+At4uBjPFk0B2Z31tAvreN5szrdjPvpgFODrq0TmeQ6ZoHtSTYM90zkhH7NyDKBbul4d0XkjDuE1Y/vN1FkTXxJI0FV76HxCgckPj3Jd3cut1S9Prhwvx9sMWjWiy6rd6m9AR6d+31GJVzYeXz6Y3/cG6MFrDO/bVc8oK5ltjNFPEkz28b04LKmFZhAHBFqEuLC5jFYOqciJVcpkPaGQ3RYQKBgQD8DW+5+N0az5l2p1w5CniFhva3rk92jOZKxHvoPGpwA6qlhGGn96gqdTpjY5gAonaGiJbjwnubProe9JafSnOP2Pj3yfLfhp4CtkoDk1bvBZJUW3CWTOHWPsT8Xae6wZ8qd7hkjRoHqf5Ub+0JyA/h/CfYLZS1Xtf5i5G4Gk/rBwKBgQDol9kC+zIhIc5vgfrDmZwGDwn/H0N7pYpDx23vjesgeKmpnrj9al+ODUW5SOjIYYjjsQ8ot51Zg+65YsQNGPFuTbSu3OHRl4emzmJVrfjVVsehbYPR676R5zEgJOIIjqeU9r9AH60lLuhy/7SIJyfNAgL7wUtxo+djXGzinXK1RwKBgGwaJy0P+2SgXSVyqi8cuowqUm59KD+kNrEijDISl2PrbqkGmgu8QDfVh3FRKcQ76bHRq0WMCA+RW6ojJOa0u9OaL023I5+S0PpAzIW0D7j8HsJnZWZRGxsUWNAUKvgCSw2fw0n86okW86mrR3LGh2lZCI3DHuCbCO5SWfEn99bJAoGAdM81tDKVJWCF/Sgo2Ky/V6eb3J1F1cX4Hzv7sQ/z4nXWtxG4U8RlQsDVoEzGY0PgbIESXN+BzV/dtwqr7Ov26+9oa10Qp6LTBGmnpuHdEr8nOKH4Tqd3KG0UFdGQFr4V2VDmEX0XBpJ9OKvEbZBEg8eb2fVkPykSXqsfH9v0rKcCgYEAmRagAvycwGeD0hGehj6gRYegt4NqcU895Ce7J85u9QrO03Wn7l77ToktCcl9GRI7ZZwJOzCIsUntoGJHc3VbXnio7qixdm4oYo4TvNV3lUI1NKisszrFJCCXemZHeesW3t3RFzYwDGX/MJrBw7q8qsAnio0fc0ubcNVc67LNZ38= +tianque_public_key=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjo1+KBcvwDSIo+nMYLeOJ19Ju4ii0xH66ZxFd869EWFWk/EJa3xIA2+4qGf/Ic7m7zi/NHuCnfUtUDmUdP0JfaZiYwn+1Ek7tYAOc1+1GxhzcexSJLyJlR2JLMfEM+rZooW4Ei7q3a8jdTWUNoak/bVPXnLEVLrbIguXABERQ0Ze0X9Fs0y/zkQFg8UjxUN88g2CRfMC6LldHm7UBo+d+WlpOYH7u0OTzoLLiP/04N1cfTgjjtqTBI7qkOGxYs6aBZHG1DJ6WdP+5w+ho91sBTVajsCxAaMoExWQM2ipf/1qGdsWmkZScPflBqg7m0olOD87ymAVP/3Tcbvi34bDfwIDAQAB + wechat_pay_notify_url=https://gratia-pay.dctpay.com/crest/weiXinNotify/jsapiPay file_url=/home/project/gratia-pay/file diff --git a/service/src/main/resources/prod-9606/commonConfig.properties b/service/src/main/resources/prod-9606/commonConfig.properties index 501c779..eb8999a 100644 --- a/service/src/main/resources/prod-9606/commonConfig.properties +++ b/service/src/main/resources/prod-9606/commonConfig.properties @@ -1,3 +1,9 @@ +wechat_mp_appid=wxa075e8509802f826 +wechat_mp_secret=0e606fc1378d35e359fcf3f15570b2c5 + +wechat_ma_appid=wxff3cbb14f62d026d +wechat_ma_secret=f6ae84c8bbf8a702f88a064e96918c09 + obs_bucket_name=gratia-pay obs_end_point=https://obs.cn-southwest-2.myhuaweicloud.com obs_url=https://gratia-pay.obs.cn-southwest-2.myhuaweicloud.com diff --git a/service/src/main/resources/prod/commonConfig.properties b/service/src/main/resources/prod/commonConfig.properties index 2e9e6c3..5350723 100644 --- a/service/src/main/resources/prod/commonConfig.properties +++ b/service/src/main/resources/prod/commonConfig.properties @@ -1,3 +1,9 @@ +wechat_mp_appid=wxa075e8509802f826 +wechat_mp_secret=0e606fc1378d35e359fcf3f15570b2c5 + +wechat_ma_appid=wxff3cbb14f62d026d +wechat_ma_secret=f6ae84c8bbf8a702f88a064e96918c09 + obs_bucket_name=gratia-pay obs_end_point=https://obs.cn-southwest-2.myhuaweicloud.com obs_url=https://gratia-pay.obs.cn-southwest-2.myhuaweicloud.com