From 1eec59a4c3d68801792fa958eeb2bb82142ae78c Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 20 Dec 2023 17:48:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cweb/controller/TestController.java | 15 +++ .../meal/BsMealTableOrderController.java | 21 ++++ .../meal/BsMealTableOrderPayController.java | 2 + .../hfkj/channel/llg/config/LLGConfig.java | 14 +++ .../channel/llg/service/LLGOrderService.java | 92 +++++++++++++++ .../com/hfkj/channel/llg/util/AesUtil.java | 105 ++++++++++++++++++ .../com/hfkj/common/utils/HttpsUtils.java | 56 ++++++++++ .../com/hfkj/dao/BsMealTableOrderMapper.java | 40 ++++--- .../hfkj/dao/BsMealTableOrderSqlProvider.java | 14 +++ .../com/hfkj/entity/BsMealTableOrder.java | 16 +++ .../hfkj/entity/BsMealTableOrderExample.java | 70 ++++++++++++ .../hfkj/openapi/v1/utils/SignatureUtil.java | 39 ++++++- .../impl/BsMealTableOrderServiceImpl.java | 4 + 13 files changed, 464 insertions(+), 24 deletions(-) create mode 100644 service/src/main/java/com/hfkj/channel/llg/config/LLGConfig.java create mode 100644 service/src/main/java/com/hfkj/channel/llg/service/LLGOrderService.java create mode 100644 service/src/main/java/com/hfkj/channel/llg/util/AesUtil.java diff --git a/cweb/src/main/java/com/cweb/controller/TestController.java b/cweb/src/main/java/com/cweb/controller/TestController.java index cb34ef9..9c31c73 100644 --- a/cweb/src/main/java/com/cweb/controller/TestController.java +++ b/cweb/src/main/java/com/cweb/controller/TestController.java @@ -7,6 +7,7 @@ import com.hfkj.channel.lakala.LaKaLaLedgerService; import com.hfkj.channel.lakala.LaKaLaTradeService; import com.hfkj.channel.lakala.LaKaLaWalletService; import com.hfkj.channel.lakala.config.LaKaLaConfig; +import com.hfkj.channel.llg.service.LLGOrderService; import com.hfkj.channel.saas.SaasActivityService; import com.hfkj.channel.saas.SaasMerService; import com.hfkj.channel.saas.utils.SaasCommon; @@ -831,4 +832,18 @@ public class TestController { } } + + @RequestMapping(value="/LLG",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "LLG") + public ResponseData LLG(@RequestParam(name = "code", required = false) String code) { + try { + + return ResponseMsgUtil.success(LLGOrderService.createOrder()); + + } catch (Exception e) { + log.error(e.getMessage(), 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 72dae72..1a9a38e 100644 --- a/cweb/src/main/java/com/cweb/controller/meal/BsMealTableOrderController.java +++ b/cweb/src/main/java/com/cweb/controller/meal/BsMealTableOrderController.java @@ -167,6 +167,27 @@ public class BsMealTableOrderController { } } + @RequestMapping(value="/queryUserOrderList",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询用户订单列表") + public ResponseData queryUserOrderList(@RequestParam(value = "userId" , required = true) String userId, + @RequestParam(value = "orderNo" , required = false) String orderNo, + @RequestParam(value = "pageNum" , required = true) Integer pageNum, + @RequestParam(value = "pageSize" , required = true) Integer pageSize) { + try { + Map param = new HashMap<>(); + param.put("userId", userId); + param.put("orderNo", orderNo); + + PageHelper.startPage(pageNum, pageSize); + return ResponseMsgUtil.success(new PageInfo<>(mealTableOrderService.getTableOrderList(param))); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/cweb/src/main/java/com/cweb/controller/meal/BsMealTableOrderPayController.java b/cweb/src/main/java/com/cweb/controller/meal/BsMealTableOrderPayController.java index b1fa163..11a8501 100644 --- a/cweb/src/main/java/com/cweb/controller/meal/BsMealTableOrderPayController.java +++ b/cweb/src/main/java/com/cweb/controller/meal/BsMealTableOrderPayController.java @@ -100,6 +100,7 @@ public class BsMealTableOrderPayController { // 设置支付状态 tableOrder.setPayOrderNo(MapUtils.getString(orderMap, "outTradeNo")); tableOrder.setPayStatus(MealTableOrderPayStatusEnum.status2.getNumber()); + tableOrder.setUserId(body.getString("payUserId")); mealTableOrderService.editData(tableOrder); @@ -118,6 +119,7 @@ public class BsMealTableOrderPayController { // 设置支付状态 tableOrder.setPayOrderNo(MapUtils.getString(orderMap, "outTradeNo")); tableOrder.setPayStatus(MealTableOrderPayStatusEnum.status2.getNumber()); + tableOrder.setUserId(body.getString("payUserId")); mealTableOrderService.editData(tableOrder); redisTemplate.delete(lockKey); diff --git a/service/src/main/java/com/hfkj/channel/llg/config/LLGConfig.java b/service/src/main/java/com/hfkj/channel/llg/config/LLGConfig.java new file mode 100644 index 0000000..bb688a8 --- /dev/null +++ b/service/src/main/java/com/hfkj/channel/llg/config/LLGConfig.java @@ -0,0 +1,14 @@ +package com.hfkj.channel.llg.config; + +/** + * 零零购 + * @className: LLGConfig + * @author: HuRui + * @date: 2023/12/19 + **/ +public class LLGConfig { + + public static final String requestUrl = "https://abcd.zjdt.cc"; + public static final String key = "BMKp20Omcv9u7TqGAhydCw63"; + +} diff --git a/service/src/main/java/com/hfkj/channel/llg/service/LLGOrderService.java b/service/src/main/java/com/hfkj/channel/llg/service/LLGOrderService.java new file mode 100644 index 0000000..634e779 --- /dev/null +++ b/service/src/main/java/com/hfkj/channel/llg/service/LLGOrderService.java @@ -0,0 +1,92 @@ +package com.hfkj.channel.llg.service; + +import com.alibaba.fastjson.JSONObject; +import com.hfkj.channel.llg.config.LLGConfig; +import com.hfkj.channel.llg.util.AesUtil; +import com.hfkj.common.utils.HttpsUtils; + +import java.math.BigDecimal; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +/** + * 零零购分期 + * 交易订单业务 + * @className: LLGOrderService + * @author: HuRui + * @date: 2023/12/19 + **/ +public class LLGOrderService { + + /** + * 获取银行列表 + * @param merId 商户号 + * @param period 分期期数 + * @return + * @throws Exception + */ + public static JSONObject getBanks(String merId,Integer period) { + return HttpsUtils.doGet(LLGConfig.requestUrl + "/v3/openapi/banks?merId=" + merId + "&period=" + period); + } + + /** + * 创建订单 + * @return 分期支付地址 + * @throws Exception + */ + public static String createOrder() throws Exception { + Map param = new HashMap<>(); + param.put("merId", "109"); + param.put("marketId", "135"); + param.put("pkgId", "54"); + param.put("bankId", "52"); + param.put("orderId", System.currentTimeMillis()); + param.put("nickPrice", "100"); + param.put("payType", "02"); + param.put("period", "06"); + param.put("phoneName", "测试"); + param.put("backUrl", false); // 回调地址 + param.put("frontUrl", false); // 前端跳转地址 + param.put("qrcode", false); + + String dataStr = AesUtil.aesEncrypt(LLGConfig.key, JSONObject.toJSONString(param)); + URL url = new URL(LLGConfig.requestUrl + "/v3/openapi/order/create?data="+ dataStr); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + // GET请求方式 + connection.setRequestMethod("GET"); + // 设置不使用缓存, 默认为 true 使用缓存 + connection.setUseCaches(false); + // 设置单次请求是否支持重定向,默认为 setFollowRedirects 方法设置的值 + connection.setInstanceFollowRedirects(false); + // 设置是否进行重定向,注意此处为 静态方法,表示所有的请求都不支持重定向,默认为true + connection.setFollowRedirects(false); + + connection.getContent(); + // 获取重定向地址 + return "https:" + connection.getHeaderField("Location"); + } + + /** + * 创建订单 + * @return 分期支付地址 + * @throws Exception + */ + public static JSONObject createOrder(Long merId, String orderId, String payType, BigDecimal txnAmt) throws Exception { + Map param = new HashMap<>(); + param.put("merId", merId); + param.put("orderId", orderId); + param.put("payType", payType); + param.put("txnAmt", txnAmt); + + String dataStr = AesUtil.aesEncrypt(LLGConfig.key, JSONObject.toJSONString(param)); + JSONObject response = HttpsUtils.doGet(LLGConfig.requestUrl + "/v3/openapi/order/paycheck?data=" + dataStr); + if (response == null) { + + } + + return response; + } + +} diff --git a/service/src/main/java/com/hfkj/channel/llg/util/AesUtil.java b/service/src/main/java/com/hfkj/channel/llg/util/AesUtil.java new file mode 100644 index 0000000..8b246c4 --- /dev/null +++ b/service/src/main/java/com/hfkj/channel/llg/util/AesUtil.java @@ -0,0 +1,105 @@ +package com.hfkj.channel.llg.util; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; + +/** + * @className: AesUtil + * @author: HuRui + * @date: 2023/12/19 + **/ +public class AesUtil { + + private static final String CHARSET = "UTF-8"; + private static final String KEY_ALGORITHM = "AES"; + /**默认的加密算法 aes-192-cbc*/ + private static final String DEFAULT_CIPHER_ALGORITHM = "AES/CBC/PKCS5Padding"; + //private static final String IV_PARAMETER_SPEC_STRING = "0000000000000000"; + //对应nodejs的buffer.alloc(16,0) + private static final byte[] IV_PARAMETER_SPEC_BYTE = new byte[]{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00}; + private static final Integer RADIX = 16; + + public static void main(String[] args) { + String testStr =""; + String aesKey = "BMKp20Omcv9u7TqGAhydCw63";//密钥 + try { + /* String aesEncrypt = aesEncrypt(aesKey, testStr); + System.out.println("========success:===488944dc7dca74786f21fe9b98420038=================="); + System.out.println(aesEncrypt);*/ + String aesEncryptStr = "61be322b8f6afb254888109c67cc39619214e9a62eccca1dfee72461e025b9a4"; + String aesDecrypt = aesDecrypt(aesKey, aesEncryptStr); + System.out.println(aesDecrypt); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * AES 加密操作 + * + * @param aesKey 密钥 + * @param data 待加密内容 + * @return 加密数据 + */ + public static String aesEncrypt(String aesKey, String data) throws Exception { + return byte2HexString(encrypt(aesKey.getBytes(CHARSET), data.getBytes(CHARSET))); + } + + /** + * AES 解密操作 + * + * @param aesKey 密钥 + * @param data 待解密内容 + * @return 解密数据 + */ + public static final String aesDecrypt(String aesKey, String data) throws Exception { + return new String(decrypt(aesKey.getBytes(CHARSET), hexString2Byte(data)), CHARSET); + } + + private static byte[] decrypt(byte[] key, byte[] data) throws Exception { + SecretKeySpec secretKeySpec = new SecretKeySpec(key, KEY_ALGORITHM); + Cipher cipher = Cipher.getInstance(DEFAULT_CIPHER_ALGORITHM); + IvParameterSpec iv = new IvParameterSpec(IV_PARAMETER_SPEC_BYTE); + cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, iv); + return cipher.doFinal(data); + } + + private static byte[] hexString2Byte(String hexString) { + hexString = hexString.toUpperCase(); + int length = hexString.length() / 2; + char[] hexChars = hexString.toCharArray(); + byte[] b = new byte[length]; + for (int i = 0; i < length; i++) { + int pos = i * 2; + b[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); + } + return b; + } + + private static String byte2HexString(byte[] src) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < src.length; i++) { + int v = src[i] & 0xff; + String hv = Integer.toHexString(v); + if (hv.length() < 2) { + sb.append("0"); + } + sb.append(hv); + } + return sb.toString(); + } + + private static byte charToByte(char c) { + return (byte) "0123456789ABCDEF".indexOf(c); + } + + private static byte[] encrypt(byte[] key, byte[] data) throws Exception { + SecretKeySpec secretKeySpec = new SecretKeySpec(key, KEY_ALGORITHM); + Cipher cipher = Cipher.getInstance(DEFAULT_CIPHER_ALGORITHM); + IvParameterSpec iv = new IvParameterSpec(IV_PARAMETER_SPEC_BYTE); + cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, iv); + return cipher.doFinal(data); + } + +} diff --git a/service/src/main/java/com/hfkj/common/utils/HttpsUtils.java b/service/src/main/java/com/hfkj/common/utils/HttpsUtils.java index 194221c..6477467 100644 --- a/service/src/main/java/com/hfkj/common/utils/HttpsUtils.java +++ b/service/src/main/java/com/hfkj/common/utils/HttpsUtils.java @@ -126,6 +126,7 @@ public class HttpsUtils { InputStream instream = entity.getContent(); result = IOUtils.toString(instream, "UTF-8"); } + System.out.println(result); return JSON.parseObject(result); } catch (Exception e) { log.error(e.getMessage(),e); @@ -880,6 +881,61 @@ public class HttpsUtils { return null; } + + /** + * Saas 请求 + * @param url + * @param params + * @param headers + * @return + */ + public static String doLLGGet(String url, Map params , Map headers) { + String apiUrl = url; + StringBuffer param = new StringBuffer(); + + int i = 0; + for (String key : params.keySet()) { + if (i == 0) + param.append("?"); + else + param.append("&"); + param.append(key).append("=").append(params.get(key)); + i++; + } + + apiUrl += param; + String result = null; + HttpClient httpClient = null; + try { + + if (apiUrl.startsWith("https")) { + httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) + .setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); + } else { + httpClient = HttpClients.createDefault(); + } + + HttpGet httpGet = new HttpGet(apiUrl); + for (Map.Entry e : headers.entrySet()) { + httpGet.addHeader(e.getKey(), e.getValue().toString()); + } + HttpResponse response = httpClient.execute(httpGet); + String location = Arrays.toString(response.getHeaders("Location")); + System.out.println("----------------url:" + location); + HttpEntity entity = response.getEntity(); + if (entity != null) { + InputStream instream = entity.getContent(); + result = IOUtils.toString(instream, "UTF-8"); + } + System.out.println(result); + return result; + } catch (Exception e) { + log.error(e.getMessage(),e); + } + return null; + } + + public static SSLConnectionSocketFactory readCertificate(String mchId) { try { KeyStore keyStore = KeyStore.getInstance("PKCS12"); diff --git a/service/src/main/java/com/hfkj/dao/BsMealTableOrderMapper.java b/service/src/main/java/com/hfkj/dao/BsMealTableOrderMapper.java index 3402a6d..13826a8 100644 --- a/service/src/main/java/com/hfkj/dao/BsMealTableOrderMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsMealTableOrderMapper.java @@ -42,25 +42,25 @@ public interface BsMealTableOrderMapper extends BsMealTableOrderMapperExt { "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)", + "serial_number, user_id, ", + "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 (#{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})" + "#{serialNumber,jdbcType=VARCHAR}, #{userId,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); @@ -79,6 +79,7 @@ public interface BsMealTableOrderMapper extends BsMealTableOrderMapperExt { @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), @Result(column="store_name", property="storeName", jdbcType=JdbcType.VARCHAR), @Result(column="serial_number", property="serialNumber", jdbcType=JdbcType.VARCHAR), + @Result(column="user_id", property="userId", jdbcType=JdbcType.VARCHAR), @Result(column="table_number", property="tableNumber", jdbcType=JdbcType.INTEGER), @Result(column="table_name", property="tableName", jdbcType=JdbcType.VARCHAR), @Result(column="people_num", property="peopleNum", jdbcType=JdbcType.INTEGER), @@ -100,8 +101,9 @@ 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_status, ", - "pay_time, pay_order_no, pay_price, create_time, update_time, ext_1, ext_2, ext_3", + "user_id, 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}" }) @@ -114,6 +116,7 @@ public interface BsMealTableOrderMapper extends BsMealTableOrderMapperExt { @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), @Result(column="store_name", property="storeName", jdbcType=JdbcType.VARCHAR), @Result(column="serial_number", property="serialNumber", jdbcType=JdbcType.VARCHAR), + @Result(column="user_id", property="userId", jdbcType=JdbcType.VARCHAR), @Result(column="table_number", property="tableNumber", jdbcType=JdbcType.INTEGER), @Result(column="table_name", property="tableName", jdbcType=JdbcType.VARCHAR), @Result(column="people_num", property="peopleNum", jdbcType=JdbcType.INTEGER), @@ -150,6 +153,7 @@ public interface BsMealTableOrderMapper extends BsMealTableOrderMapperExt { "store_id = #{storeId,jdbcType=BIGINT},", "store_name = #{storeName,jdbcType=VARCHAR},", "serial_number = #{serialNumber,jdbcType=VARCHAR},", + "user_id = #{userId,jdbcType=VARCHAR},", "table_number = #{tableNumber,jdbcType=INTEGER},", "`table_name` = #{tableName,jdbcType=VARCHAR},", "people_num = #{peopleNum,jdbcType=INTEGER},", diff --git a/service/src/main/java/com/hfkj/dao/BsMealTableOrderSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsMealTableOrderSqlProvider.java index 9572b26..f2f2aac 100644 --- a/service/src/main/java/com/hfkj/dao/BsMealTableOrderSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsMealTableOrderSqlProvider.java @@ -56,6 +56,10 @@ public class BsMealTableOrderSqlProvider { sql.VALUES("serial_number", "#{serialNumber,jdbcType=VARCHAR}"); } + if (record.getUserId() != null) { + sql.VALUES("user_id", "#{userId,jdbcType=VARCHAR}"); + } + if (record.getTableNumber() != null) { sql.VALUES("table_number", "#{tableNumber,jdbcType=INTEGER}"); } @@ -133,6 +137,7 @@ public class BsMealTableOrderSqlProvider { sql.SELECT("store_id"); sql.SELECT("store_name"); sql.SELECT("serial_number"); + sql.SELECT("user_id"); sql.SELECT("table_number"); sql.SELECT("`table_name`"); sql.SELECT("people_num"); @@ -197,6 +202,10 @@ public class BsMealTableOrderSqlProvider { sql.SET("serial_number = #{record.serialNumber,jdbcType=VARCHAR}"); } + if (record.getUserId() != null) { + sql.SET("user_id = #{record.userId,jdbcType=VARCHAR}"); + } + if (record.getTableNumber() != null) { sql.SET("table_number = #{record.tableNumber,jdbcType=INTEGER}"); } @@ -273,6 +282,7 @@ public class BsMealTableOrderSqlProvider { sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}"); sql.SET("store_name = #{record.storeName,jdbcType=VARCHAR}"); sql.SET("serial_number = #{record.serialNumber,jdbcType=VARCHAR}"); + sql.SET("user_id = #{record.userId,jdbcType=VARCHAR}"); sql.SET("table_number = #{record.tableNumber,jdbcType=INTEGER}"); sql.SET("`table_name` = #{record.tableName,jdbcType=VARCHAR}"); sql.SET("people_num = #{record.peopleNum,jdbcType=INTEGER}"); @@ -326,6 +336,10 @@ public class BsMealTableOrderSqlProvider { sql.SET("serial_number = #{serialNumber,jdbcType=VARCHAR}"); } + if (record.getUserId() != null) { + sql.SET("user_id = #{userId,jdbcType=VARCHAR}"); + } + if (record.getTableNumber() != null) { sql.SET("table_number = #{tableNumber,jdbcType=INTEGER}"); } diff --git a/service/src/main/java/com/hfkj/entity/BsMealTableOrder.java b/service/src/main/java/com/hfkj/entity/BsMealTableOrder.java index de970ee..96e8c9c 100644 --- a/service/src/main/java/com/hfkj/entity/BsMealTableOrder.java +++ b/service/src/main/java/com/hfkj/entity/BsMealTableOrder.java @@ -51,6 +51,11 @@ public class BsMealTableOrder implements Serializable { */ private String serialNumber; + /** + * 用户id + */ + private String userId; + /** * 桌子编号 */ @@ -183,6 +188,14 @@ public class BsMealTableOrder implements Serializable { this.serialNumber = serialNumber; } + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + public Integer getTableNumber() { return tableNumber; } @@ -323,6 +336,7 @@ public class BsMealTableOrder implements Serializable { && (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId())) && (this.getStoreName() == null ? other.getStoreName() == null : this.getStoreName().equals(other.getStoreName())) && (this.getSerialNumber() == null ? other.getSerialNumber() == null : this.getSerialNumber().equals(other.getSerialNumber())) + && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) && (this.getTableNumber() == null ? other.getTableNumber() == null : this.getTableNumber().equals(other.getTableNumber())) && (this.getTableName() == null ? other.getTableName() == null : this.getTableName().equals(other.getTableName())) && (this.getPeopleNum() == null ? other.getPeopleNum() == null : this.getPeopleNum().equals(other.getPeopleNum())) @@ -352,6 +366,7 @@ public class BsMealTableOrder implements Serializable { result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode()); result = prime * result + ((getStoreName() == null) ? 0 : getStoreName().hashCode()); result = prime * result + ((getSerialNumber() == null) ? 0 : getSerialNumber().hashCode()); + result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); result = prime * result + ((getTableNumber() == null) ? 0 : getTableNumber().hashCode()); result = prime * result + ((getTableName() == null) ? 0 : getTableName().hashCode()); result = prime * result + ((getPeopleNum() == null) ? 0 : getPeopleNum().hashCode()); @@ -384,6 +399,7 @@ public class BsMealTableOrder implements Serializable { sb.append(", storeId=").append(storeId); sb.append(", storeName=").append(storeName); sb.append(", serialNumber=").append(serialNumber); + sb.append(", userId=").append(userId); sb.append(", tableNumber=").append(tableNumber); sb.append(", tableName=").append(tableName); sb.append(", peopleNum=").append(peopleNum); diff --git a/service/src/main/java/com/hfkj/entity/BsMealTableOrderExample.java b/service/src/main/java/com/hfkj/entity/BsMealTableOrderExample.java index b7373bf..1ffd2be 100644 --- a/service/src/main/java/com/hfkj/entity/BsMealTableOrderExample.java +++ b/service/src/main/java/com/hfkj/entity/BsMealTableOrderExample.java @@ -656,6 +656,76 @@ public class BsMealTableOrderExample { return (Criteria) this; } + public Criteria andUserIdIsNull() { + addCriterion("user_id is null"); + return (Criteria) this; + } + + public Criteria andUserIdIsNotNull() { + addCriterion("user_id is not null"); + return (Criteria) this; + } + + public Criteria andUserIdEqualTo(String value) { + addCriterion("user_id =", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotEqualTo(String value) { + addCriterion("user_id <>", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThan(String value) { + addCriterion("user_id >", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThanOrEqualTo(String value) { + addCriterion("user_id >=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThan(String value) { + addCriterion("user_id <", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThanOrEqualTo(String value) { + addCriterion("user_id <=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLike(String value) { + addCriterion("user_id like", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotLike(String value) { + addCriterion("user_id not like", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdIn(List values) { + addCriterion("user_id in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotIn(List values) { + addCriterion("user_id not in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdBetween(String value1, String value2) { + addCriterion("user_id between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotBetween(String value1, String value2) { + addCriterion("user_id not between", value1, value2, "userId"); + return (Criteria) this; + } + public Criteria andTableNumberIsNull() { addCriterion("table_number is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/openapi/v1/utils/SignatureUtil.java b/service/src/main/java/com/hfkj/openapi/v1/utils/SignatureUtil.java index 123150b..5d1acf5 100644 --- a/service/src/main/java/com/hfkj/openapi/v1/utils/SignatureUtil.java +++ b/service/src/main/java/com/hfkj/openapi/v1/utils/SignatureUtil.java @@ -83,17 +83,44 @@ public class SignatureUtil { } public static void main(String[] args) throws Exception { - String paramStr = "{\n" + - " \"merchantNo\": \"2023041916292112804\",\n" + - " \"outTradeNo\": \"ZF1130202305051459532538971022\",\n" + + /*String paramStr = "{\n" + + " \"merchantNo\": \"2023121813322612707\",\n" + + " \"outTradeNo\": \"ZF1130202312190004\",\n" + " \"payMode\": \"ALIPAY\",\n" + - " \"totalAmount\": 0.01,\n" + + " \"totalAmount\": 1,\n" + " \"transType\": \"NATIVE\",\n" + - " \"profitSharing\": 0,\n" + + " \"profitSharing\": 1,\n" + " \"specialField\": \"测试\"" + + "}";*/ +/* String paramStr = "{\n" + + " \"merchantNo\": \"2023121813322612707\",\n" + + " \"outSeparateNo\": \"1530202305190001\",\n" + + " \"outTradeNo\": \"ZF1130202312190004\",\n" + + " \"totalAmount\": \"0.01\",\n" + + " \"recvDatas\": [\n" + + " {\n" + + " \"recvMerchantNo\": \"2023121811484863205\",\n" + + " \"separateAmount\": \"0.01\"\n" + + " }\n" + + " ]" + + "}";*/ + + +/* + String paramStr = "{\n" + + " \"merchantNo\": \"2023121813322612707\",\n" + + " \"outSeparateNo\": \"1530202305190001\"" + + "}";*/ + + String paramStr = "{\n" + + " \"merchantNo\": \"2023121813322612707\",\n" + + " \"outTradeNo\": \"ZF1130202312190004\",\n" + + " \"refundAmount\": \"1\",\n" + + " \"refundReason\": \"测试退款\",\n" + + " \"refundTradeNo\": \"1170202312190001\"" + "}"; - String sign = createSign(JSONObject.parseObject(paramStr), "2jLO2WjXcSRSzTCaca0Kmv0OFrfYBbrA"); + String sign = createSign(JSONObject.parseObject(paramStr), "7ub4JCbyExtW4ragz6FO6bGkVnuV7cUp"); System.out.println(sign); } 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 82cd57a..a169b2f 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 @@ -111,6 +111,10 @@ public class BsMealTableOrderServiceImpl implements BsMealTableOrderService { criteria.andStoreIdEqualTo(MapUtils.getLong(param, "storeId")); } + if (StringUtils.isNotBlank(MapUtils.getString(param, "userId"))) { + criteria.andUserIdEqualTo(MapUtils.getString(param, "userId")); + } + if (StringUtils.isNotBlank(MapUtils.getString(param, "serialNumber"))) { criteria.andSerialNumberEqualTo(MapUtils.getString(param, "serialNumber")); }