From ec8aefb60bfb9e3a27a9187527164e4abccc7781 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Fri, 19 Jul 2024 10:08:17 +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 --- .../bweb/controller/BsDeviceController.java | 28 +++++++++ .../BsGasChannelConfigController.java | 2 + .../controller/order/OrderPayController.java | 49 ++++++++++++--- .../hfkj/dao/BsGasChannelConfigMapper.java | 32 +++++----- .../dao/BsGasChannelConfigSqlProvider.java | 14 +++++ .../com/hfkj/entity/BsGasChannelConfig.java | 16 +++++ .../entity/BsGasChannelConfigExample.java | 60 +++++++++++++++++++ .../order/impl/BsOrderRefundServiceImpl.java | 2 +- 8 files changed, 179 insertions(+), 24 deletions(-) diff --git a/bweb/src/main/java/com/bweb/controller/BsDeviceController.java b/bweb/src/main/java/com/bweb/controller/BsDeviceController.java index 10de992..7cce3c2 100644 --- a/bweb/src/main/java/com/bweb/controller/BsDeviceController.java +++ b/bweb/src/main/java/com/bweb/controller/BsDeviceController.java @@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.HashMap; +import java.util.List; import java.util.Map; @Controller @@ -204,4 +205,31 @@ public class BsDeviceController { } } + + @RequestMapping(value="/settingReceipt",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "设置小票打印内容") + public ResponseData settingReceipt(@RequestBody JSONObject body) { + try { + if (body == null + || StringUtils.isBlank(body.getString("merNo")) + || body.getInteger("receiptOutContent") == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + Map param = new HashMap<>(); + param.put("merNo", body.getString("merNo")); + List deviceList = deviceService.getDeviceList(param); + for (BsDevice device : deviceList) { + device.setReceiptOutContent(body.getInteger("receiptOutContent")); + deviceService.editDevice(device); + } + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error("HighDeviceController -> settingReceipt() error!",e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/bweb/src/main/java/com/bweb/controller/BsGasChannelConfigController.java b/bweb/src/main/java/com/bweb/controller/BsGasChannelConfigController.java index 8ddf968..c4147f2 100644 --- a/bweb/src/main/java/com/bweb/controller/BsGasChannelConfigController.java +++ b/bweb/src/main/java/com/bweb/controller/BsGasChannelConfigController.java @@ -39,6 +39,7 @@ public class BsGasChannelConfigController { || body.getGasChannelType() == null || StringUtils.isBlank(body.getChannelMerNo()) || StringUtils.isBlank(body.getChannelMerKey()) + || body.getTradeStatus() == null || body.getLedgerAccountFlag() == null ) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); @@ -68,6 +69,7 @@ public class BsGasChannelConfigController { } else { config.setLedgerAccountData(null); } + config.setTradeStatus(body.getTradeStatus()); config.setChannelMerNo(body.getChannelMerNo()); config.setChannelMerKey(body.getChannelMerKey()); config.setLedgerAccountFlag(body.getLedgerAccountFlag()); diff --git a/cweb/src/main/java/com/cweb/controller/order/OrderPayController.java b/cweb/src/main/java/com/cweb/controller/order/OrderPayController.java index 5295060..df8478f 100644 --- a/cweb/src/main/java/com/cweb/controller/order/OrderPayController.java +++ b/cweb/src/main/java/com/cweb/controller/order/OrderPayController.java @@ -107,6 +107,9 @@ public class OrderPayController { if (payConfig == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付"); } + if (payConfig.getTradeStatus().equals(false)) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油站维护中暂停交易!"); + } payMerNo = payConfig.getChannelMerNo(); payMerKey = payConfig.getChannelMerKey(); ledgerAccountFlag = payConfig.getLedgerAccountFlag(); @@ -165,26 +168,54 @@ public class OrderPayController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "交易订单不处于待支付"); } String merNo = order.getOrderChildList().get(0).getMerNo(); - // 查询平台 - BsMerchantPayConfig merPay = merPayConfigService.getConfig(merNo); - if (merPay == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付"); + // 查询商户 + BsMerchant merchant = merchantService.getMerchant(merNo); + if (merchant == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户"); + } + + String payMerNo = ""; + String payMerKey = ""; + Boolean ledgerAccountFlag = false; + + if (merchant.getSourceType().equals(MerchantSourceTypeEnum.type1.getNumber())) { + // 查询平台 + BsMerchantPayConfig merPay = merPayConfigService.getConfig(merNo); + if (merPay == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付"); + } + payMerNo = merPay.getChannelMerNo(); + payMerKey = merPay.getChannelMerKey(); + ledgerAccountFlag = merPay.getLedgerAccountFlag(); + + } else if (merchant.getSourceType().equals(MerchantSourceTypeEnum.type2.getNumber())) { + // 查询渠道支付配置 + BsGasChannelConfig payConfig = gasChannelConfigService.getDetail(MerchantSourceTypeEnum.type2); + if (payConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付"); + } + if (payConfig.getTradeStatus().equals(false)) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油站维护中暂停交易!"); + } + payMerNo = payConfig.getChannelMerNo(); + payMerKey = payConfig.getChannelMerKey(); + ledgerAccountFlag = payConfig.getLedgerAccountFlag(); } order.setPayType(OrderPayTypeEnum.type2.getCode()); // 请求支付渠道 - Map preorder = HuiPayService.preorder(merPay.getChannelMerNo(), merPay.getChannelMerKey(), null, body.getString("userId"), merPay.getLedgerAccountFlag(), order); + Map preorder = HuiPayService.preorder(payMerNo, payMerKey, null, body.getString("userId"), ledgerAccountFlag, order); // 交易入账 BsOrderSettle orderSettle = orderSettleService.getData(order.getOrderNo()); if (orderSettle == null) { orderSettle = new BsOrderSettle(); } - orderSettle.setMerNo(merPay.getMerNo()); + orderSettle.setMerNo(merNo); orderSettle.setOrderNo(order.getOrderNo()); - orderSettle.setSettleMerNo(merPay.getChannelMerNo()); - orderSettle.setSettleMerKey(merPay.getChannelMerKey()); + orderSettle.setSettleMerNo(payMerNo); + orderSettle.setSettleMerKey(payMerKey); orderSettle.setSettleAmount(order.getPayRealPrice()); - orderSettle.setLedgerFlag(merPay.getLedgerAccountFlag()); + orderSettle.setLedgerFlag(ledgerAccountFlag); if (orderSettle.getLedgerFlag()) { orderSettle.setLedgerAmount(order.getPayRealPrice()); orderSettle.setLedgerOrderNo("L"+ DateUtil.date2String(new Date(), "yyMMddHHmmss") + RandomUtils.number(3, false)); diff --git a/service/src/main/java/com/hfkj/dao/BsGasChannelConfigMapper.java b/service/src/main/java/com/hfkj/dao/BsGasChannelConfigMapper.java index e4ac633..bfc8929 100644 --- a/service/src/main/java/com/hfkj/dao/BsGasChannelConfigMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsGasChannelConfigMapper.java @@ -39,18 +39,18 @@ public interface BsGasChannelConfigMapper extends BsGasChannelConfigMapperExt { int deleteByPrimaryKey(Long id); @Insert({ - "insert into bs_gas_channel_config (gas_channel_type, channel_type, ", - "channel_mer_no, channel_mer_key, ", - "ledger_account_flag, ledger_account_data, ", - "create_time, update_time, ", - "`status`, ext_1, ext_2, ", - "ext_3)", - "values (#{gasChannelType,jdbcType=INTEGER}, #{channelType,jdbcType=INTEGER}, ", - "#{channelMerNo,jdbcType=VARCHAR}, #{channelMerKey,jdbcType=VARCHAR}, ", - "#{ledgerAccountFlag,jdbcType=BIT}, #{ledgerAccountData,jdbcType=VARCHAR}, ", - "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", - "#{status,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ", - "#{ext3,jdbcType=VARCHAR})" + "insert into bs_gas_channel_config (gas_channel_type, trade_status, ", + "channel_type, channel_mer_no, ", + "channel_mer_key, ledger_account_flag, ", + "ledger_account_data, create_time, ", + "update_time, `status`, ", + "ext_1, ext_2, ext_3)", + "values (#{gasChannelType,jdbcType=INTEGER}, #{tradeStatus,jdbcType=BIT}, ", + "#{channelType,jdbcType=INTEGER}, #{channelMerNo,jdbcType=VARCHAR}, ", + "#{channelMerKey,jdbcType=VARCHAR}, #{ledgerAccountFlag,jdbcType=BIT}, ", + "#{ledgerAccountData,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(BsGasChannelConfig record); @@ -63,6 +63,7 @@ public interface BsGasChannelConfigMapper extends BsGasChannelConfigMapperExt { @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="gas_channel_type", property="gasChannelType", jdbcType=JdbcType.INTEGER), + @Result(column="trade_status", property="tradeStatus", jdbcType=JdbcType.BIT), @Result(column="channel_type", property="channelType", jdbcType=JdbcType.INTEGER), @Result(column="channel_mer_no", property="channelMerNo", jdbcType=JdbcType.VARCHAR), @Result(column="channel_mer_key", property="channelMerKey", jdbcType=JdbcType.VARCHAR), @@ -79,14 +80,16 @@ public interface BsGasChannelConfigMapper extends BsGasChannelConfigMapperExt { @Select({ "select", - "id, gas_channel_type, channel_type, channel_mer_no, channel_mer_key, ledger_account_flag, ", - "ledger_account_data, create_time, update_time, `status`, ext_1, ext_2, ext_3", + "id, gas_channel_type, trade_status, channel_type, channel_mer_no, channel_mer_key, ", + "ledger_account_flag, ledger_account_data, create_time, update_time, `status`, ", + "ext_1, ext_2, ext_3", "from bs_gas_channel_config", "where id = #{id,jdbcType=BIGINT}" }) @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="gas_channel_type", property="gasChannelType", jdbcType=JdbcType.INTEGER), + @Result(column="trade_status", property="tradeStatus", jdbcType=JdbcType.BIT), @Result(column="channel_type", property="channelType", jdbcType=JdbcType.INTEGER), @Result(column="channel_mer_no", property="channelMerNo", jdbcType=JdbcType.VARCHAR), @Result(column="channel_mer_key", property="channelMerKey", jdbcType=JdbcType.VARCHAR), @@ -113,6 +116,7 @@ public interface BsGasChannelConfigMapper extends BsGasChannelConfigMapperExt { @Update({ "update bs_gas_channel_config", "set gas_channel_type = #{gasChannelType,jdbcType=INTEGER},", + "trade_status = #{tradeStatus,jdbcType=BIT},", "channel_type = #{channelType,jdbcType=INTEGER},", "channel_mer_no = #{channelMerNo,jdbcType=VARCHAR},", "channel_mer_key = #{channelMerKey,jdbcType=VARCHAR},", diff --git a/service/src/main/java/com/hfkj/dao/BsGasChannelConfigSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsGasChannelConfigSqlProvider.java index 89081ac..14156f9 100644 --- a/service/src/main/java/com/hfkj/dao/BsGasChannelConfigSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsGasChannelConfigSqlProvider.java @@ -32,6 +32,10 @@ public class BsGasChannelConfigSqlProvider { sql.VALUES("gas_channel_type", "#{gasChannelType,jdbcType=INTEGER}"); } + if (record.getTradeStatus() != null) { + sql.VALUES("trade_status", "#{tradeStatus,jdbcType=BIT}"); + } + if (record.getChannelType() != null) { sql.VALUES("channel_type", "#{channelType,jdbcType=INTEGER}"); } @@ -87,6 +91,7 @@ public class BsGasChannelConfigSqlProvider { sql.SELECT("id"); } sql.SELECT("gas_channel_type"); + sql.SELECT("trade_status"); sql.SELECT("channel_type"); sql.SELECT("channel_mer_no"); sql.SELECT("channel_mer_key"); @@ -123,6 +128,10 @@ public class BsGasChannelConfigSqlProvider { sql.SET("gas_channel_type = #{record.gasChannelType,jdbcType=INTEGER}"); } + if (record.getTradeStatus() != null) { + sql.SET("trade_status = #{record.tradeStatus,jdbcType=BIT}"); + } + if (record.getChannelType() != null) { sql.SET("channel_type = #{record.channelType,jdbcType=INTEGER}"); } @@ -177,6 +186,7 @@ public class BsGasChannelConfigSqlProvider { sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("gas_channel_type = #{record.gasChannelType,jdbcType=INTEGER}"); + sql.SET("trade_status = #{record.tradeStatus,jdbcType=BIT}"); sql.SET("channel_type = #{record.channelType,jdbcType=INTEGER}"); sql.SET("channel_mer_no = #{record.channelMerNo,jdbcType=VARCHAR}"); sql.SET("channel_mer_key = #{record.channelMerKey,jdbcType=VARCHAR}"); @@ -202,6 +212,10 @@ public class BsGasChannelConfigSqlProvider { sql.SET("gas_channel_type = #{gasChannelType,jdbcType=INTEGER}"); } + if (record.getTradeStatus() != null) { + sql.SET("trade_status = #{tradeStatus,jdbcType=BIT}"); + } + if (record.getChannelType() != null) { sql.SET("channel_type = #{channelType,jdbcType=INTEGER}"); } diff --git a/service/src/main/java/com/hfkj/entity/BsGasChannelConfig.java b/service/src/main/java/com/hfkj/entity/BsGasChannelConfig.java index 75e61d7..49c27c8 100644 --- a/service/src/main/java/com/hfkj/entity/BsGasChannelConfig.java +++ b/service/src/main/java/com/hfkj/entity/BsGasChannelConfig.java @@ -20,6 +20,11 @@ public class BsGasChannelConfig implements Serializable { */ private Integer gasChannelType; + /** + * 交易状态 0:禁用 1:正常 + */ + private Boolean tradeStatus; + /** * 支付渠道类型 */ @@ -84,6 +89,14 @@ public class BsGasChannelConfig implements Serializable { this.gasChannelType = gasChannelType; } + public Boolean getTradeStatus() { + return tradeStatus; + } + + public void setTradeStatus(Boolean tradeStatus) { + this.tradeStatus = tradeStatus; + } + public Integer getChannelType() { return channelType; } @@ -186,6 +199,7 @@ public class BsGasChannelConfig implements Serializable { BsGasChannelConfig other = (BsGasChannelConfig) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) && (this.getGasChannelType() == null ? other.getGasChannelType() == null : this.getGasChannelType().equals(other.getGasChannelType())) + && (this.getTradeStatus() == null ? other.getTradeStatus() == null : this.getTradeStatus().equals(other.getTradeStatus())) && (this.getChannelType() == null ? other.getChannelType() == null : this.getChannelType().equals(other.getChannelType())) && (this.getChannelMerNo() == null ? other.getChannelMerNo() == null : this.getChannelMerNo().equals(other.getChannelMerNo())) && (this.getChannelMerKey() == null ? other.getChannelMerKey() == null : this.getChannelMerKey().equals(other.getChannelMerKey())) @@ -205,6 +219,7 @@ public class BsGasChannelConfig implements Serializable { int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getGasChannelType() == null) ? 0 : getGasChannelType().hashCode()); + result = prime * result + ((getTradeStatus() == null) ? 0 : getTradeStatus().hashCode()); result = prime * result + ((getChannelType() == null) ? 0 : getChannelType().hashCode()); result = prime * result + ((getChannelMerNo() == null) ? 0 : getChannelMerNo().hashCode()); result = prime * result + ((getChannelMerKey() == null) ? 0 : getChannelMerKey().hashCode()); @@ -227,6 +242,7 @@ public class BsGasChannelConfig implements Serializable { sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", gasChannelType=").append(gasChannelType); + sb.append(", tradeStatus=").append(tradeStatus); sb.append(", channelType=").append(channelType); sb.append(", channelMerNo=").append(channelMerNo); sb.append(", channelMerKey=").append(channelMerKey); diff --git a/service/src/main/java/com/hfkj/entity/BsGasChannelConfigExample.java b/service/src/main/java/com/hfkj/entity/BsGasChannelConfigExample.java index 01aca6c..a6fd4da 100644 --- a/service/src/main/java/com/hfkj/entity/BsGasChannelConfigExample.java +++ b/service/src/main/java/com/hfkj/entity/BsGasChannelConfigExample.java @@ -245,6 +245,66 @@ public class BsGasChannelConfigExample { return (Criteria) this; } + public Criteria andTradeStatusIsNull() { + addCriterion("trade_status is null"); + return (Criteria) this; + } + + public Criteria andTradeStatusIsNotNull() { + addCriterion("trade_status is not null"); + return (Criteria) this; + } + + public Criteria andTradeStatusEqualTo(Boolean value) { + addCriterion("trade_status =", value, "tradeStatus"); + return (Criteria) this; + } + + public Criteria andTradeStatusNotEqualTo(Boolean value) { + addCriterion("trade_status <>", value, "tradeStatus"); + return (Criteria) this; + } + + public Criteria andTradeStatusGreaterThan(Boolean value) { + addCriterion("trade_status >", value, "tradeStatus"); + return (Criteria) this; + } + + public Criteria andTradeStatusGreaterThanOrEqualTo(Boolean value) { + addCriterion("trade_status >=", value, "tradeStatus"); + return (Criteria) this; + } + + public Criteria andTradeStatusLessThan(Boolean value) { + addCriterion("trade_status <", value, "tradeStatus"); + return (Criteria) this; + } + + public Criteria andTradeStatusLessThanOrEqualTo(Boolean value) { + addCriterion("trade_status <=", value, "tradeStatus"); + return (Criteria) this; + } + + public Criteria andTradeStatusIn(List values) { + addCriterion("trade_status in", values, "tradeStatus"); + return (Criteria) this; + } + + public Criteria andTradeStatusNotIn(List values) { + addCriterion("trade_status not in", values, "tradeStatus"); + return (Criteria) this; + } + + public Criteria andTradeStatusBetween(Boolean value1, Boolean value2) { + addCriterion("trade_status between", value1, value2, "tradeStatus"); + return (Criteria) this; + } + + public Criteria andTradeStatusNotBetween(Boolean value1, Boolean value2) { + addCriterion("trade_status not between", value1, value2, "tradeStatus"); + return (Criteria) this; + } + public Criteria andChannelTypeIsNull() { addCriterion("channel_type is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java index 903d536..9f45191 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java @@ -107,7 +107,7 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的订单"); } if (!order.getOrderStatus().equals(OrderStatusEnum.status2.getCode()) - || !order.getOrderStatus().equals(OrderStatusEnum.status3.getCode())) { + && !order.getOrderStatus().equals(OrderStatusEnum.status3.getCode())) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单交易状态错误"); }