From 2eb0c4de426d0d9bb7fbc8e8c38d50c74963d454 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 9 Aug 2023 10:21:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4diam?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bweb/src/main/resources/dev/application.yml | 2 +- .../com/cweb/controller/TestController.java | 27 ++++++ .../com/hfkj/schedule/TradeOrderSchedule.java | 65 ++++++++++++-- .../com/hfkj/dao/BsTradeOrderMapperExt.java | 34 ++++++-- .../hfkj/dao/BsTradeOrderRefundMapper.java | 28 +++--- .../dao/BsTradeOrderRefundSqlProvider.java | 14 +++ .../com/hfkj/dao/BsTradeSettleMapper.java | 17 ++-- .../hfkj/dao/BsTradeSettleSqlProvider.java | 14 +++ .../com/hfkj/entity/BsTradeOrderRefund.java | 16 ++++ .../entity/BsTradeOrderRefundExample.java | 87 +++++++++++++++++++ .../java/com/hfkj/entity/BsTradeSettle.java | 18 +++- .../com/hfkj/entity/BsTradeSettleExample.java | 60 +++++++++++++ .../impl/BsTradeSettleServiceImpl.java | 3 + .../hfkj/sysenum/TradeSettleTradeType.java | 37 ++++++++ .../java/com/hfkj/unipush/UniPushService.java | 81 +++++++++++++++++ 15 files changed, 471 insertions(+), 32 deletions(-) create mode 100644 service/src/main/java/com/hfkj/sysenum/TradeSettleTradeType.java diff --git a/bweb/src/main/resources/dev/application.yml b/bweb/src/main/resources/dev/application.yml index 1f85468..7e59886 100644 --- a/bweb/src/main/resources/dev/application.yml +++ b/bweb/src/main/resources/dev/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.9.154.68:3306/gratia_pay?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/gratia_pay_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource diff --git a/cweb/src/main/java/com/cweb/controller/TestController.java b/cweb/src/main/java/com/cweb/controller/TestController.java index 69c128e..48e1355 100644 --- a/cweb/src/main/java/com/cweb/controller/TestController.java +++ b/cweb/src/main/java/com/cweb/controller/TestController.java @@ -14,9 +14,11 @@ import com.hfkj.channel.saas.utils.SaasMerRequest; import com.hfkj.channel.weixin.WeiXinMerService; import com.hfkj.channel.weixin.utils.WxUtils; import com.hfkj.channel.weixin.utils.sdk.WXPayConstants; +import com.hfkj.common.Base64Util; import com.hfkj.common.utils.DateUtil; import com.hfkj.common.utils.HttpsUtils; import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.common.utils.UnionUtils; import com.hfkj.config.CommonSysConst; import com.hfkj.config.device.SoundService; import com.hfkj.config.mqtt.MqttProviderService; @@ -29,6 +31,7 @@ import com.hfkj.sysenum.PlatformTypeEnum; import com.hfkj.sysenum.StoreCreateTypeEnum; import com.hfkj.sysenum.StoreStatusEnum; import com.hfkj.tts.HWYunSisService; +import com.hfkj.unipush.UniPushService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.MapUtils; @@ -282,6 +285,30 @@ public class TestController { } } + @RequestMapping(value="/pushToSingleByCid",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "pushToSingleByCid") + public ResponseData pushToSingleByCid(@RequestParam(value = "code", required = true) String code) { + try { + + JSONObject object = new JSONObject(); + object.put("cid", "69511c3be97a4f02fb99d8ab181980b6"); + object.put("price", "0.01"); + + // 获取语音播报地址 + String auditPath = HWYunSisService.ttsCustomDemo(object); + String taskNo = Base64Util.generateOrderNo(); + String msg = CommonSysConst.getSysConfig().getDomainName() + auditPath + "!@#PUSH#@!" + taskNo + "!@#PUSH#@!" + "惠支付收款:" + object.getBigDecimal("price"); + object.put("body", msg); + + return ResponseMsgUtil.success(UniPushService.pushToSingleByCid(object)); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/saasUpdateFee",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "saasUpdateFee") diff --git a/schedule/src/main/java/com/hfkj/schedule/TradeOrderSchedule.java b/schedule/src/main/java/com/hfkj/schedule/TradeOrderSchedule.java index eb8b35c..38b1bfc 100644 --- a/schedule/src/main/java/com/hfkj/schedule/TradeOrderSchedule.java +++ b/schedule/src/main/java/com/hfkj/schedule/TradeOrderSchedule.java @@ -5,10 +5,7 @@ import com.hfkj.channel.lakala.LaKaLaTradeSeparateService; import com.hfkj.channel.lakala.LaKaLaTradeService; import com.hfkj.channel.weixin.utils.WxOrderConfig; import com.hfkj.common.utils.DateUtil; -import com.hfkj.entity.BsTradeOrder; -import com.hfkj.entity.BsTradeOrderProfitSharing; -import com.hfkj.entity.BsTradeOrderProfitSharingReceiver; -import com.hfkj.entity.BsTradeOrderRefund; +import com.hfkj.entity.*; import com.hfkj.service.*; import com.hfkj.sysenum.*; import org.apache.commons.collections4.MapUtils; @@ -43,6 +40,8 @@ public class TradeOrderSchedule { private BsTradeOrderRefundService tradeOrderRefundService; @Resource private LaKaLaTradeService laKaLaTradeService; + @Resource + private BsTradeSettleService tradeSettleService; /** * 订单发起分账 @@ -277,6 +276,33 @@ public class TradeOrderSchedule { tradeOrder.setSettleDate(queryTrans.getDate("clear_date")); tradeOrder.setFeeRate(new BigDecimal(queryTrans.getString("fee_rate").split(",")[0])); tradeOrderService.editOrder(tradeOrder); + + BsTradeSettle tradeSettle = new BsTradeSettle(); + tradeSettle.setCompanyId(tradeOrder.getCompanyId()); + tradeSettle.setAgentId(tradeOrder.getAgentId()); + tradeSettle.setSalesmanId(tradeOrder.getSalesmanId()); + tradeSettle.setSalesmanName(tradeOrder.getSalesmanName()); + tradeSettle.setMerId(tradeOrder.getMerId()); + tradeSettle.setMerNo(tradeOrder.getMerNo()); + tradeSettle.setMerName(tradeOrder.getMerName()); + tradeSettle.setMerAbbreviate(tradeOrder.getMerAbbreviate()); + tradeSettle.setStoreId(tradeOrder.getStoreId()); + tradeSettle.setStoreName(tradeOrder.getStoreName()); + tradeSettle.setPlatformType(tradeOrder.getPlatformType()); + tradeSettle.setPlatformMerNo(tradeOrder.getPlatformMerNo()); + tradeSettle.setPlatformTradeNo(tradeOrder.getPlatformTradeNo()); + tradeSettle.setPlatformLogNo(tradeOrder.getPlatformLogNo()); + tradeSettle.setPayMode(tradeOrder.getPayMode()); + tradeSettle.setOutTradeNo(tradeOrder.getOutTradeNo()); + tradeSettle.setTradeAmount(tradeOrder.getAccSettleAmount()); + tradeSettle.setTradeType(TradeSettleTradeType.type1.getNumber()); + tradeSettle.setSettleAmount(tradeOrder.getAccSettleAmount()); + tradeSettle.setTradeTime(tradeOrder.getPayTime()); + tradeSettle.setShdFeeAmt(tradeOrder.getShdFeeAmt()); + tradeSettle.setSettleAmount(tradeOrder.getSettleAmount()); + tradeSettle.setSettleDate(tradeOrder.getSettleDate()); + tradeSettle.setFeeRate(tradeOrder.getFeeRate()); + tradeSettleService.editData(tradeSettle); } } catch (Exception e) { System.out.println(e); @@ -307,6 +333,7 @@ public class TradeOrderSchedule { if (queryTrans != null) { tradeOrderRefund.setShdFeeAmt(new BigDecimal(queryTrans.getString("fee_amount").replace("-",""))); tradeOrderRefund.setSettleAmount(new BigDecimal(queryTrans.getString("settle_amount").replace(",","").replace("-",""))); + tradeOrderRefund.setSettleDate(queryTrans.getDate("clear_date")); tradeOrderRefundService.editOrderRefund(tradeOrderRefund); // 查询交易 @@ -326,6 +353,33 @@ public class TradeOrderSchedule { tradeOrder.setShdFeeAmt(tradeOrder.getShdFeeAmt().subtract(tradeOrderRefund.getShdFeeAmt())); tradeOrder.setSettleAmount(tradeOrder.getSettleAmount().subtract(tradeOrderRefund.getSettleAmount())); tradeOrderService.editOrder(tradeOrder); + + + BsTradeSettle tradeSettle = new BsTradeSettle(); + tradeSettle.setCompanyId(tradeOrder.getCompanyId()); + tradeSettle.setAgentId(tradeOrder.getAgentId()); + tradeSettle.setSalesmanId(tradeOrder.getSalesmanId()); + tradeSettle.setSalesmanName(tradeOrder.getSalesmanName()); + tradeSettle.setMerId(tradeOrder.getMerId()); + tradeSettle.setMerNo(tradeOrder.getMerNo()); + tradeSettle.setMerName(tradeOrder.getMerName()); + tradeSettle.setMerAbbreviate(tradeOrder.getMerAbbreviate()); + tradeSettle.setStoreId(tradeOrder.getStoreId()); + tradeSettle.setStoreName(tradeOrder.getStoreName()); + tradeSettle.setPlatformType(tradeOrder.getPlatformType()); + tradeSettle.setPlatformMerNo(tradeOrder.getPlatformMerNo()); + tradeSettle.setPlatformTradeNo(tradeOrderRefund.getPlatformOrderNo()); + tradeSettle.setPlatformLogNo(tradeOrderRefund.getPlatformLogNo()); + tradeSettle.setPayMode(tradeOrder.getPayMode()); + tradeSettle.setOutTradeNo(tradeOrderRefund.getRefundNo()); + tradeSettle.setTradeType(TradeSettleTradeType.type2.getNumber()); + tradeSettle.setTradeAmount(tradeOrderRefund.getRefundAmount()); + tradeSettle.setTradeTime(tradeOrderRefund.getRefundTime()); + tradeSettle.setShdFeeAmt(tradeOrderRefund.getShdFeeAmt()); + tradeSettle.setSettleAmount(tradeOrderRefund.getSettleAmount()); + tradeSettle.setSettleDate(tradeOrderRefund.getSettleDate()); + tradeSettle.setFeeRate(tradeOrder.getFeeRate()); + tradeSettleService.editData(tradeSettle); } } } catch (Exception e) { @@ -334,7 +388,4 @@ public class TradeOrderSchedule { } } - public static void main(String[] args) { - System.out.println(new BigDecimal("-1.00".replace("-","")).toString()); - } } diff --git a/service/src/main/java/com/hfkj/dao/BsTradeOrderMapperExt.java b/service/src/main/java/com/hfkj/dao/BsTradeOrderMapperExt.java index 0868d1a..ba86c23 100644 --- a/service/src/main/java/com/hfkj/dao/BsTradeOrderMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsTradeOrderMapperExt.java @@ -45,15 +45,39 @@ public interface BsTradeOrderMapperExt { " SELECT date_add(date_sub(#{param.settleTimeS},interval 1 day), INTERVAL ( cast( help_topic_id AS signed INTEGER ) + 1 ) day) days " + " FROM mysql.help_topic " + " WHERE help_topic_id DATEDIFF(#{param.settleTimeE},date_sub(#{param.settleTimeS},interval 1 day)) ORDER BY help_topic_id) a " + - " LEFT JOIN (select " + + " LEFT JOIN (" + + " select " + + " a.settle_date settle_date," + + " (a.tradeNum + b.tradeNum) tradeNum," + + " (a.tradeAmount - b.tradeAmount) tradeAmount, " + + " (a.settleAmount - b.settleAmount) settleAmount, " + + " (a.shdFeeAmount - b.shdFeeAmount) shdFeeAmount " + + " from (select " + " settle_date, " + " count(1) tradeNum, " + - " sum(trade_actual_amount) tradeAmount, " + + " sum(trade_amount) tradeAmount, " + " sum(settle_amount) settleAmount, " + " sum(shd_fee_amt) shdFeeAmount " + - " from bs_trade_order " + - " where mer_no = #{param.merNo} and `status` = 3 and settle_date between #{param.settleTimeS} and #{param.settleTimeE} GROUP BY settle_date) b on b.settle_date = a.days " + - " ORDER BY a.days desc " + + " from bs_trade_settle " + + " where settle_date between #{param.settleTimeS} and #{param.settleTimeE} " + + " and mer_no = #{param.merNo} " + + " and trade_type = 1" + + " and `status` = 1" + + " GROUP BY settle_date) a," + + " (select " + + " settle_date, " + + " count(1) tradeNum, " + + " sum(trade_amount) tradeAmount, " + + " sum(settle_amount) settleAmount, " + + " sum(shd_fee_amt) shdFeeAmount " + + " from bs_trade_settle " + + " where settle_date between #{param.settleTimeS} and #{param.settleTimeE} " + + " and mer_no = #{param.merNo} " + + " and trade_type = 2" + + " and `status` = 1" + + " GROUP BY settle_date) b where a.settle_date = b.settle_date GROUP BY a.settle_date" + + " ) b on b.settle_date = a.days " + + " ORDER BY a.days desc;" + " ") List> queryTradeOrderDetailCount(@Param("param") Map param); diff --git a/service/src/main/java/com/hfkj/dao/BsTradeOrderRefundMapper.java b/service/src/main/java/com/hfkj/dao/BsTradeOrderRefundMapper.java index d8393b3..df541f5 100644 --- a/service/src/main/java/com/hfkj/dao/BsTradeOrderRefundMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsTradeOrderRefundMapper.java @@ -46,11 +46,11 @@ public interface BsTradeOrderRefundMapper extends BsTradeOrderRefundMapperExt { "refund_no, total_amount, ", "refund_amount, payer_amount, ", "shd_fee_amt, settle_amount, ", - "refund_reason, `status`, ", - "refund_time, create_time, ", - "update_time, operator_id, ", - "operator_name, ext_1, ", - "ext_2, ext_3)", + "settle_date, refund_reason, ", + "`status`, refund_time, ", + "create_time, update_time, ", + "operator_id, operator_name, ", + "ext_1, ext_2, ext_3)", "values (#{tradeOrderId,jdbcType=BIGINT}, #{outTradeNo,jdbcType=VARCHAR}, ", "#{agentId,jdbcType=BIGINT}, #{salesmanId,jdbcType=BIGINT}, ", "#{merId,jdbcType=BIGINT}, #{storeId,jdbcType=BIGINT}, #{platformType,jdbcType=INTEGER}, ", @@ -58,11 +58,11 @@ public interface BsTradeOrderRefundMapper extends BsTradeOrderRefundMapperExt { "#{refundNo,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL}, ", "#{refundAmount,jdbcType=DECIMAL}, #{payerAmount,jdbcType=DECIMAL}, ", "#{shdFeeAmt,jdbcType=DECIMAL}, #{settleAmount,jdbcType=DECIMAL}, ", - "#{refundReason,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", - "#{refundTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{updateTime,jdbcType=TIMESTAMP}, #{operatorId,jdbcType=BIGINT}, ", - "#{operatorName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ", - "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{settleDate,jdbcType=DATE}, #{refundReason,jdbcType=VARCHAR}, ", + "#{status,jdbcType=INTEGER}, #{refundTime,jdbcType=TIMESTAMP}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", + "#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(BsTradeOrderRefund record); @@ -89,6 +89,7 @@ public interface BsTradeOrderRefundMapper extends BsTradeOrderRefundMapperExt { @Result(column="payer_amount", property="payerAmount", jdbcType=JdbcType.DECIMAL), @Result(column="shd_fee_amt", property="shdFeeAmt", jdbcType=JdbcType.DECIMAL), @Result(column="settle_amount", property="settleAmount", jdbcType=JdbcType.DECIMAL), + @Result(column="settle_date", property="settleDate", jdbcType=JdbcType.DATE), @Result(column="refund_reason", property="refundReason", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP), @@ -106,8 +107,9 @@ public interface BsTradeOrderRefundMapper extends BsTradeOrderRefundMapperExt { "select", "id, trade_order_id, out_trade_no, agent_id, salesman_id, mer_id, store_id, platform_type, ", "platform_order_no, platform_log_no, refund_no, total_amount, refund_amount, ", - "payer_amount, shd_fee_amt, settle_amount, refund_reason, `status`, refund_time, ", - "create_time, update_time, operator_id, operator_name, ext_1, ext_2, ext_3", + "payer_amount, shd_fee_amt, settle_amount, settle_date, refund_reason, `status`, ", + "refund_time, create_time, update_time, operator_id, operator_name, ext_1, ext_2, ", + "ext_3", "from bs_trade_order_refund", "where id = #{id,jdbcType=BIGINT}" }) @@ -128,6 +130,7 @@ public interface BsTradeOrderRefundMapper extends BsTradeOrderRefundMapperExt { @Result(column="payer_amount", property="payerAmount", jdbcType=JdbcType.DECIMAL), @Result(column="shd_fee_amt", property="shdFeeAmt", jdbcType=JdbcType.DECIMAL), @Result(column="settle_amount", property="settleAmount", jdbcType=JdbcType.DECIMAL), + @Result(column="settle_date", property="settleDate", jdbcType=JdbcType.DATE), @Result(column="refund_reason", property="refundReason", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP), @@ -167,6 +170,7 @@ public interface BsTradeOrderRefundMapper extends BsTradeOrderRefundMapperExt { "payer_amount = #{payerAmount,jdbcType=DECIMAL},", "shd_fee_amt = #{shdFeeAmt,jdbcType=DECIMAL},", "settle_amount = #{settleAmount,jdbcType=DECIMAL},", + "settle_date = #{settleDate,jdbcType=DATE},", "refund_reason = #{refundReason,jdbcType=VARCHAR},", "`status` = #{status,jdbcType=INTEGER},", "refund_time = #{refundTime,jdbcType=TIMESTAMP},", diff --git a/service/src/main/java/com/hfkj/dao/BsTradeOrderRefundSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsTradeOrderRefundSqlProvider.java index e5669ea..a4ba584 100644 --- a/service/src/main/java/com/hfkj/dao/BsTradeOrderRefundSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsTradeOrderRefundSqlProvider.java @@ -88,6 +88,10 @@ public class BsTradeOrderRefundSqlProvider { sql.VALUES("settle_amount", "#{settleAmount,jdbcType=DECIMAL}"); } + if (record.getSettleDate() != null) { + sql.VALUES("settle_date", "#{settleDate,jdbcType=DATE}"); + } + if (record.getRefundReason() != null) { sql.VALUES("refund_reason", "#{refundReason,jdbcType=VARCHAR}"); } @@ -153,6 +157,7 @@ public class BsTradeOrderRefundSqlProvider { sql.SELECT("payer_amount"); sql.SELECT("shd_fee_amt"); sql.SELECT("settle_amount"); + sql.SELECT("settle_date"); sql.SELECT("refund_reason"); sql.SELECT("`status`"); sql.SELECT("refund_time"); @@ -244,6 +249,10 @@ public class BsTradeOrderRefundSqlProvider { sql.SET("settle_amount = #{record.settleAmount,jdbcType=DECIMAL}"); } + if (record.getSettleDate() != null) { + sql.SET("settle_date = #{record.settleDate,jdbcType=DATE}"); + } + if (record.getRefundReason() != null) { sql.SET("refund_reason = #{record.refundReason,jdbcType=VARCHAR}"); } @@ -308,6 +317,7 @@ public class BsTradeOrderRefundSqlProvider { sql.SET("payer_amount = #{record.payerAmount,jdbcType=DECIMAL}"); sql.SET("shd_fee_amt = #{record.shdFeeAmt,jdbcType=DECIMAL}"); sql.SET("settle_amount = #{record.settleAmount,jdbcType=DECIMAL}"); + sql.SET("settle_date = #{record.settleDate,jdbcType=DATE}"); sql.SET("refund_reason = #{record.refundReason,jdbcType=VARCHAR}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("refund_time = #{record.refundTime,jdbcType=TIMESTAMP}"); @@ -388,6 +398,10 @@ public class BsTradeOrderRefundSqlProvider { sql.SET("settle_amount = #{settleAmount,jdbcType=DECIMAL}"); } + if (record.getSettleDate() != null) { + sql.SET("settle_date = #{settleDate,jdbcType=DATE}"); + } + if (record.getRefundReason() != null) { sql.SET("refund_reason = #{refundReason,jdbcType=VARCHAR}"); } diff --git a/service/src/main/java/com/hfkj/dao/BsTradeSettleMapper.java b/service/src/main/java/com/hfkj/dao/BsTradeSettleMapper.java index cf73e90..36b7fb5 100644 --- a/service/src/main/java/com/hfkj/dao/BsTradeSettleMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsTradeSettleMapper.java @@ -49,8 +49,9 @@ public interface BsTradeSettleMapper extends BsTradeSettleMapperExt { "trade_type, trade_amount, ", "trade_time, shd_fee_amt, ", "settle_amount, settle_date, ", - "fee_rate, create_time, ", - "ext_1, ext_2, ext_3)", + "fee_rate, `status`, ", + "create_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}, #{merAbbreviate,jdbcType=VARCHAR}, ", @@ -61,8 +62,9 @@ public interface BsTradeSettleMapper extends BsTradeSettleMapperExt { "#{tradeType,jdbcType=INTEGER}, #{tradeAmount,jdbcType=DECIMAL}, ", "#{tradeTime,jdbcType=TIMESTAMP}, #{shdFeeAmt,jdbcType=DECIMAL}, ", "#{settleAmount,jdbcType=DECIMAL}, #{settleDate,jdbcType=DATE}, ", - "#{feeRate,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{feeRate,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(BsTradeSettle record); @@ -97,6 +99,7 @@ public interface BsTradeSettleMapper extends BsTradeSettleMapperExt { @Result(column="settle_amount", property="settleAmount", jdbcType=JdbcType.DECIMAL), @Result(column="settle_date", property="settleDate", jdbcType=JdbcType.DATE), @Result(column="fee_rate", property="feeRate", jdbcType=JdbcType.DECIMAL), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @@ -109,8 +112,8 @@ public interface BsTradeSettleMapper extends BsTradeSettleMapperExt { "id, company_id, agent_id, salesman_id, salesman_name, mer_id, mer_name, mer_abbreviate, ", "mer_no, store_id, store_name, platform_type, platform_mer_no, platform_trade_no, ", "platform_log_no, pay_mode, out_trade_no, trade_type, trade_amount, trade_time, ", - "shd_fee_amt, settle_amount, settle_date, fee_rate, create_time, ext_1, ext_2, ", - "ext_3", + "shd_fee_amt, settle_amount, settle_date, fee_rate, `status`, create_time, ext_1, ", + "ext_2, ext_3", "from bs_trade_settle", "where id = #{id,jdbcType=BIGINT}" }) @@ -139,6 +142,7 @@ public interface BsTradeSettleMapper extends BsTradeSettleMapperExt { @Result(column="settle_amount", property="settleAmount", jdbcType=JdbcType.DECIMAL), @Result(column="settle_date", property="settleDate", jdbcType=JdbcType.DATE), @Result(column="fee_rate", property="feeRate", jdbcType=JdbcType.DECIMAL), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @@ -180,6 +184,7 @@ public interface BsTradeSettleMapper extends BsTradeSettleMapperExt { "settle_amount = #{settleAmount,jdbcType=DECIMAL},", "settle_date = #{settleDate,jdbcType=DATE},", "fee_rate = #{feeRate,jdbcType=DECIMAL},", + "`status` = #{status,jdbcType=INTEGER},", "create_time = #{createTime,jdbcType=TIMESTAMP},", "ext_1 = #{ext1,jdbcType=VARCHAR},", "ext_2 = #{ext2,jdbcType=VARCHAR},", diff --git a/service/src/main/java/com/hfkj/dao/BsTradeSettleSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsTradeSettleSqlProvider.java index d542234..1e3044b 100644 --- a/service/src/main/java/com/hfkj/dao/BsTradeSettleSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsTradeSettleSqlProvider.java @@ -120,6 +120,10 @@ public class BsTradeSettleSqlProvider { sql.VALUES("fee_rate", "#{feeRate,jdbcType=DECIMAL}"); } + if (record.getStatus() != null) { + sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); + } + if (record.getCreateTime() != null) { sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); } @@ -169,6 +173,7 @@ public class BsTradeSettleSqlProvider { sql.SELECT("settle_amount"); sql.SELECT("settle_date"); sql.SELECT("fee_rate"); + sql.SELECT("`status`"); sql.SELECT("create_time"); sql.SELECT("ext_1"); sql.SELECT("ext_2"); @@ -286,6 +291,10 @@ public class BsTradeSettleSqlProvider { sql.SET("fee_rate = #{record.feeRate,jdbcType=DECIMAL}"); } + if (record.getStatus() != null) { + sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); + } + if (record.getCreateTime() != null) { sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); } @@ -334,6 +343,7 @@ public class BsTradeSettleSqlProvider { sql.SET("settle_amount = #{record.settleAmount,jdbcType=DECIMAL}"); sql.SET("settle_date = #{record.settleDate,jdbcType=DATE}"); sql.SET("fee_rate = #{record.feeRate,jdbcType=DECIMAL}"); + sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); @@ -440,6 +450,10 @@ public class BsTradeSettleSqlProvider { sql.SET("fee_rate = #{feeRate,jdbcType=DECIMAL}"); } + if (record.getStatus() != null) { + sql.SET("`status` = #{status,jdbcType=INTEGER}"); + } + if (record.getCreateTime() != null) { sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); } diff --git a/service/src/main/java/com/hfkj/entity/BsTradeOrderRefund.java b/service/src/main/java/com/hfkj/entity/BsTradeOrderRefund.java index f426daf..9d388c7 100644 --- a/service/src/main/java/com/hfkj/entity/BsTradeOrderRefund.java +++ b/service/src/main/java/com/hfkj/entity/BsTradeOrderRefund.java @@ -94,6 +94,11 @@ public class BsTradeOrderRefund implements Serializable { */ private BigDecimal settleAmount; + /** + * 结算日期 + */ + private Date settleDate; + /** * 退款原因 */ @@ -265,6 +270,14 @@ public class BsTradeOrderRefund implements Serializable { this.settleAmount = settleAmount; } + public Date getSettleDate() { + return settleDate; + } + + public void setSettleDate(Date settleDate) { + this.settleDate = settleDate; + } + public String getRefundReason() { return refundReason; } @@ -373,6 +386,7 @@ public class BsTradeOrderRefund implements Serializable { && (this.getPayerAmount() == null ? other.getPayerAmount() == null : this.getPayerAmount().equals(other.getPayerAmount())) && (this.getShdFeeAmt() == null ? other.getShdFeeAmt() == null : this.getShdFeeAmt().equals(other.getShdFeeAmt())) && (this.getSettleAmount() == null ? other.getSettleAmount() == null : this.getSettleAmount().equals(other.getSettleAmount())) + && (this.getSettleDate() == null ? other.getSettleDate() == null : this.getSettleDate().equals(other.getSettleDate())) && (this.getRefundReason() == null ? other.getRefundReason() == null : this.getRefundReason().equals(other.getRefundReason())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getRefundTime() == null ? other.getRefundTime() == null : this.getRefundTime().equals(other.getRefundTime())) @@ -405,6 +419,7 @@ public class BsTradeOrderRefund implements Serializable { result = prime * result + ((getPayerAmount() == null) ? 0 : getPayerAmount().hashCode()); result = prime * result + ((getShdFeeAmt() == null) ? 0 : getShdFeeAmt().hashCode()); result = prime * result + ((getSettleAmount() == null) ? 0 : getSettleAmount().hashCode()); + result = prime * result + ((getSettleDate() == null) ? 0 : getSettleDate().hashCode()); result = prime * result + ((getRefundReason() == null) ? 0 : getRefundReason().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getRefundTime() == null) ? 0 : getRefundTime().hashCode()); @@ -440,6 +455,7 @@ public class BsTradeOrderRefund implements Serializable { sb.append(", payerAmount=").append(payerAmount); sb.append(", shdFeeAmt=").append(shdFeeAmt); sb.append(", settleAmount=").append(settleAmount); + sb.append(", settleDate=").append(settleDate); sb.append(", refundReason=").append(refundReason); sb.append(", status=").append(status); sb.append(", refundTime=").append(refundTime); diff --git a/service/src/main/java/com/hfkj/entity/BsTradeOrderRefundExample.java b/service/src/main/java/com/hfkj/entity/BsTradeOrderRefundExample.java index ee26ff1..7a2615f 100644 --- a/service/src/main/java/com/hfkj/entity/BsTradeOrderRefundExample.java +++ b/service/src/main/java/com/hfkj/entity/BsTradeOrderRefundExample.java @@ -3,6 +3,7 @@ package com.hfkj.entity; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; +import java.util.Iterator; import java.util.List; public class BsTradeOrderRefundExample { @@ -126,6 +127,32 @@ public class BsTradeOrderRefundExample { criteria.add(new Criterion(condition, value1, value2)); } + protected void addCriterionForJDBCDate(String condition, Date value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + addCriterion(condition, new java.sql.Date(value.getTime()), property); + } + + protected void addCriterionForJDBCDate(String condition, List values, String property) { + if (values == null || values.size() == 0) { + throw new RuntimeException("Value list for " + property + " cannot be null or empty"); + } + List dateList = new ArrayList(); + Iterator iter = values.iterator(); + while (iter.hasNext()) { + dateList.add(new java.sql.Date(iter.next().getTime())); + } + addCriterion(condition, dateList, property); + } + + protected void addCriterionForJDBCDate(String condition, Date value1, Date value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + addCriterion(condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property); + } + public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; @@ -1126,6 +1153,66 @@ public class BsTradeOrderRefundExample { return (Criteria) this; } + public Criteria andSettleDateIsNull() { + addCriterion("settle_date is null"); + return (Criteria) this; + } + + public Criteria andSettleDateIsNotNull() { + addCriterion("settle_date is not null"); + return (Criteria) this; + } + + public Criteria andSettleDateEqualTo(Date value) { + addCriterionForJDBCDate("settle_date =", value, "settleDate"); + return (Criteria) this; + } + + public Criteria andSettleDateNotEqualTo(Date value) { + addCriterionForJDBCDate("settle_date <>", value, "settleDate"); + return (Criteria) this; + } + + public Criteria andSettleDateGreaterThan(Date value) { + addCriterionForJDBCDate("settle_date >", value, "settleDate"); + return (Criteria) this; + } + + public Criteria andSettleDateGreaterThanOrEqualTo(Date value) { + addCriterionForJDBCDate("settle_date >=", value, "settleDate"); + return (Criteria) this; + } + + public Criteria andSettleDateLessThan(Date value) { + addCriterionForJDBCDate("settle_date <", value, "settleDate"); + return (Criteria) this; + } + + public Criteria andSettleDateLessThanOrEqualTo(Date value) { + addCriterionForJDBCDate("settle_date <=", value, "settleDate"); + return (Criteria) this; + } + + public Criteria andSettleDateIn(List values) { + addCriterionForJDBCDate("settle_date in", values, "settleDate"); + return (Criteria) this; + } + + public Criteria andSettleDateNotIn(List values) { + addCriterionForJDBCDate("settle_date not in", values, "settleDate"); + return (Criteria) this; + } + + public Criteria andSettleDateBetween(Date value1, Date value2) { + addCriterionForJDBCDate("settle_date between", value1, value2, "settleDate"); + return (Criteria) this; + } + + public Criteria andSettleDateNotBetween(Date value1, Date value2) { + addCriterionForJDBCDate("settle_date not between", value1, value2, "settleDate"); + return (Criteria) this; + } + public Criteria andRefundReasonIsNull() { addCriterion("refund_reason is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/entity/BsTradeSettle.java b/service/src/main/java/com/hfkj/entity/BsTradeSettle.java index 42c53a6..a5b896d 100644 --- a/service/src/main/java/com/hfkj/entity/BsTradeSettle.java +++ b/service/src/main/java/com/hfkj/entity/BsTradeSettle.java @@ -104,7 +104,7 @@ public class BsTradeSettle implements Serializable { private String outTradeNo; /** - * 交易类型 1:支付 2:退款 + * 交易类型 1:支付 2:交易退款 */ private Integer tradeType; @@ -138,6 +138,11 @@ public class BsTradeSettle implements Serializable { */ private BigDecimal feeRate; + /** + * 状态 0:删除 1:正常 + */ + private Integer status; + /** * 创建时间 */ @@ -343,6 +348,14 @@ public class BsTradeSettle implements Serializable { this.feeRate = feeRate; } + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + public Date getCreateTime() { return createTime; } @@ -411,6 +424,7 @@ public class BsTradeSettle implements Serializable { && (this.getSettleAmount() == null ? other.getSettleAmount() == null : this.getSettleAmount().equals(other.getSettleAmount())) && (this.getSettleDate() == null ? other.getSettleDate() == null : this.getSettleDate().equals(other.getSettleDate())) && (this.getFeeRate() == null ? other.getFeeRate() == null : this.getFeeRate().equals(other.getFeeRate())) + && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) @@ -445,6 +459,7 @@ public class BsTradeSettle implements Serializable { result = prime * result + ((getSettleAmount() == null) ? 0 : getSettleAmount().hashCode()); result = prime * result + ((getSettleDate() == null) ? 0 : getSettleDate().hashCode()); result = prime * result + ((getFeeRate() == null) ? 0 : getFeeRate().hashCode()); + result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); @@ -482,6 +497,7 @@ public class BsTradeSettle implements Serializable { sb.append(", settleAmount=").append(settleAmount); sb.append(", settleDate=").append(settleDate); sb.append(", feeRate=").append(feeRate); + sb.append(", status=").append(status); sb.append(", createTime=").append(createTime); sb.append(", ext1=").append(ext1); sb.append(", ext2=").append(ext2); diff --git a/service/src/main/java/com/hfkj/entity/BsTradeSettleExample.java b/service/src/main/java/com/hfkj/entity/BsTradeSettleExample.java index b56d94d..87263b7 100644 --- a/service/src/main/java/com/hfkj/entity/BsTradeSettleExample.java +++ b/service/src/main/java/com/hfkj/entity/BsTradeSettleExample.java @@ -1693,6 +1693,66 @@ public class BsTradeSettleExample { return (Criteria) this; } + public Criteria andStatusIsNull() { + addCriterion("`status` is null"); + return (Criteria) this; + } + + public Criteria andStatusIsNotNull() { + addCriterion("`status` is not null"); + return (Criteria) this; + } + + public Criteria andStatusEqualTo(Integer value) { + addCriterion("`status` =", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotEqualTo(Integer value) { + addCriterion("`status` <>", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThan(Integer value) { + addCriterion("`status` >", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThanOrEqualTo(Integer value) { + addCriterion("`status` >=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThan(Integer value) { + addCriterion("`status` <", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThanOrEqualTo(Integer value) { + addCriterion("`status` <=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusIn(List values) { + addCriterion("`status` in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotIn(List values) { + addCriterion("`status` not in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusBetween(Integer value1, Integer value2) { + addCriterion("`status` between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotBetween(Integer value1, Integer value2) { + addCriterion("`status` not between", value1, value2, "status"); + return (Criteria) this; + } + public Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/service/impl/BsTradeSettleServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsTradeSettleServiceImpl.java index fa40ae1..5c0218c 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsTradeSettleServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsTradeSettleServiceImpl.java @@ -6,6 +6,7 @@ import com.hfkj.service.BsTradeSettleService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Date; import java.util.List; import java.util.Map; @@ -23,6 +24,8 @@ public class BsTradeSettleServiceImpl implements BsTradeSettleService { @Override public void editData(BsTradeSettle tradeSettle) { if (tradeSettle.getId() == null) { + tradeSettle.setStatus(1); + tradeSettle.setCreateTime(new Date()); tradeSettleMapper.insert(tradeSettle); } else { tradeSettleMapper.updateByPrimaryKey(tradeSettle); diff --git a/service/src/main/java/com/hfkj/sysenum/TradeSettleTradeType.java b/service/src/main/java/com/hfkj/sysenum/TradeSettleTradeType.java new file mode 100644 index 0000000..4c34cf5 --- /dev/null +++ b/service/src/main/java/com/hfkj/sysenum/TradeSettleTradeType.java @@ -0,0 +1,37 @@ +package com.hfkj.sysenum; + +/** + * @className: TradeSettleTradeType + * @author: HuRui + * @date: 2023/8/4 + **/ +public enum TradeSettleTradeType { + type1(1, "支付"), + type2(2, "交易退款"), + ; + + private Integer number; + + private String name; + + TradeSettleTradeType(int number, String name) { + this.number = number; + this.name = name; + } + + public Integer getNumber() { + return number; + } + + public void setNumber(Integer number) { + this.number = number; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/service/src/main/java/com/hfkj/unipush/UniPushService.java b/service/src/main/java/com/hfkj/unipush/UniPushService.java index dcc2af6..fbea08f 100644 --- a/service/src/main/java/com/hfkj/unipush/UniPushService.java +++ b/service/src/main/java/com/hfkj/unipush/UniPushService.java @@ -7,11 +7,19 @@ import com.getui.push.v2.sdk.GtApiConfiguration; import com.getui.push.v2.sdk.api.PushApi; import com.getui.push.v2.sdk.common.ApiResult; import com.getui.push.v2.sdk.dto.req.Audience; +import com.getui.push.v2.sdk.dto.req.message.PushChannel; import com.getui.push.v2.sdk.dto.req.message.PushDTO; import com.getui.push.v2.sdk.dto.req.message.PushMessage; +import com.getui.push.v2.sdk.dto.req.message.android.AndroidDTO; +import com.getui.push.v2.sdk.dto.req.message.android.ThirdNotification; +import com.getui.push.v2.sdk.dto.req.message.android.Ups; +import com.getui.push.v2.sdk.dto.req.message.ios.Alert; +import com.getui.push.v2.sdk.dto.req.message.ios.Aps; +import com.getui.push.v2.sdk.dto.req.message.ios.IosDTO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.HashMap; import java.util.Map; /** @@ -81,6 +89,79 @@ public class UniPushService { } } +/* *//** + * @Author Sum1Dream + * @Name androidTemplate + * @Description // 安卓模版 + * @Date 16:08 2023/6/9 + * @Param [uniPushModel] + * @Return void + *//* + public static Boolean pushToSingleByCid(JSONObject object) { + log.info("========= START 个推手机端推送 START ==========="); + + PushApi pushApi = createClient(); + //根据cid进行单推 + PushDTO pushDTO = new PushDTO<>(); + // 设置推送参数 + pushDTO.setRequestId(System.currentTimeMillis() + ""); + // 设置个推通道参数 + PushMessage pushMessage = new PushMessage(); + pushDTO.setPushMessage(pushMessage); + pushMessage.setTransmission(object.getString("body")); + + + Alert alert = new Alert(); + alert.setTitle("离线标题"); + alert.setBody(object.getString("body")); + + Aps aps = new Aps(); + aps.setAlert(alert); + + PushChannel pushChannel = new PushChannel(); + IosDTO iosDTO = new IosDTO(); + iosDTO.setType("notify"); + iosDTO.setAps(aps); + pushChannel.setIos(iosDTO); + + AndroidDTO androidDTO = new AndroidDTO(); + ThirdNotification thirdNotification = new ThirdNotification(); + thirdNotification.setTitle("离线标题"); + thirdNotification.setBody("离线内容"); + thirdNotification.setClickType("startapp"); + + Ups ups = new Ups(); + ups.setNotification(thirdNotification); + + Map> paramMap = new HashMap<>(); + Map huaweiMap = new HashMap<>(); + huaweiMap.put("/message/android/category", "FINANCE"); + huaweiMap.put("/message/android/ttl", "60"); + paramMap.put("HW", huaweiMap); + ups.setOptions(paramMap); + androidDTO.setUps(ups); + + pushChannel.setAndroid(androidDTO); + + pushDTO.setPushChannel(pushChannel); + + *//*设置接收人信息*//* + Audience audience = new Audience(); + pushDTO.setAudience(audience); + audience.addCid(object.getString("cid")); + log.info("个推-请求参数: " + JSON.toJSONString(pushDTO)); + // 进行cid单推 + ApiResult>> apiResult = pushApi.pushToSingleByCid(pushDTO); + log.info("个推-返回参数: " + JSON.toJSONString(apiResult)); + log.info("========= END 个推手机端推送 END ==========="); + + if (apiResult.isSuccess()) { + return apiResult.getData().toString().contains("successed_online"); + } else { + return false; + } + }*/ + }