From 67cd88e026cb4712fefed773f65cd24f76f1a8f1 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 13 Nov 2023 18:28:54 +0800 Subject: [PATCH 1/3] =?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 --- .../HighMerchantStoreController.java | 25 ++- ...hMerchantTripartitePlatformController.java | 5 +- .../main/java/com/web/config/AuthConfig.java | 2 + .../com/web/controller/OrderController.java | 41 ++++ .../web/controller/OrderPayController.java | 191 +++++++++++++++++- .../HighMerchantTripartitePlatformMapper.java | 30 +-- ...MerchantTripartitePlatformSqlProvider.java | 14 ++ .../HighMerchantTripartitePlatform.java | 16 ++ ...HighMerchantTripartitePlatformExample.java | 70 +++++++ .../impl/OrderCreateHandleServiceImpl.java | 3 + .../order/service/impl/OrderServiceImpl.java | 20 +- .../pay/channel/huipay/config/HuiConfig.java | 1 + ...HighMerchantTripartitePlatformService.java | 7 + ...MerchantTripartitePlatformServiceImpl.java | 11 + 14 files changed, 404 insertions(+), 32 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighMerchantStoreController.java b/hai-bweb/src/main/java/com/bweb/controller/HighMerchantStoreController.java index 2a5853e0..87167f9e 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighMerchantStoreController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighMerchantStoreController.java @@ -5,11 +5,13 @@ import com.bweb.excelListener.ImportStoreListener; import com.bweb.model.ImportStoreModel; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.hai.common.QRCodeGenerator; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; +import com.hai.common.utils.DateUtil; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.CommonSysConst; @@ -29,6 +31,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.io.File; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -370,15 +373,27 @@ public class HighMerchantStoreController { @RequestMapping(value = "/getQrCode", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "生成推广二维码") - public ResponseData getQrCode(@RequestParam(name = "storeKey", required = false) String storeKey) { + public ResponseData getQrCode(@RequestParam(name = "storeKey", required = true) String storeKey) { try { - - - Map params = new HashMap<>(); - + /* Map params = new HashMap<>(); params.put("type", "2"); params.put("code", storeKey); return ResponseMsgUtil.success(HttpsUtils.doGet("https://hsg.dctpay.com/v1/wxMsg/createQrcode", params).getString("return_data")); +*/ + // 生成二维码 + String qrCodeImg = storeKey + ".png"; + String qrCodeUrl = CommonSysConst.getSysConfig().getFileUrl() + "/oil_img/" + qrCodeImg; + + // 参数 + String url = CommonSysConst.getSysConfig().getHsgDomainName()+ "/hsgH5?accountId=0000019&key=&code=" + storeKey; + File file = new File(qrCodeImg); + // 文件是否存在 + if (!file.exists()) { + // 不存在生成二维码 + QRCodeGenerator.generateQRCodeImage(url, 350, 350, qrCodeUrl); + } + + return ResponseMsgUtil.success(CommonSysConst.getSysConfig().getHsgDomainName() + "/filesystem/oil_img/" + qrCodeImg); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighMerchantTripartitePlatformController.java b/hai-bweb/src/main/java/com/bweb/controller/HighMerchantTripartitePlatformController.java index 5cf2012f..554b0dd6 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighMerchantTripartitePlatformController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighMerchantTripartitePlatformController.java @@ -61,7 +61,7 @@ public class HighMerchantTripartitePlatformController { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } - HighMerchantTripartitePlatform platform = tripartitePlatformService.getDetail(body.getLong("merId"), body.getInteger("platformType")); + HighMerchantTripartitePlatform platform = tripartitePlatformService.getDetail(body.getLong("merId")); if (platform == null) { platform = new HighMerchantTripartitePlatform(); } @@ -69,6 +69,7 @@ public class HighMerchantTripartitePlatformController { platform.setPlatformType(body.getInteger("platformType")); platform.setPlatformMerName(body.getString("platformMerName")); platform.setPlatformMerNumber(body.getString("platformMerNumber")); + platform.setPlatformMerKey(body.getString("platformMerKey")); platform.setProfitSharingStatus(body.getBoolean("profitSharingStatus")); platform.setProfitSharingRatio(body.getBigDecimal("profitSharingRatio")); platform.setProfitSharingReceiversNumber(body.getString("profitSharingReceiversNumber")); @@ -98,6 +99,8 @@ public class HighMerchantTripartitePlatformController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, postData.get("err_code_des")); } } + + tripartitePlatformService.editDate(platform); return ResponseMsgUtil.success("操作成功"); diff --git a/hai-order/src/main/java/com/web/config/AuthConfig.java b/hai-order/src/main/java/com/web/config/AuthConfig.java index c56a39af..619df5e5 100644 --- a/hai-order/src/main/java/com/web/config/AuthConfig.java +++ b/hai-order/src/main/java/com/web/config/AuthConfig.java @@ -90,9 +90,11 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/**/springfox-swagger-ui/**") .excludePathPatterns("/**/swagger-ui.html") .excludePathPatterns("/login/*") + .excludePathPatterns("/createNL") .excludePathPatterns("/cqNotify/*") .excludePathPatterns("/mobileRechargeNotify/*") .excludePathPatterns("/payNotify/*") + .excludePathPatterns("/orderPay/*") .excludePathPatterns("/telChargeCallback/*") .excludePathPatterns("/huiPayNotify/*") ; diff --git a/hai-order/src/main/java/com/web/controller/OrderController.java b/hai-order/src/main/java/com/web/controller/OrderController.java index 13f3e355..f7f4b11b 100644 --- a/hai-order/src/main/java/com/web/controller/OrderController.java +++ b/hai-order/src/main/java/com/web/controller/OrderController.java @@ -167,6 +167,47 @@ public class OrderController { } } + @RequestMapping(value="/createNL",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "创建订单【免登陆】") + public ResponseData createNL(@RequestBody CreateOrderModel body) { + try { + System.out.println("=================" + JSONObject.toJSONString(body)); + + if (body.getChildOrderList() == null || body.getChildOrderList().size() == 0) { + log.error("OrderController -> create() error!",""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + for (CreateOrderChildModel childModel : body.getChildOrderList()) { + // 校验子订单参数 + if (childModel.getGoodsType() == null + || OrderChildGoodsType.getDataByType(childModel.getGoodsType()) == null + || childModel.getGoodsId() == null + || childModel.getSaleCount() == null) { + log.error("OrderController -> create() error!",""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + if (childModel.getGoodsType().equals(OrderChildGoodsType.TYPE3.getNumber())) { + if (childModel.getGoodsPrice() == null) { + log.error("OrderController -> create() error!",""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写充值金额"); + } + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知交易业务"); + } + } + + body.setOrderNo(OrderUtil.generateOrderNo()); + return ResponseMsgUtil.success(orderService.createOrder(body)); + + } catch (Exception e) { + log.error("OrderController -> create() error!",e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/createCombine",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "创建合单订单") diff --git a/hai-order/src/main/java/com/web/controller/OrderPayController.java b/hai-order/src/main/java/com/web/controller/OrderPayController.java index 85b11c0a..4169b8f9 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayController.java @@ -238,15 +238,27 @@ public class OrderPayController { // 预存类型 0:非预存 1:预存门店 if (store.getPrestoreType().equals(0)) { // 第三方平台 - HighMerchantTripartitePlatform merTripartitePlatform = merTripartitePlatformService.getDetail(store.getMerchantId(), 1); - if (merTripartitePlatform != null) { + HighMerchantTripartitePlatform merTripartitePlatform = merTripartitePlatformService.getDetail(store.getMerchantId()); + // 微信直连 + if (merTripartitePlatform != null && merTripartitePlatform.getPlatformType().equals(1)) { weChatPayReqInfo.setSub_mch_id(merTripartitePlatform.getPlatformMerNumber()); - // 是否分账 - profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true) ? "Y" : "N"; + + } else if (merTripartitePlatform != null && merTripartitePlatform.getPlatformType().equals(2)) { + payPlatformType = merTripartitePlatform.getPlatformType(); + payPlatformKey = merTripartitePlatform.getPlatformMerKey(); + payPlatformMerNo = merTripartitePlatform.getPlatformMerNumber(); + + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); } + + // 是否分账 + profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true) ? "Y" : "N"; } } + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { // 查询支付配置 @@ -417,6 +429,177 @@ public class OrderPayController { } } + @RequestMapping(value = "/alipay", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "支付宝支付") + public ResponseData alipay(@RequestBody JSONObject body) { + try { + System.out.println("支付宝支付===================" + body); + if (body == null + || StringUtils.isBlank(body.getString("orderNo")) + || StringUtils.isBlank(body.getString("userId")) + ) { + log.error("wxPay error!", "参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + // 查询订单 + HighOrder order = orderService.getOrderDetailByNo(body.getString("orderNo")); + if (!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { + log.error("wxPay ERROR", "订单不处于待支付状态"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, ""); + } + // 是否分账 + String profitSharing = "N"; + // 订单标题 + String orderTitle = "购买商品"; + + Integer payPlatformType = null; + String payPlatformKey = null; + String payPlatformMerNo = null; + + + if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE6.getNumber())) { + // 查询油站 + HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(order.getHighChildOrderList().get(0).getGoodsId()); + if (store == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的加油站"); + } + if (store.getPrestoreType().equals(1)) { + if (order.getTotalPrice().compareTo(gasService.getMerPriceByMerId(store.getMerchantId())) == 1) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法进行支付,请联系平台客服"); + } + } + + if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber())) { + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type1, GasChannelPayPlatformType.type2); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; + + if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber())) { + // 预存类型 0:非预存 1:预存门店 + if (store.getPrestoreType().equals(0)) { + // 第三方平台 + HighMerchantTripartitePlatform merTripartitePlatform = merTripartitePlatformService.getDetail(store.getMerchantId()); + if (merTripartitePlatform != null && merTripartitePlatform.getPlatformType().equals(GasChannelPayPlatformType.type2.getType())) { + payPlatformType = merTripartitePlatform.getPlatformType(); + payPlatformKey = merTripartitePlatform.getPlatformMerKey(); + payPlatformMerNo = merTripartitePlatform.getPlatformMerNumber(); + + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + // 是否分账 + profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true) ? "Y" : "N"; + } + } + + + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { + + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type2); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + payPlatformType = gasChannelConfig.getPayPlatformType(); + payPlatformKey = gasChannelConfig.getPayPlatformMerKey(); + payPlatformMerNo = gasChannelConfig.getPayPlatformMerNo(); + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { + + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type3); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + payPlatformType = gasChannelConfig.getPayPlatformType(); + payPlatformMerNo = gasChannelConfig.getPayPlatformMerNo(); + payPlatformKey = gasChannelConfig.getPayPlatformMerKey(); + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) { + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type4); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + payPlatformType = gasChannelConfig.getPayPlatformType(); + payPlatformMerNo = gasChannelConfig.getPayPlatformMerNo(); + payPlatformKey = gasChannelConfig.getPayPlatformMerKey(); + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type5.getNumber())) { + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type5); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + payPlatformType = gasChannelConfig.getPayPlatformType(); + payPlatformMerNo = gasChannelConfig.getPayPlatformMerNo(); + payPlatformKey = gasChannelConfig.getPayPlatformMerKey(); + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type6.getNumber())) { + + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type6); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + payPlatformType = gasChannelConfig.getPayPlatformType(); + payPlatformMerNo = gasChannelConfig.getPayPlatformMerNo(); + payPlatformKey = gasChannelConfig.getPayPlatformMerKey(); + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type7.getNumber())) { + + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type7); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + payPlatformType = gasChannelConfig.getPayPlatformType(); + payPlatformMerNo = gasChannelConfig.getPayPlatformMerNo(); + payPlatformKey = gasChannelConfig.getPayPlatformMerKey(); + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; + + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + + } + + JSONObject payParam = new JSONObject(); + payParam.put("outTradeNo" , order.getOrderNo()); + payParam.put("transType" , "JSAPI"); + payParam.put("payMode" , "ALIPAY"); + payParam.put("totalAmount" , order.getTotalPrice()); + payParam.put("profitSharing" , profitSharing.equals("Y")?1:0); + payParam.put("notifyUrl" , SysConst.getSysConfig().getHuiPayNotify()); + payParam.put("subject" , orderTitle); + payParam.put("userId" , body.getString("userId")); + + SortedMap sortedMap = huiConfig.preorder(payParam, payPlatformKey, payPlatformMerNo); + + order.setAccountMerchantNum(payPlatformMerNo); + order.setProfitSharingStatus(false); + order.setPayChannel(payPlatformType); + orderService.updateOrderData(order); + + return ResponseMsgUtil.success(sortedMap); + + } catch (Exception e) { + log.error("OrderController -> create() error!", e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value = "/cardPay", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "卡支付") diff --git a/hai-service/src/main/java/com/hai/dao/HighMerchantTripartitePlatformMapper.java b/hai-service/src/main/java/com/hai/dao/HighMerchantTripartitePlatformMapper.java index 36d332e0..fa00c9d1 100644 --- a/hai-service/src/main/java/com/hai/dao/HighMerchantTripartitePlatformMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighMerchantTripartitePlatformMapper.java @@ -41,18 +41,18 @@ public interface HighMerchantTripartitePlatformMapper extends HighMerchantTripar @Insert({ "insert into high_merchant_tripartite_platform (mer_id, platform_type, ", "platform_mer_name, platform_mer_number, ", - "profit_sharing_status, profit_sharing_ratio, ", - "profit_sharing_receivers_number, profit_sharing_receivers_name, ", - "`status`, create_time, ", - "update_time, ext_1, ", - "ext_2, ext_3)", + "platform_mer_key, profit_sharing_status, ", + "profit_sharing_ratio, profit_sharing_receivers_number, ", + "profit_sharing_receivers_name, `status`, ", + "create_time, update_time, ", + "ext_1, ext_2, ext_3)", "values (#{merId,jdbcType=BIGINT}, #{platformType,jdbcType=INTEGER}, ", "#{platformMerName,jdbcType=VARCHAR}, #{platformMerNumber,jdbcType=VARCHAR}, ", - "#{profitSharingStatus,jdbcType=BIT}, #{profitSharingRatio,jdbcType=DECIMAL}, ", - "#{profitSharingReceiversNumber,jdbcType=VARCHAR}, #{profitSharingReceiversName,jdbcType=VARCHAR}, ", - "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", - "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{platformMerKey,jdbcType=VARCHAR}, #{profitSharingStatus,jdbcType=BIT}, ", + "#{profitSharingRatio,jdbcType=DECIMAL}, #{profitSharingReceiversNumber,jdbcType=VARCHAR}, ", + "#{profitSharingReceiversName,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(HighMerchantTripartitePlatform record); @@ -68,6 +68,7 @@ public interface HighMerchantTripartitePlatformMapper extends HighMerchantTripar @Result(column="platform_type", property="platformType", jdbcType=JdbcType.INTEGER), @Result(column="platform_mer_name", property="platformMerName", jdbcType=JdbcType.VARCHAR), @Result(column="platform_mer_number", property="platformMerNumber", jdbcType=JdbcType.VARCHAR), + @Result(column="platform_mer_key", property="platformMerKey", jdbcType=JdbcType.VARCHAR), @Result(column="profit_sharing_status", property="profitSharingStatus", jdbcType=JdbcType.BIT), @Result(column="profit_sharing_ratio", property="profitSharingRatio", jdbcType=JdbcType.DECIMAL), @Result(column="profit_sharing_receivers_number", property="profitSharingReceiversNumber", jdbcType=JdbcType.VARCHAR), @@ -83,9 +84,10 @@ public interface HighMerchantTripartitePlatformMapper extends HighMerchantTripar @Select({ "select", - "id, mer_id, platform_type, platform_mer_name, platform_mer_number, profit_sharing_status, ", - "profit_sharing_ratio, profit_sharing_receivers_number, profit_sharing_receivers_name, ", - "`status`, create_time, update_time, ext_1, ext_2, ext_3", + "id, mer_id, platform_type, platform_mer_name, platform_mer_number, platform_mer_key, ", + "profit_sharing_status, profit_sharing_ratio, profit_sharing_receivers_number, ", + "profit_sharing_receivers_name, `status`, create_time, update_time, ext_1, ext_2, ", + "ext_3", "from high_merchant_tripartite_platform", "where id = #{id,jdbcType=BIGINT}" }) @@ -95,6 +97,7 @@ public interface HighMerchantTripartitePlatformMapper extends HighMerchantTripar @Result(column="platform_type", property="platformType", jdbcType=JdbcType.INTEGER), @Result(column="platform_mer_name", property="platformMerName", jdbcType=JdbcType.VARCHAR), @Result(column="platform_mer_number", property="platformMerNumber", jdbcType=JdbcType.VARCHAR), + @Result(column="platform_mer_key", property="platformMerKey", jdbcType=JdbcType.VARCHAR), @Result(column="profit_sharing_status", property="profitSharingStatus", jdbcType=JdbcType.BIT), @Result(column="profit_sharing_ratio", property="profitSharingRatio", jdbcType=JdbcType.DECIMAL), @Result(column="profit_sharing_receivers_number", property="profitSharingReceiversNumber", jdbcType=JdbcType.VARCHAR), @@ -123,6 +126,7 @@ public interface HighMerchantTripartitePlatformMapper extends HighMerchantTripar "platform_type = #{platformType,jdbcType=INTEGER},", "platform_mer_name = #{platformMerName,jdbcType=VARCHAR},", "platform_mer_number = #{platformMerNumber,jdbcType=VARCHAR},", + "platform_mer_key = #{platformMerKey,jdbcType=VARCHAR},", "profit_sharing_status = #{profitSharingStatus,jdbcType=BIT},", "profit_sharing_ratio = #{profitSharingRatio,jdbcType=DECIMAL},", "profit_sharing_receivers_number = #{profitSharingReceiversNumber,jdbcType=VARCHAR},", diff --git a/hai-service/src/main/java/com/hai/dao/HighMerchantTripartitePlatformSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighMerchantTripartitePlatformSqlProvider.java index d828fa34..b2adfdf0 100644 --- a/hai-service/src/main/java/com/hai/dao/HighMerchantTripartitePlatformSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighMerchantTripartitePlatformSqlProvider.java @@ -44,6 +44,10 @@ public class HighMerchantTripartitePlatformSqlProvider { sql.VALUES("platform_mer_number", "#{platformMerNumber,jdbcType=VARCHAR}"); } + if (record.getPlatformMerKey() != null) { + sql.VALUES("platform_mer_key", "#{platformMerKey,jdbcType=VARCHAR}"); + } + if (record.getProfitSharingStatus() != null) { sql.VALUES("profit_sharing_status", "#{profitSharingStatus,jdbcType=BIT}"); } @@ -98,6 +102,7 @@ public class HighMerchantTripartitePlatformSqlProvider { sql.SELECT("platform_type"); sql.SELECT("platform_mer_name"); sql.SELECT("platform_mer_number"); + sql.SELECT("platform_mer_key"); sql.SELECT("profit_sharing_status"); sql.SELECT("profit_sharing_ratio"); sql.SELECT("profit_sharing_receivers_number"); @@ -145,6 +150,10 @@ public class HighMerchantTripartitePlatformSqlProvider { sql.SET("platform_mer_number = #{record.platformMerNumber,jdbcType=VARCHAR}"); } + if (record.getPlatformMerKey() != null) { + sql.SET("platform_mer_key = #{record.platformMerKey,jdbcType=VARCHAR}"); + } + if (record.getProfitSharingStatus() != null) { sql.SET("profit_sharing_status = #{record.profitSharingStatus,jdbcType=BIT}"); } @@ -198,6 +207,7 @@ public class HighMerchantTripartitePlatformSqlProvider { sql.SET("platform_type = #{record.platformType,jdbcType=INTEGER}"); sql.SET("platform_mer_name = #{record.platformMerName,jdbcType=VARCHAR}"); sql.SET("platform_mer_number = #{record.platformMerNumber,jdbcType=VARCHAR}"); + sql.SET("platform_mer_key = #{record.platformMerKey,jdbcType=VARCHAR}"); sql.SET("profit_sharing_status = #{record.profitSharingStatus,jdbcType=BIT}"); sql.SET("profit_sharing_ratio = #{record.profitSharingRatio,jdbcType=DECIMAL}"); sql.SET("profit_sharing_receivers_number = #{record.profitSharingReceiversNumber,jdbcType=VARCHAR}"); @@ -234,6 +244,10 @@ public class HighMerchantTripartitePlatformSqlProvider { sql.SET("platform_mer_number = #{platformMerNumber,jdbcType=VARCHAR}"); } + if (record.getPlatformMerKey() != null) { + sql.SET("platform_mer_key = #{platformMerKey,jdbcType=VARCHAR}"); + } + if (record.getProfitSharingStatus() != null) { sql.SET("profit_sharing_status = #{profitSharingStatus,jdbcType=BIT}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighMerchantTripartitePlatform.java b/hai-service/src/main/java/com/hai/entity/HighMerchantTripartitePlatform.java index 8db5a8f0..c8f225bd 100644 --- a/hai-service/src/main/java/com/hai/entity/HighMerchantTripartitePlatform.java +++ b/hai-service/src/main/java/com/hai/entity/HighMerchantTripartitePlatform.java @@ -36,6 +36,11 @@ public class HighMerchantTripartitePlatform implements Serializable { */ private String platformMerNumber; + /** + * 商户key + */ + private String platformMerKey; + /** * 是否分账 */ @@ -119,6 +124,14 @@ public class HighMerchantTripartitePlatform implements Serializable { this.platformMerNumber = platformMerNumber; } + public String getPlatformMerKey() { + return platformMerKey; + } + + public void setPlatformMerKey(String platformMerKey) { + this.platformMerKey = platformMerKey; + } + public Boolean getProfitSharingStatus() { return profitSharingStatus; } @@ -216,6 +229,7 @@ public class HighMerchantTripartitePlatform implements Serializable { && (this.getPlatformType() == null ? other.getPlatformType() == null : this.getPlatformType().equals(other.getPlatformType())) && (this.getPlatformMerName() == null ? other.getPlatformMerName() == null : this.getPlatformMerName().equals(other.getPlatformMerName())) && (this.getPlatformMerNumber() == null ? other.getPlatformMerNumber() == null : this.getPlatformMerNumber().equals(other.getPlatformMerNumber())) + && (this.getPlatformMerKey() == null ? other.getPlatformMerKey() == null : this.getPlatformMerKey().equals(other.getPlatformMerKey())) && (this.getProfitSharingStatus() == null ? other.getProfitSharingStatus() == null : this.getProfitSharingStatus().equals(other.getProfitSharingStatus())) && (this.getProfitSharingRatio() == null ? other.getProfitSharingRatio() == null : this.getProfitSharingRatio().equals(other.getProfitSharingRatio())) && (this.getProfitSharingReceiversNumber() == null ? other.getProfitSharingReceiversNumber() == null : this.getProfitSharingReceiversNumber().equals(other.getProfitSharingReceiversNumber())) @@ -237,6 +251,7 @@ public class HighMerchantTripartitePlatform implements Serializable { result = prime * result + ((getPlatformType() == null) ? 0 : getPlatformType().hashCode()); result = prime * result + ((getPlatformMerName() == null) ? 0 : getPlatformMerName().hashCode()); result = prime * result + ((getPlatformMerNumber() == null) ? 0 : getPlatformMerNumber().hashCode()); + result = prime * result + ((getPlatformMerKey() == null) ? 0 : getPlatformMerKey().hashCode()); result = prime * result + ((getProfitSharingStatus() == null) ? 0 : getProfitSharingStatus().hashCode()); result = prime * result + ((getProfitSharingRatio() == null) ? 0 : getProfitSharingRatio().hashCode()); result = prime * result + ((getProfitSharingReceiversNumber() == null) ? 0 : getProfitSharingReceiversNumber().hashCode()); @@ -261,6 +276,7 @@ public class HighMerchantTripartitePlatform implements Serializable { sb.append(", platformType=").append(platformType); sb.append(", platformMerName=").append(platformMerName); sb.append(", platformMerNumber=").append(platformMerNumber); + sb.append(", platformMerKey=").append(platformMerKey); sb.append(", profitSharingStatus=").append(profitSharingStatus); sb.append(", profitSharingRatio=").append(profitSharingRatio); sb.append(", profitSharingReceiversNumber=").append(profitSharingReceiversNumber); diff --git a/hai-service/src/main/java/com/hai/entity/HighMerchantTripartitePlatformExample.java b/hai-service/src/main/java/com/hai/entity/HighMerchantTripartitePlatformExample.java index b880f9f6..52e611b7 100644 --- a/hai-service/src/main/java/com/hai/entity/HighMerchantTripartitePlatformExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighMerchantTripartitePlatformExample.java @@ -446,6 +446,76 @@ public class HighMerchantTripartitePlatformExample { return (Criteria) this; } + public Criteria andPlatformMerKeyIsNull() { + addCriterion("platform_mer_key is null"); + return (Criteria) this; + } + + public Criteria andPlatformMerKeyIsNotNull() { + addCriterion("platform_mer_key is not null"); + return (Criteria) this; + } + + public Criteria andPlatformMerKeyEqualTo(String value) { + addCriterion("platform_mer_key =", value, "platformMerKey"); + return (Criteria) this; + } + + public Criteria andPlatformMerKeyNotEqualTo(String value) { + addCriterion("platform_mer_key <>", value, "platformMerKey"); + return (Criteria) this; + } + + public Criteria andPlatformMerKeyGreaterThan(String value) { + addCriterion("platform_mer_key >", value, "platformMerKey"); + return (Criteria) this; + } + + public Criteria andPlatformMerKeyGreaterThanOrEqualTo(String value) { + addCriterion("platform_mer_key >=", value, "platformMerKey"); + return (Criteria) this; + } + + public Criteria andPlatformMerKeyLessThan(String value) { + addCriterion("platform_mer_key <", value, "platformMerKey"); + return (Criteria) this; + } + + public Criteria andPlatformMerKeyLessThanOrEqualTo(String value) { + addCriterion("platform_mer_key <=", value, "platformMerKey"); + return (Criteria) this; + } + + public Criteria andPlatformMerKeyLike(String value) { + addCriterion("platform_mer_key like", value, "platformMerKey"); + return (Criteria) this; + } + + public Criteria andPlatformMerKeyNotLike(String value) { + addCriterion("platform_mer_key not like", value, "platformMerKey"); + return (Criteria) this; + } + + public Criteria andPlatformMerKeyIn(List values) { + addCriterion("platform_mer_key in", values, "platformMerKey"); + return (Criteria) this; + } + + public Criteria andPlatformMerKeyNotIn(List values) { + addCriterion("platform_mer_key not in", values, "platformMerKey"); + return (Criteria) this; + } + + public Criteria andPlatformMerKeyBetween(String value1, String value2) { + addCriterion("platform_mer_key between", value1, value2, "platformMerKey"); + return (Criteria) this; + } + + public Criteria andPlatformMerKeyNotBetween(String value1, String value2) { + addCriterion("platform_mer_key not between", value1, value2, "platformMerKey"); + return (Criteria) this; + } + public Criteria andProfitSharingStatusIsNull() { addCriterion("profit_sharing_status is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java index dd667b48..2fd765c2 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java @@ -360,6 +360,9 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { if (store == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油站"); } + if (!store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber()) && StringUtils.isBlank(order.getMemPhone())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.USE_VISIT_ILLEGAL, ""); + } if (store.getSourceType() == 7) { if (createOrderChild.getOilCardNo() == null) { diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index 00718698..99de03d6 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -138,6 +138,7 @@ public class OrderServiceImpl implements OrderService { public HighOrder createOrder(CreateOrderModel createOrderModel) throws Exception { HighDiscountUserRel discountUserRel = null; + HighOrder order = new HighOrder(); // 使用优惠券 if (createOrderModel.getMemDiscountId() != null) { @@ -158,16 +159,17 @@ public class OrderServiceImpl implements OrderService { discountAgentCodeService.updateCode(code); } - // 查询推广员信息 - Map mapUser = new HashMap<>(); - mapUser.put("userId" , createOrderModel.getMemId()); - BsDistributionUserRel popularizeUser = bsDistributionUserRelService.findDistributionUserRel(mapUser); + // 推广码 + order.setPromoteCode(createOrderModel.getPromoteCode()); + if (createOrderModel.getMemId() != null) { + // 查询推广员信息 + Map mapUser = new HashMap<>(); + mapUser.put("userId" , createOrderModel.getMemId()); + BsDistributionUserRel popularizeUser = bsDistributionUserRelService.findDistributionUserRel(mapUser); - HighOrder order = new HighOrder(); - if (popularizeUser != null && createOrderModel.getMemId() != null) { - order.setPromoteCode(popularizeUser.getAgentId().toString()); - }else { - order.setPromoteCode(createOrderModel.getPromoteCode()); + if (popularizeUser != null && createOrderModel.getMemId() != null) { + order.setPromoteCode(popularizeUser.getAgentId().toString()); + } } order.setOrderNo(createOrderModel.getOrderNo()); diff --git a/hai-service/src/main/java/com/hai/pay/channel/huipay/config/HuiConfig.java b/hai-service/src/main/java/com/hai/pay/channel/huipay/config/HuiConfig.java index f7842f43..e388cb78 100644 --- a/hai-service/src/main/java/com/hai/pay/channel/huipay/config/HuiConfig.java +++ b/hai-service/src/main/java/com/hai/pay/channel/huipay/config/HuiConfig.java @@ -77,6 +77,7 @@ public class HuiConfig { sortedMap.put("timeStamp", payParam.get("time_stamp")); sortedMap.put("signType", "MD5"); sortedMap.put("package", payParam.get("package")); + sortedMap.put("prepay_id", payParam.get("prepay_id")); sortedMap.put("sign", payParam.get("pay_sign")); // 将支付请求存入支付纪录 diff --git a/hai-service/src/main/java/com/hai/service/HighMerchantTripartitePlatformService.java b/hai-service/src/main/java/com/hai/service/HighMerchantTripartitePlatformService.java index 57102f72..bb236f14 100644 --- a/hai-service/src/main/java/com/hai/service/HighMerchantTripartitePlatformService.java +++ b/hai-service/src/main/java/com/hai/service/HighMerchantTripartitePlatformService.java @@ -17,4 +17,11 @@ public interface HighMerchantTripartitePlatformService { * @return */ HighMerchantTripartitePlatform getDetail(Long merId,Integer platformType); + + /** + * 查询详情 + * @param merId + * @return + */ + HighMerchantTripartitePlatform getDetail(Long merId); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighMerchantTripartitePlatformServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighMerchantTripartitePlatformServiceImpl.java index 00c4f016..8bfc58d7 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighMerchantTripartitePlatformServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighMerchantTripartitePlatformServiceImpl.java @@ -39,4 +39,15 @@ public class HighMerchantTripartitePlatformServiceImpl implements HighMerchantTr } return null; } + + @Override + public HighMerchantTripartitePlatform getDetail(Long merId) { + HighMerchantTripartitePlatformExample example = new HighMerchantTripartitePlatformExample(); + example.createCriteria().andMerIdEqualTo(merId); + List list = merchantTripartitePlatformMapper.selectByExample(example); + if (list.size() > 0) { + return list.get(0); + } + return null; + } } From acb5dca7b9e4efedb283b43da3fc3c2da4dfc2d1 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 14 Nov 2023 10:14:06 +0800 Subject: [PATCH 2/3] =?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 --- .../src/main/java/com/web/controller/OrderPayController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/hai-order/src/main/java/com/web/controller/OrderPayController.java b/hai-order/src/main/java/com/web/controller/OrderPayController.java index 4169b8f9..a8b11b49 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayController.java @@ -586,7 +586,6 @@ public class OrderPayController { payParam.put("userId" , body.getString("userId")); SortedMap sortedMap = huiConfig.preorder(payParam, payPlatformKey, payPlatformMerNo); - order.setAccountMerchantNum(payPlatformMerNo); order.setProfitSharingStatus(false); order.setPayChannel(payPlatformType); From e1e02be6d85cd50d3a540babda736aaacf6884ff Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 14 Nov 2023 10:55:11 +0800 Subject: [PATCH 3/3] Changes --- .../src/main/java/com/web/controller/OrderPayController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hai-order/src/main/java/com/web/controller/OrderPayController.java b/hai-order/src/main/java/com/web/controller/OrderPayController.java index a8b11b49..c4f235cc 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayController.java @@ -585,6 +585,7 @@ public class OrderPayController { payParam.put("subject" , orderTitle); payParam.put("userId" , body.getString("userId")); + SortedMap sortedMap = huiConfig.preorder(payParam, payPlatformKey, payPlatformMerNo); order.setAccountMerchantNum(payPlatformMerNo); order.setProfitSharingStatus(false);