From 8ad7ce5822d155558d3bdd05bdfe57c0847564a8 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 4 Jul 2023 15:56:34 +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 --- .../controller/BsTradeOrderController.java | 1 + .../excel/model/ExportTradeOrderModel.java | 4 ++ .../com/cweb/controller/LoginController.java | 1 + .../com/cweb/controller/TestController.java | 3 +- .../api/controller/v1/TradeController.java | 1 + .../channel/lakala/LaKaLaTradeService.java | 59 +++++++++++++++- .../java/com/hfkj/dao/BsTradeOrderMapper.java | 26 ++++--- .../com/hfkj/dao/BsTradeOrderSqlProvider.java | 14 ++++ .../java/com/hfkj/entity/BsTradeOrder.java | 16 +++++ .../com/hfkj/entity/BsTradeOrderExample.java | 70 +++++++++++++++++++ .../request/RequestTradePreorderModel.java | 3 + 11 files changed, 185 insertions(+), 13 deletions(-) diff --git a/bweb/src/main/java/com/bweb/controller/BsTradeOrderController.java b/bweb/src/main/java/com/bweb/controller/BsTradeOrderController.java index f7cae23..81fae5b 100644 --- a/bweb/src/main/java/com/bweb/controller/BsTradeOrderController.java +++ b/bweb/src/main/java/com/bweb/controller/BsTradeOrderController.java @@ -222,6 +222,7 @@ public class BsTradeOrderController { data.setPayTime(tradeOrder.getPayTime()); data.setPlatformMerNo(tradeOrder.getPlatformMerNo()); data.setSalesmanName(tradeOrder.getSalesmanName()); + data.setSpecialField(tradeOrder.getSpecialField()); dataList.add(data); } diff --git a/bweb/src/main/java/com/bweb/excel/model/ExportTradeOrderModel.java b/bweb/src/main/java/com/bweb/excel/model/ExportTradeOrderModel.java index 3fddd1d..eca0d87 100644 --- a/bweb/src/main/java/com/bweb/excel/model/ExportTradeOrderModel.java +++ b/bweb/src/main/java/com/bweb/excel/model/ExportTradeOrderModel.java @@ -67,4 +67,8 @@ public class ExportTradeOrderModel { @ExcelProperty(value = "业务员") private String salesmanName; + @ColumnWidth(25) + @ExcelProperty(value = "特殊字段") + private String specialField; + } diff --git a/cweb/src/main/java/com/cweb/controller/LoginController.java b/cweb/src/main/java/com/cweb/controller/LoginController.java index 602c22d..4186825 100644 --- a/cweb/src/main/java/com/cweb/controller/LoginController.java +++ b/cweb/src/main/java/com/cweb/controller/LoginController.java @@ -292,4 +292,5 @@ public class LoginController { return ResponseMsgUtil.exception(e); } } + } diff --git a/cweb/src/main/java/com/cweb/controller/TestController.java b/cweb/src/main/java/com/cweb/controller/TestController.java index 285ff5b..7845e30 100644 --- a/cweb/src/main/java/com/cweb/controller/TestController.java +++ b/cweb/src/main/java/com/cweb/controller/TestController.java @@ -260,7 +260,8 @@ public class TestController { //return ResponseMsgUtil.success(saasMerService.merchantInfo("123364703")); // return ResponseMsgUtil.success(saasCommon.getCategory(null)); // return ResponseMsgUtil.success(laKaLaLedgerService.queryLedgerMer(code)); - return ResponseMsgUtil.success(laKaLaTradeService.queryTrans(code)); + // return ResponseMsgUtil.success(laKaLaTradeService.queryTrans(code)); + return ResponseMsgUtil.success(laKaLaTradeService.queryTrade(code)); // return ResponseMsgUtil.success(""); // 1200 // return ResponseMsgUtil.success(saasCommon.fileUpload(new HashMap<>())); diff --git a/open-api/src/main/java/com/api/controller/v1/TradeController.java b/open-api/src/main/java/com/api/controller/v1/TradeController.java index afbf645..5e3433c 100644 --- a/open-api/src/main/java/com/api/controller/v1/TradeController.java +++ b/open-api/src/main/java/com/api/controller/v1/TradeController.java @@ -106,6 +106,7 @@ public class TradeController { tradeOrder.setSubject(body.getSubject()); tradeOrder.setRefundPrice(new BigDecimal("0")); tradeOrder.setAttach(body.getAttach()); + tradeOrder.setSpecialField(body.getSpecialField()); // 创建交易订单 Map returnParam = openApiTradeOrderService.createOrder(tradeOrder); diff --git a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeService.java b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeService.java index 4d20eae..eae8ea9 100644 --- a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeService.java +++ b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeService.java @@ -281,6 +281,63 @@ public class LaKaLaTradeService { return returnMap; } + /** + * 查询交易 + * @param tradeNo 订单号 + */ + public JSONObject queryTrade(String tradeNo) { + log.info("========= Start 交易查询 Start ==========="); + try { + // 查询交易订单 + BsTradeOrder order = tradeOrderService.getOrderByOutTradeNo(tradeNo); + if (order == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到交易订单"); + } + // 查询商户号 + BsMerPlatformNo platformNo = merPlatformNoService.getPlatformNo(order.getMerId(), PlatformTypeEnum.type1); + if (platformNo == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户号"); + } + // 查询终端号 + BsMerPlatformTerm merPlatformTerm = merPlatformTermService.getMerPlatformTerm(platformNo.getId(), "WECHAT_PAY"); + if (merPlatformTerm == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户终端号"); + } + Map commonParam = new HashMap<>(); + commonParam.put("req_time", DateUtil.format(new Date(), "yyyyMMddHHmmss")); + commonParam.put("version", "3.0"); + commonParam.put("out_org_code", CommonSysConst.getSysConfig().getLkl_v3_appid()); + + Map map = new HashMap<>(); + map.put("merchant_no", order.getPlatformMerNo()); + map.put("term_no", merPlatformTerm.getTermNo()); + map.put("out_trade_no", order.getOutTradeNo()); + commonParam.put("req_data", map); + + Map reqParam = LaKaLaConfig.generateSignParamsV3(JSONObject.parseObject(JSONObject.toJSONString(commonParam))); + + // 头部参数 + Map heard = new HashMap<>(); + heard.put("Authorization", reqParam.get("Authorization")); + + // 请求记录 + // 请求拉卡拉接口 + JSONObject responseBody = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLkl_request_url() + "/api/v3/labs/query/tradequery", commonParam, heard); + log.info("请求参数:"+ JSONObject.toJSONString(commonParam)); + log.info("响应参数:"+ JSONObject.toJSONString(responseBody)); + System.out.println("请求参数:"+ JSONObject.toJSONString(commonParam)); + System.out.println("响应参数:"+ JSONObject.toJSONString(responseBody)); + if (!responseBody.getString("code").equals("BBS00000")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("msg")); + } + return responseBody.getJSONObject("resp_data"); + + } catch (Exception e) { + return null; + } finally { + log.info("========= END 交易查询 END ==========="); + } + } /** * 商户计费查询 @@ -340,7 +397,6 @@ public class LaKaLaTradeService { } } - /** * 退款 * @param refundNo 订单号 @@ -451,7 +507,6 @@ public class LaKaLaTradeService { return returnMap; } - /** * 关单 * @param tradeNo 订单号 diff --git a/service/src/main/java/com/hfkj/dao/BsTradeOrderMapper.java b/service/src/main/java/com/hfkj/dao/BsTradeOrderMapper.java index bdff433..3fc20a2 100644 --- a/service/src/main/java/com/hfkj/dao/BsTradeOrderMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsTradeOrderMapper.java @@ -68,10 +68,11 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt { "profit_sharing_status, pay_time, ", "timeout_express, subject, ", "pay_notify_url, attach, ", - "refund_type, refund_price, ", - "create_type, create_time, ", - "cancel_time, update_time, ", - "ext_1, ext_2, ext_3)", + "special_field, refund_type, ", + "refund_price, create_type, ", + "create_time, cancel_time, ", + "update_time, ext_1, ", + "ext_2, ext_3)", "values (#{companyId,jdbcType=BIGINT}, #{agentId,jdbcType=BIGINT}, ", "#{salesmanId,jdbcType=BIGINT}, #{salesmanName,jdbcType=VARCHAR}, ", "#{merId,jdbcType=BIGINT}, #{merName,jdbcType=VARCHAR}, #{merNo,jdbcType=VARCHAR}, ", @@ -101,10 +102,11 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt { "#{profitSharingStatus,jdbcType=BIT}, #{payTime,jdbcType=TIMESTAMP}, ", "#{timeoutExpress,jdbcType=INTEGER}, #{subject,jdbcType=VARCHAR}, ", "#{payNotifyUrl,jdbcType=VARCHAR}, #{attach,jdbcType=VARCHAR}, ", - "#{refundType,jdbcType=INTEGER}, #{refundPrice,jdbcType=DECIMAL}, ", - "#{createType,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{cancelTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{specialField,jdbcType=VARCHAR}, #{refundType,jdbcType=INTEGER}, ", + "#{refundPrice,jdbcType=DECIMAL}, #{createType,jdbcType=INTEGER}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{cancelTime,jdbcType=TIMESTAMP}, ", + "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(BsTradeOrder record); @@ -175,6 +177,7 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt { @Result(column="subject", property="subject", jdbcType=JdbcType.VARCHAR), @Result(column="pay_notify_url", property="payNotifyUrl", jdbcType=JdbcType.VARCHAR), @Result(column="attach", property="attach", jdbcType=JdbcType.VARCHAR), + @Result(column="special_field", property="specialField", jdbcType=JdbcType.VARCHAR), @Result(column="refund_type", property="refundType", jdbcType=JdbcType.INTEGER), @Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL), @Result(column="create_type", property="createType", jdbcType=JdbcType.INTEGER), @@ -200,8 +203,9 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt { "user_discount_actual_price, trade_actual_amount, income_amount, acc_trade_no, ", "acc_mdiscount_amount, acc_discount_amount, shd_fee_amt, fee_rate, settle_amount, ", "settle_date, acc_payment_code, card_type, `status`, profit_sharing_status, pay_time, ", - "timeout_express, subject, pay_notify_url, attach, refund_type, refund_price, ", - "create_type, create_time, cancel_time, update_time, ext_1, ext_2, ext_3", + "timeout_express, subject, pay_notify_url, attach, special_field, refund_type, ", + "refund_price, create_type, create_time, cancel_time, update_time, ext_1, ext_2, ", + "ext_3", "from bs_trade_order", "where id = #{id,jdbcType=BIGINT}" }) @@ -266,6 +270,7 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt { @Result(column="subject", property="subject", jdbcType=JdbcType.VARCHAR), @Result(column="pay_notify_url", property="payNotifyUrl", jdbcType=JdbcType.VARCHAR), @Result(column="attach", property="attach", jdbcType=JdbcType.VARCHAR), + @Result(column="special_field", property="specialField", jdbcType=JdbcType.VARCHAR), @Result(column="refund_type", property="refundType", jdbcType=JdbcType.INTEGER), @Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL), @Result(column="create_type", property="createType", jdbcType=JdbcType.INTEGER), @@ -348,6 +353,7 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt { "subject = #{subject,jdbcType=VARCHAR},", "pay_notify_url = #{payNotifyUrl,jdbcType=VARCHAR},", "attach = #{attach,jdbcType=VARCHAR},", + "special_field = #{specialField,jdbcType=VARCHAR},", "refund_type = #{refundType,jdbcType=INTEGER},", "refund_price = #{refundPrice,jdbcType=DECIMAL},", "create_type = #{createType,jdbcType=INTEGER},", diff --git a/service/src/main/java/com/hfkj/dao/BsTradeOrderSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsTradeOrderSqlProvider.java index f34df3a..971a0a2 100644 --- a/service/src/main/java/com/hfkj/dao/BsTradeOrderSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsTradeOrderSqlProvider.java @@ -264,6 +264,10 @@ public class BsTradeOrderSqlProvider { sql.VALUES("attach", "#{attach,jdbcType=VARCHAR}"); } + if (record.getSpecialField() != null) { + sql.VALUES("special_field", "#{specialField,jdbcType=VARCHAR}"); + } + if (record.getRefundType() != null) { sql.VALUES("refund_type", "#{refundType,jdbcType=INTEGER}"); } @@ -369,6 +373,7 @@ public class BsTradeOrderSqlProvider { sql.SELECT("subject"); sql.SELECT("pay_notify_url"); sql.SELECT("attach"); + sql.SELECT("special_field"); sql.SELECT("refund_type"); sql.SELECT("refund_price"); sql.SELECT("create_type"); @@ -635,6 +640,10 @@ public class BsTradeOrderSqlProvider { sql.SET("attach = #{record.attach,jdbcType=VARCHAR}"); } + if (record.getSpecialField() != null) { + sql.SET("special_field = #{record.specialField,jdbcType=VARCHAR}"); + } + if (record.getRefundType() != null) { sql.SET("refund_type = #{record.refundType,jdbcType=INTEGER}"); } @@ -739,6 +748,7 @@ public class BsTradeOrderSqlProvider { sql.SET("subject = #{record.subject,jdbcType=VARCHAR}"); sql.SET("pay_notify_url = #{record.payNotifyUrl,jdbcType=VARCHAR}"); sql.SET("attach = #{record.attach,jdbcType=VARCHAR}"); + sql.SET("special_field = #{record.specialField,jdbcType=VARCHAR}"); sql.SET("refund_type = #{record.refundType,jdbcType=INTEGER}"); sql.SET("refund_price = #{record.refundPrice,jdbcType=DECIMAL}"); sql.SET("create_type = #{record.createType,jdbcType=INTEGER}"); @@ -994,6 +1004,10 @@ public class BsTradeOrderSqlProvider { sql.SET("attach = #{attach,jdbcType=VARCHAR}"); } + if (record.getSpecialField() != null) { + sql.SET("special_field = #{specialField,jdbcType=VARCHAR}"); + } + if (record.getRefundType() != null) { sql.SET("refund_type = #{refundType,jdbcType=INTEGER}"); } diff --git a/service/src/main/java/com/hfkj/entity/BsTradeOrder.java b/service/src/main/java/com/hfkj/entity/BsTradeOrder.java index 59f7c11..1d6390d 100644 --- a/service/src/main/java/com/hfkj/entity/BsTradeOrder.java +++ b/service/src/main/java/com/hfkj/entity/BsTradeOrder.java @@ -318,6 +318,11 @@ public class BsTradeOrder implements Serializable { */ private String attach; + /** + * 特殊字段 + */ + private String specialField; + /** * 退款类型 1:全额退款 2:部分退款 */ @@ -836,6 +841,14 @@ public class BsTradeOrder implements Serializable { this.attach = attach; } + public String getSpecialField() { + return specialField; + } + + public void setSpecialField(String specialField) { + this.specialField = specialField; + } + public Integer getRefundType() { return refundType; } @@ -980,6 +993,7 @@ public class BsTradeOrder implements Serializable { && (this.getSubject() == null ? other.getSubject() == null : this.getSubject().equals(other.getSubject())) && (this.getPayNotifyUrl() == null ? other.getPayNotifyUrl() == null : this.getPayNotifyUrl().equals(other.getPayNotifyUrl())) && (this.getAttach() == null ? other.getAttach() == null : this.getAttach().equals(other.getAttach())) + && (this.getSpecialField() == null ? other.getSpecialField() == null : this.getSpecialField().equals(other.getSpecialField())) && (this.getRefundType() == null ? other.getRefundType() == null : this.getRefundType().equals(other.getRefundType())) && (this.getRefundPrice() == null ? other.getRefundPrice() == null : this.getRefundPrice().equals(other.getRefundPrice())) && (this.getCreateType() == null ? other.getCreateType() == null : this.getCreateType().equals(other.getCreateType())) @@ -1055,6 +1069,7 @@ public class BsTradeOrder implements Serializable { result = prime * result + ((getSubject() == null) ? 0 : getSubject().hashCode()); result = prime * result + ((getPayNotifyUrl() == null) ? 0 : getPayNotifyUrl().hashCode()); result = prime * result + ((getAttach() == null) ? 0 : getAttach().hashCode()); + result = prime * result + ((getSpecialField() == null) ? 0 : getSpecialField().hashCode()); result = prime * result + ((getRefundType() == null) ? 0 : getRefundType().hashCode()); result = prime * result + ((getRefundPrice() == null) ? 0 : getRefundPrice().hashCode()); result = prime * result + ((getCreateType() == null) ? 0 : getCreateType().hashCode()); @@ -1133,6 +1148,7 @@ public class BsTradeOrder implements Serializable { sb.append(", subject=").append(subject); sb.append(", payNotifyUrl=").append(payNotifyUrl); sb.append(", attach=").append(attach); + sb.append(", specialField=").append(specialField); sb.append(", refundType=").append(refundType); sb.append(", refundPrice=").append(refundPrice); sb.append(", createType=").append(createType); diff --git a/service/src/main/java/com/hfkj/entity/BsTradeOrderExample.java b/service/src/main/java/com/hfkj/entity/BsTradeOrderExample.java index 7c7f105..55db984 100644 --- a/service/src/main/java/com/hfkj/entity/BsTradeOrderExample.java +++ b/service/src/main/java/com/hfkj/entity/BsTradeOrderExample.java @@ -3983,6 +3983,76 @@ public class BsTradeOrderExample { return (Criteria) this; } + public Criteria andSpecialFieldIsNull() { + addCriterion("special_field is null"); + return (Criteria) this; + } + + public Criteria andSpecialFieldIsNotNull() { + addCriterion("special_field is not null"); + return (Criteria) this; + } + + public Criteria andSpecialFieldEqualTo(String value) { + addCriterion("special_field =", value, "specialField"); + return (Criteria) this; + } + + public Criteria andSpecialFieldNotEqualTo(String value) { + addCriterion("special_field <>", value, "specialField"); + return (Criteria) this; + } + + public Criteria andSpecialFieldGreaterThan(String value) { + addCriterion("special_field >", value, "specialField"); + return (Criteria) this; + } + + public Criteria andSpecialFieldGreaterThanOrEqualTo(String value) { + addCriterion("special_field >=", value, "specialField"); + return (Criteria) this; + } + + public Criteria andSpecialFieldLessThan(String value) { + addCriterion("special_field <", value, "specialField"); + return (Criteria) this; + } + + public Criteria andSpecialFieldLessThanOrEqualTo(String value) { + addCriterion("special_field <=", value, "specialField"); + return (Criteria) this; + } + + public Criteria andSpecialFieldLike(String value) { + addCriterion("special_field like", value, "specialField"); + return (Criteria) this; + } + + public Criteria andSpecialFieldNotLike(String value) { + addCriterion("special_field not like", value, "specialField"); + return (Criteria) this; + } + + public Criteria andSpecialFieldIn(List values) { + addCriterion("special_field in", values, "specialField"); + return (Criteria) this; + } + + public Criteria andSpecialFieldNotIn(List values) { + addCriterion("special_field not in", values, "specialField"); + return (Criteria) this; + } + + public Criteria andSpecialFieldBetween(String value1, String value2) { + addCriterion("special_field between", value1, value2, "specialField"); + return (Criteria) this; + } + + public Criteria andSpecialFieldNotBetween(String value1, String value2) { + addCriterion("special_field not between", value1, value2, "specialField"); + return (Criteria) this; + } + public Criteria andRefundTypeIsNull() { addCriterion("refund_type is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/openapi/v1/model/request/RequestTradePreorderModel.java b/service/src/main/java/com/hfkj/openapi/v1/model/request/RequestTradePreorderModel.java index a666a43..30c9baa 100644 --- a/service/src/main/java/com/hfkj/openapi/v1/model/request/RequestTradePreorderModel.java +++ b/service/src/main/java/com/hfkj/openapi/v1/model/request/RequestTradePreorderModel.java @@ -84,6 +84,9 @@ public class RequestTradePreorderModel { @Length(max = 128, message = "附加域限制在128位字符以内") private String attach; + @Length(max = 20, message = "特殊字段限制20位字符以内") + private String specialField; + /** * 分账 0:不分账 1:需分账 */