Commit c09450ac949257ddae57f2e83b164c5692d2e1ef
1 parent
a28e3d3b
feat sync source
Showing
14 changed files
with
113 additions
and
79 deletions
cashier-mall/src/main/java/com/diligrp/cashier/mall/context/MallInitializeContext.java
| @@ -22,7 +22,7 @@ import java.util.Optional; | @@ -22,7 +22,7 @@ import java.util.Optional; | ||
| 22 | */ | 22 | */ |
| 23 | @Component | 23 | @Component |
| 24 | public class MallInitializeContext implements InitializingBean, DisposableBean { | 24 | public class MallInitializeContext implements InitializingBean, DisposableBean { |
| 25 | - private static final Logger log = LoggerFactory.getLogger(MallInitializeContext.class); | 25 | + private static final Logger LOG = LoggerFactory.getLogger(MallInitializeContext.class); |
| 26 | public static Map<Integer, AbstractSourceChannel> SOURCE_CHANNEL_MAP = Maps.newConcurrentMap(); | 26 | public static Map<Integer, AbstractSourceChannel> SOURCE_CHANNEL_MAP = Maps.newConcurrentMap(); |
| 27 | public static Map<Integer, AbstractPayChannel> PAY_CHANNEL_MAP = Maps.newConcurrentMap(); | 27 | public static Map<Integer, AbstractPayChannel> PAY_CHANNEL_MAP = Maps.newConcurrentMap(); |
| 28 | 28 | ||
| @@ -38,6 +38,7 @@ public class MallInitializeContext implements InitializingBean, DisposableBean { | @@ -38,6 +38,7 @@ public class MallInitializeContext implements InitializingBean, DisposableBean { | ||
| 38 | SpringContextUtils.getBeanOfTpe(AbstractPayChannel.class).forEach((key, value) -> { | 38 | SpringContextUtils.getBeanOfTpe(AbstractPayChannel.class).forEach((key, value) -> { |
| 39 | PAY_CHANNEL_MAP.put(value.getPayChannel(), value); | 39 | PAY_CHANNEL_MAP.put(value.getPayChannel(), value); |
| 40 | }); | 40 | }); |
| 41 | + LOG.info("MallInitializeContext initialize success"); | ||
| 41 | } | 42 | } |
| 42 | 43 | ||
| 43 | /** | 44 | /** |
| @@ -45,7 +46,7 @@ public class MallInitializeContext implements InitializingBean, DisposableBean { | @@ -45,7 +46,7 @@ public class MallInitializeContext implements InitializingBean, DisposableBean { | ||
| 45 | */ | 46 | */ |
| 46 | @Override | 47 | @Override |
| 47 | public void destroy() throws Exception { | 48 | public void destroy() throws Exception { |
| 48 | - log.info("spring container destroy"); | 49 | + LOG.info("spring container destroy"); |
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | /** | 52 | /** |
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/sams/package-info.java
0 → 100644
cashier-mall/src/main/java/com/diligrp/cashier/mall/exception/MallException.java
| @@ -13,10 +13,10 @@ import com.diligrp.cashier.shared.exception.PlatformServiceException; | @@ -13,10 +13,10 @@ import com.diligrp.cashier.shared.exception.PlatformServiceException; | ||
| 13 | public class MallException extends PlatformServiceException { | 13 | public class MallException extends PlatformServiceException { |
| 14 | 14 | ||
| 15 | public MallException(String message) { | 15 | public MallException(String message) { |
| 16 | - super(ErrorCode.SYSTEM_UNKNOWN_ERROR, message); | 16 | + super(ErrorCode.SYSTEM_UNKNOWN_ERROR, message, Boolean.TRUE); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | public MallException(String code, String message) { | 19 | public MallException(String code, String message) { |
| 20 | - super(code, message); | 20 | + super(code, message, Boolean.TRUE); |
| 21 | } | 21 | } |
| 22 | } | 22 | } |
cashier-mall/src/main/java/com/diligrp/cashier/mall/exception/RtMartMallException.java
| 1 | package com.diligrp.cashier.mall.exception; | 1 | package com.diligrp.cashier.mall.exception; |
| 2 | 2 | ||
| 3 | -import com.diligrp.cashier.mall.MallConstants; | ||
| 4 | import com.diligrp.cashier.mall.type.RtMarkErrorCode; | 3 | import com.diligrp.cashier.mall.type.RtMarkErrorCode; |
| 5 | import com.diligrp.cashier.shared.ErrorCode; | 4 | import com.diligrp.cashier.shared.ErrorCode; |
| 6 | 5 |
cashier-mall/src/main/java/com/diligrp/cashier/mall/model/MallBizOrder.java
| @@ -7,6 +7,7 @@ import com.diligrp.cashier.mall.type.OrderState; | @@ -7,6 +7,7 @@ import com.diligrp.cashier.mall.type.OrderState; | ||
| 7 | import com.diligrp.cashier.mall.type.RtmartState; | 7 | import com.diligrp.cashier.mall.type.RtmartState; |
| 8 | import com.diligrp.cashier.mall.util.MallSnowflakeKeyManager; | 8 | import com.diligrp.cashier.mall.util.MallSnowflakeKeyManager; |
| 9 | import com.diligrp.cashier.shared.domain.BaseDO; | 9 | import com.diligrp.cashier.shared.domain.BaseDO; |
| 10 | +import com.diligrp.cashier.shared.type.SourceType; | ||
| 10 | import com.diligrp.cashier.shared.util.SpringContextUtils; | 11 | import com.diligrp.cashier.shared.util.SpringContextUtils; |
| 11 | import com.diligrp.cashier.trade.type.SnowflakeKey; | 12 | import com.diligrp.cashier.trade.type.SnowflakeKey; |
| 12 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | 13 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| @@ -59,8 +60,8 @@ public class MallBizOrder extends BaseDO { | @@ -59,8 +60,8 @@ public class MallBizOrder extends BaseDO { | ||
| 59 | private String mchId; | 60 | private String mchId; |
| 60 | 61 | ||
| 61 | /** | 62 | /** |
| 62 | - * 订单来源(1大润发 2山姆)-换取回调地址 | ||
| 63 | - * @see com.diligrp.cashier.mall.type.OrderSource | 63 | + * 订单来源(10大润发 2山姆)-换取回调地址 |
| 64 | + * @see SourceType | ||
| 64 | */ | 65 | */ |
| 65 | private Integer source; | 66 | private Integer source; |
| 66 | 67 |
cashier-mall/src/main/java/com/diligrp/cashier/mall/model/MallBizPayment.java
| @@ -108,7 +108,6 @@ public class MallBizPayment extends BaseDO { | @@ -108,7 +108,6 @@ public class MallBizPayment extends BaseDO { | ||
| 108 | 108 | ||
| 109 | /** | 109 | /** |
| 110 | * 支付渠道(微信 园区卡) | 110 | * 支付渠道(微信 园区卡) |
| 111 | - * @see com.diligrp.cashier.mall.type.PaymentChanel | ||
| 112 | * @see com.diligrp.cashier.pipeline.type.ChannelType | 111 | * @see com.diligrp.cashier.pipeline.type.ChannelType |
| 113 | */ | 112 | */ |
| 114 | private Integer channelId; | 113 | private Integer channelId; |
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/impl/MallBizOrderServiceImpl.java
| @@ -17,10 +17,13 @@ import com.diligrp.cashier.mall.model.*; | @@ -17,10 +17,13 @@ import com.diligrp.cashier.mall.model.*; | ||
| 17 | import com.diligrp.cashier.mall.service.biz.MallBizOrderService; | 17 | import com.diligrp.cashier.mall.service.biz.MallBizOrderService; |
| 18 | import com.diligrp.cashier.mall.service.biz.MallBizPaymentService; | 18 | import com.diligrp.cashier.mall.service.biz.MallBizPaymentService; |
| 19 | import com.diligrp.cashier.mall.type.OrderState; | 19 | import com.diligrp.cashier.mall.type.OrderState; |
| 20 | +import com.diligrp.cashier.mall.type.OrderType; | ||
| 20 | import com.diligrp.cashier.mall.type.RtMarkErrorCode; | 21 | import com.diligrp.cashier.mall.type.RtMarkErrorCode; |
| 22 | +import com.diligrp.cashier.shared.exception.PlatformServiceException; | ||
| 21 | import com.diligrp.cashier.shared.spi.ICashierDeskManager; | 23 | import com.diligrp.cashier.shared.spi.ICashierDeskManager; |
| 22 | import com.diligrp.cashier.shared.spi.domain.CashierOrderBO; | 24 | import com.diligrp.cashier.shared.spi.domain.CashierOrderBO; |
| 23 | import com.diligrp.cashier.shared.spi.domain.PaymentUrlBO; | 25 | import com.diligrp.cashier.shared.spi.domain.PaymentUrlBO; |
| 26 | +import com.diligrp.cashier.shared.type.SourceType; | ||
| 24 | import com.diligrp.cashier.shared.util.JsonUtils; | 27 | import com.diligrp.cashier.shared.util.JsonUtils; |
| 25 | import jakarta.annotation.Resource; | 28 | import jakarta.annotation.Resource; |
| 26 | import org.apache.commons.collections4.CollectionUtils; | 29 | import org.apache.commons.collections4.CollectionUtils; |
| @@ -40,7 +43,6 @@ import java.util.Optional; | @@ -40,7 +43,6 @@ import java.util.Optional; | ||
| 40 | * @author dengwei | 43 | * @author dengwei |
| 41 | * @version 1.0.0 | 44 | * @version 1.0.0 |
| 42 | * @Description MallBizOrderServiceImpl | 45 | * @Description MallBizOrderServiceImpl |
| 43 | - * @date 2025-12-26 14:42 | ||
| 44 | */ | 46 | */ |
| 45 | @Service | 47 | @Service |
| 46 | public class MallBizOrderServiceImpl implements MallBizOrderService { | 48 | public class MallBizOrderServiceImpl implements MallBizOrderService { |
| @@ -63,7 +65,6 @@ public class MallBizOrderServiceImpl implements MallBizOrderService { | @@ -63,7 +65,6 @@ public class MallBizOrderServiceImpl implements MallBizOrderService { | ||
| 63 | 65 | ||
| 64 | /** | 66 | /** |
| 65 | * createOrder | 67 | * createOrder |
| 66 | - * | ||
| 67 | */ | 68 | */ |
| 68 | @Override | 69 | @Override |
| 69 | @Transactional(rollbackFor = {Exception.class}) | 70 | @Transactional(rollbackFor = {Exception.class}) |
| @@ -86,7 +87,6 @@ public class MallBizOrderServiceImpl implements MallBizOrderService { | @@ -86,7 +87,6 @@ public class MallBizOrderServiceImpl implements MallBizOrderService { | ||
| 86 | 87 | ||
| 87 | /** | 88 | /** |
| 88 | * info | 89 | * info |
| 89 | - * | ||
| 90 | */ | 90 | */ |
| 91 | @Override | 91 | @Override |
| 92 | public OrderPaymentVO info(OrderInfoCO orderInfoCo) { | 92 | public OrderPaymentVO info(OrderInfoCO orderInfoCo) { |
| @@ -178,7 +178,6 @@ public class MallBizOrderServiceImpl implements MallBizOrderService { | @@ -178,7 +178,6 @@ public class MallBizOrderServiceImpl implements MallBizOrderService { | ||
| 178 | 178 | ||
| 179 | /** | 179 | /** |
| 180 | * getByOrderId | 180 | * getByOrderId |
| 181 | - * | ||
| 182 | */ | 181 | */ |
| 183 | @Override | 182 | @Override |
| 184 | public MallBizOrder getByOrderId(String orderId) { | 183 | public MallBizOrder getByOrderId(String orderId) { |
| @@ -241,14 +240,18 @@ public class MallBizOrderServiceImpl implements MallBizOrderService { | @@ -241,14 +240,18 @@ public class MallBizOrderServiceImpl implements MallBizOrderService { | ||
| 241 | cashierOrderBO.setMchId(Long.valueOf(mallBizPayment.getMchId())); | 240 | cashierOrderBO.setMchId(Long.valueOf(mallBizPayment.getMchId())); |
| 242 | cashierOrderBO.setUserId(mallBizPayment.getUserCode()); | 241 | cashierOrderBO.setUserId(mallBizPayment.getUserCode()); |
| 243 | cashierOrderBO.setCashierType(2); | 242 | cashierOrderBO.setCashierType(2); |
| 244 | - cashierOrderBO.setGoods("大润发支付"); | ||
| 245 | cashierOrderBO.setAmount(mallBizPayment.getPayFee()); | 243 | cashierOrderBO.setAmount(mallBizPayment.getPayFee()); |
| 246 | cashierOrderBO.setOutTradeNo(mallBizPayment.getPayTradeNo()); | 244 | cashierOrderBO.setOutTradeNo(mallBizPayment.getPayTradeNo()); |
| 247 | // 支付成功跳转页面 | 245 | // 支付成功跳转页面 |
| 248 | cashierOrderBO.setRedirectUrl(mallBizPayment.getCashierResultUrl()); | 246 | cashierOrderBO.setRedirectUrl(mallBizPayment.getCashierResultUrl()); |
| 249 | - cashierOrderBO.setDescription("大润发在线支付"); | ||
| 250 | - cashierOrderBO.setAttach("大润发在线支付"); | ||
| 251 | cashierOrderBO.setTimeout(mallBizOrders.getFirst().getOrderExpire() * 1000); | 247 | cashierOrderBO.setTimeout(mallBizOrders.getFirst().getOrderExpire() * 1000); |
| 248 | + cashierOrderBO.setSource(mallBizOrders.getFirst().getSource()); | ||
| 249 | + cashierOrderBO.setGoods( | ||
| 250 | + SourceType.getName(mallBizOrders.getFirst().getSource()) + | ||
| 251 | + OrderType.getDescription(mallBizOrders.getFirst().getOrderType()) + "支付!" | ||
| 252 | + ); | ||
| 253 | + cashierOrderBO.setDescription(cashierOrderBO.getGoods()); | ||
| 254 | + cashierOrderBO.setAttach(cashierOrderBO.getGoods()); | ||
| 252 | PaymentUrlBO paymentUrlBO = cashierDeskManager.submitOrder(cashierOrderBO); | 255 | PaymentUrlBO paymentUrlBO = cashierDeskManager.submitOrder(cashierOrderBO); |
| 253 | Optional.ofNullable(paymentUrlBO).ifPresent(vo -> { | 256 | Optional.ofNullable(paymentUrlBO).ifPresent(vo -> { |
| 254 | mallBizPayment.setCashierUrl(vo.paymentUrl()); | 257 | mallBizPayment.setCashierUrl(vo.paymentUrl()); |
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/sourcechannel/RtMallChannel.java
| @@ -11,12 +11,12 @@ import com.diligrp.cashier.mall.model.MallBizPayment; | @@ -11,12 +11,12 @@ import com.diligrp.cashier.mall.model.MallBizPayment; | ||
| 11 | import com.diligrp.cashier.mall.model.MallBizPaymentOrder; | 11 | import com.diligrp.cashier.mall.model.MallBizPaymentOrder; |
| 12 | import com.diligrp.cashier.mall.model.MallBizRefund; | 12 | import com.diligrp.cashier.mall.model.MallBizRefund; |
| 13 | import com.diligrp.cashier.mall.property.RtMallDynamicProperty; | 13 | import com.diligrp.cashier.mall.property.RtMallDynamicProperty; |
| 14 | -import com.diligrp.cashier.mall.type.OrderSource; | ||
| 15 | import com.diligrp.cashier.mall.type.OrderType; | 14 | import com.diligrp.cashier.mall.type.OrderType; |
| 16 | import com.diligrp.cashier.mall.util.HttpClientUtils; | 15 | import com.diligrp.cashier.mall.util.HttpClientUtils; |
| 17 | import com.diligrp.cashier.mall.util.RtMallSignMd5Utils; | 16 | import com.diligrp.cashier.mall.util.RtMallSignMd5Utils; |
| 18 | import com.diligrp.cashier.shared.spi.domain.PaymentResultBO; | 17 | import com.diligrp.cashier.shared.spi.domain.PaymentResultBO; |
| 19 | import com.diligrp.cashier.shared.spi.domain.RefundResultBO; | 18 | import com.diligrp.cashier.shared.spi.domain.RefundResultBO; |
| 19 | +import com.diligrp.cashier.shared.type.SourceType; | ||
| 20 | import com.diligrp.cashier.shared.util.DateUtils; | 20 | import com.diligrp.cashier.shared.util.DateUtils; |
| 21 | import com.diligrp.cashier.shared.util.JsonUtils; | 21 | import com.diligrp.cashier.shared.util.JsonUtils; |
| 22 | import com.diligrp.cashier.shared.util.UrlParamParserUtils; | 22 | import com.diligrp.cashier.shared.util.UrlParamParserUtils; |
| @@ -125,7 +125,7 @@ public class RtMallChannel extends AbstractSourceChannel { | @@ -125,7 +125,7 @@ public class RtMallChannel extends AbstractSourceChannel { | ||
| 125 | param.put("event", event); | 125 | param.put("event", event); |
| 126 | param.put("mallBizPayment", mallBizPayment); | 126 | param.put("mallBizPayment", mallBizPayment); |
| 127 | param.put("callBackMethod", "pay"); | 127 | param.put("callBackMethod", "pay"); |
| 128 | - param.put("source", OrderSource.RT_MART.getCode()); | 128 | + param.put("source", mallBizOrder.getSource()); |
| 129 | sendDelayMessage(JsonUtils.toJsonString(param)); | 129 | sendDelayMessage(JsonUtils.toJsonString(param)); |
| 130 | } | 130 | } |
| 131 | LOG.info("payCallBack message: {}", JsonUtils.toJsonString(message)); | 131 | LOG.info("payCallBack message: {}", JsonUtils.toJsonString(message)); |
| @@ -153,7 +153,7 @@ public class RtMallChannel extends AbstractSourceChannel { | @@ -153,7 +153,7 @@ public class RtMallChannel extends AbstractSourceChannel { | ||
| 153 | param.put("event", event); | 153 | param.put("event", event); |
| 154 | param.put("mallBizRefund", mallBizRefund); | 154 | param.put("mallBizRefund", mallBizRefund); |
| 155 | param.put("callBackMethod", "refund"); | 155 | param.put("callBackMethod", "refund"); |
| 156 | - param.put("source", OrderSource.RT_MART.getCode()); | 156 | + param.put("source", mallBizOrder.getSource()); |
| 157 | sendDelayMessage(JsonUtils.toJsonString(param)); | 157 | sendDelayMessage(JsonUtils.toJsonString(param)); |
| 158 | } | 158 | } |
| 159 | LOG.info("refundCallBack message: {}", JsonUtils.toJsonString(message)); | 159 | LOG.info("refundCallBack message: {}", JsonUtils.toJsonString(message)); |
| @@ -180,6 +180,6 @@ public class RtMallChannel extends AbstractSourceChannel { | @@ -180,6 +180,6 @@ public class RtMallChannel extends AbstractSourceChannel { | ||
| 180 | 180 | ||
| 181 | @Override | 181 | @Override |
| 182 | public Integer source() { | 182 | public Integer source() { |
| 183 | - return OrderSource.RT_MART.getCode(); | 183 | + return SourceType.RTMARK.getCode(); |
| 184 | } | 184 | } |
| 185 | } | 185 | } |
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/sourcechannel/SamMallChannel.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.service.sourcechannel; | ||
| 2 | + | ||
| 3 | +import com.diligrp.cashier.mall.domain.rtmall.co.AuthLoginCO; | ||
| 4 | +import com.diligrp.cashier.mall.domain.rtmall.vo.UserInfoVO; | ||
| 5 | +import com.diligrp.cashier.mall.model.MallBizPayment; | ||
| 6 | +import com.diligrp.cashier.mall.model.MallBizRefund; | ||
| 7 | +import com.diligrp.cashier.mall.property.RtMallDynamicProperty; | ||
| 8 | +import com.diligrp.cashier.shared.spi.domain.PaymentResultBO; | ||
| 9 | +import com.diligrp.cashier.shared.spi.domain.RefundResultBO; | ||
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 12 | +import org.springframework.stereotype.Component; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @ClassName SamsMallChannel.java | ||
| 16 | + * @author dengwei | ||
| 17 | + * @version 1.0.0 | ||
| 18 | + * 山姆订单来源渠道 | ||
| 19 | + * @Description SamMallChannel | ||
| 20 | + */ | ||
| 21 | +@Component | ||
| 22 | +public class SamMallChannel extends AbstractSourceChannel { | ||
| 23 | + private static final Logger LOG = LoggerFactory.getLogger(SamMallChannel.class); | ||
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + public String authUrl(AuthLoginCO authLogin, String token, long timestamp) { | ||
| 27 | + return ""; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + public void userInfoChannel(UserInfoVO authLogin, RtMallDynamicProperty.AppSecretDynamicProperty userInfoVO) { | ||
| 32 | + | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public void payCallBack(PaymentResultBO event, MallBizPayment mallBizPayment) { | ||
| 37 | + | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + public void refundCallBack(RefundResultBO event, MallBizRefund mallBizRefund) { | ||
| 42 | + | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @Override | ||
| 46 | + public Integer source() { | ||
| 47 | + return 20; | ||
| 48 | + } | ||
| 49 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/type/OrderSource.java deleted
100644 → 0
| 1 | -package com.diligrp.cashier.mall.type; | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | - * @ClassName OrderSrouce.java | ||
| 5 | - * @author dengwei | ||
| 6 | - * @version 1.0.0 | ||
| 7 | - * @Description OrderSource | ||
| 8 | - * @date 2025-12-25 15:11 | ||
| 9 | - */ | ||
| 10 | -public enum OrderSource { | ||
| 11 | - RT_MART(1, "大润发"), | ||
| 12 | - SAM_CLUB(2, "山姆"); | ||
| 13 | - | ||
| 14 | - public final int code; | ||
| 15 | - public final String name; | ||
| 16 | - | ||
| 17 | - OrderSource(int code, String name) { | ||
| 18 | - this.code = code; | ||
| 19 | - this.name = name; | ||
| 20 | - } | ||
| 21 | - | ||
| 22 | - public int getCode() { | ||
| 23 | - return code; | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | - public String getName() { | ||
| 27 | - return name; | ||
| 28 | - } | ||
| 29 | -} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/type/OrderType.java
| 1 | package com.diligrp.cashier.mall.type; | 1 | package com.diligrp.cashier.mall.type; |
| 2 | 2 | ||
| 3 | +import java.util.Arrays; | ||
| 4 | +import java.util.Map; | ||
| 5 | +import java.util.stream.Collectors; | ||
| 6 | + | ||
| 3 | /** | 7 | /** |
| 4 | * @ClassName OrderType.java | 8 | * @ClassName OrderType.java |
| 5 | * @author dengwei | 9 | * @author dengwei |
| 6 | * @version 1.0.0 | 10 | * @version 1.0.0 |
| 7 | * @Description OrderType | 11 | * @Description OrderType |
| 8 | - * @date 2025-12-25 11:17 | ||
| 9 | */ | 12 | */ |
| 10 | public enum OrderType { | 13 | public enum OrderType { |
| 11 | OFFLINE_SCAN(1, "线下扫码购"), | 14 | OFFLINE_SCAN(1, "线下扫码购"), |
| 12 | API_SCAN(2, "接口扫码购"), | 15 | API_SCAN(2, "接口扫码购"), |
| 13 | - MINI_PROGRAM(3, "小程序"); | 16 | + MINI_PROGRAM(3, "小程序"), |
| 17 | + ; | ||
| 14 | 18 | ||
| 15 | public final int code; | 19 | public final int code; |
| 16 | public final String description; | 20 | public final String description; |
| 17 | 21 | ||
| 22 | + private static final Map<Integer, String> DATA = Arrays | ||
| 23 | + .stream(values()) | ||
| 24 | + .collect(Collectors.toMap(OrderType::getCode, OrderType::getDescription)); | ||
| 25 | + | ||
| 18 | OrderType(int code, String description) { | 26 | OrderType(int code, String description) { |
| 19 | this.code = code; | 27 | this.code = code; |
| 20 | this.description = description; | 28 | this.description = description; |
| @@ -27,4 +35,8 @@ public enum OrderType { | @@ -27,4 +35,8 @@ public enum OrderType { | ||
| 27 | public String getDescription() { | 35 | public String getDescription() { |
| 28 | return description; | 36 | return description; |
| 29 | } | 37 | } |
| 38 | + | ||
| 39 | + public static String getDescription(int code) { | ||
| 40 | + return DATA.get(code); | ||
| 41 | + } | ||
| 30 | } | 42 | } |
cashier-mall/src/main/java/com/diligrp/cashier/mall/type/PaymentChanel.java deleted
100644 → 0
| 1 | -package com.diligrp.cashier.mall.type; | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | - * @ClassName PaymentChanel.java | ||
| 5 | - * @author dengwei | ||
| 6 | - * @version 1.0.0 | ||
| 7 | - * @Description PaymentChanel | ||
| 8 | - */ | ||
| 9 | -public enum PaymentChanel { | ||
| 10 | - WECHAT(10, "微信"), | ||
| 11 | - PARK_CARD(19, "园区卡"); | ||
| 12 | - | ||
| 13 | - private final int code; | ||
| 14 | - private final String description; | ||
| 15 | - | ||
| 16 | - PaymentChanel(int code, String description) { | ||
| 17 | - this.code = code; | ||
| 18 | - this.description = description; | ||
| 19 | - } | ||
| 20 | - | ||
| 21 | - public int getCode() { | ||
| 22 | - return code; | ||
| 23 | - } | ||
| 24 | - | ||
| 25 | - public String getDescription() { | ||
| 26 | - return description; | ||
| 27 | - } | ||
| 28 | -} |
cashier-shared/src/main/java/com/diligrp/cashier/shared/SharedConfiguration.java
| @@ -31,6 +31,8 @@ import java.time.LocalDateTime; | @@ -31,6 +31,8 @@ import java.time.LocalDateTime; | ||
| 31 | import java.time.LocalTime; | 31 | import java.time.LocalTime; |
| 32 | import java.time.format.DateTimeFormatter; | 32 | import java.time.format.DateTimeFormatter; |
| 33 | import java.util.Date; | 33 | import java.util.Date; |
| 34 | +import java.util.concurrent.Executor; | ||
| 35 | +import java.util.concurrent.Executors; | ||
| 34 | 36 | ||
| 35 | @Configuration | 37 | @Configuration |
| 36 | @ComponentScan("com.diligrp.cashier.shared") | 38 | @ComponentScan("com.diligrp.cashier.shared") |
| @@ -163,4 +165,13 @@ public class SharedConfiguration { | @@ -163,4 +165,13 @@ public class SharedConfiguration { | ||
| 163 | return new SecretKeySpec(source.getBytes(StandardCharsets.UTF_8), "HmacSHA256"); | 165 | return new SecretKeySpec(source.getBytes(StandardCharsets.UTF_8), "HmacSHA256"); |
| 164 | } | 166 | } |
| 165 | } | 167 | } |
| 166 | -} | ||
| 167 | \ No newline at end of file | 168 | \ No newline at end of file |
| 169 | + | ||
| 170 | + /** | ||
| 171 | + * 配置虚拟线程池 | ||
| 172 | + * 虚拟线程池不需要设置核心线程数等等factory | ||
| 173 | + */ | ||
| 174 | + @Bean(name = "virtualThreadPoolTaskExecutor") | ||
| 175 | + public Executor virtualThreadPoolTaskExecutor() { | ||
| 176 | + return Executors.newVirtualThreadPerTaskExecutor(); | ||
| 177 | + } | ||
| 178 | +} |
cashier-shared/src/main/java/com/diligrp/cashier/shared/exception/PlatformServiceException.java
| @@ -26,6 +26,14 @@ public class PlatformServiceException extends RuntimeException { | @@ -26,6 +26,14 @@ public class PlatformServiceException extends RuntimeException { | ||
| 26 | this.stackTrace = false; | 26 | this.stackTrace = false; |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | + public PlatformServiceException(String code, String message, boolean stackTrace) { | ||
| 30 | + super(message); | ||
| 31 | + if (stackTrace) { | ||
| 32 | + super.fillInStackTrace(); | ||
| 33 | + } | ||
| 34 | + this.code = code; | ||
| 35 | + } | ||
| 36 | + | ||
| 29 | public PlatformServiceException(String message, Throwable ex) { | 37 | public PlatformServiceException(String message, Throwable ex) { |
| 30 | super(message, ex); | 38 | super(message, ex); |
| 31 | } | 39 | } |