Commit c2b3929b7f6524c83855df04e114a90573503e40
1 parent
30fe1245
feat hourbuy init
Showing
48 changed files
with
1305 additions
and
95 deletions
cashier-boss/src/main/java/com/diligrp/cashier/boss/aop/LogPrintAop.java
| @@ -14,6 +14,8 @@ import org.slf4j.Logger; | @@ -14,6 +14,8 @@ import org.slf4j.Logger; | ||
| 14 | import org.slf4j.LoggerFactory; | 14 | import org.slf4j.LoggerFactory; |
| 15 | import org.springframework.core.annotation.Order; | 15 | import org.springframework.core.annotation.Order; |
| 16 | import org.springframework.stereotype.Component; | 16 | import org.springframework.stereotype.Component; |
| 17 | +import org.springframework.web.context.request.RequestContextHolder; | ||
| 18 | +import org.springframework.web.context.request.ServletRequestAttributes; | ||
| 17 | import org.springframework.web.multipart.MultipartFile; | 19 | import org.springframework.web.multipart.MultipartFile; |
| 18 | 20 | ||
| 19 | import java.util.*; | 21 | import java.util.*; |
| @@ -51,6 +53,10 @@ public class LogPrintAop { | @@ -51,6 +53,10 @@ public class LogPrintAop { | ||
| 51 | 53 | ||
| 52 | Map<String, Object> logInfo = new LinkedHashMap<>(2); | 54 | Map<String, Object> logInfo = new LinkedHashMap<>(2); |
| 53 | logInfo.put("version", VERSION); | 55 | logInfo.put("version", VERSION); |
| 56 | + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); | ||
| 57 | + if (Objects.nonNull(attributes)) { | ||
| 58 | + logInfo.put("uri", attributes.getRequest().getRequestURI()); | ||
| 59 | + } | ||
| 54 | logInfo.put("method", className); | 60 | logInfo.put("method", className); |
| 55 | logInfo.put("args", argsList); | 61 | logInfo.put("args", argsList); |
| 56 | log.info("{}:{}", commonParamLogPrint.desc(), JsonUtils.toJsonString(logInfo)); | 62 | log.info("{}:{}", commonParamLogPrint.desc(), JsonUtils.toJsonString(logInfo)); |
cashier-mall/src/main/java/com/diligrp/cashier/mall/MallConstants.java
| 1 | package com.diligrp.cashier.mall; | 1 | package com.diligrp.cashier.mall; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import com.diligrp.cashier.shared.Constants; | ||
| 5 | + | ||
| 4 | /** | 6 | /** |
| 5 | * 商城常量 | 7 | * 商城常量 |
| 6 | */ | 8 | */ |
| @@ -10,6 +12,6 @@ public interface MallConstants { | @@ -10,6 +12,6 @@ public interface MallConstants { | ||
| 10 | 12 | ||
| 11 | Integer RT_MALL_SOURCE = 1; | 13 | Integer RT_MALL_SOURCE = 1; |
| 12 | 14 | ||
| 13 | - String MALL_TOKEN = "mall_token:"; | ||
| 14 | - String MALL_USER_INFO = "mall_user_info:"; | 15 | + String MALL_TOKEN = Constants.PRODUCT_NAME + "mall_token:"; |
| 16 | + String MALL_USER_INFO = Constants.PRODUCT_NAME + "mall_user_info:"; | ||
| 15 | } | 17 | } |
cashier-mall/src/main/java/com/diligrp/cashier/mall/api/MallAuthApi.java
| @@ -9,6 +9,7 @@ import com.diligrp.cashier.mall.domain.rtmall.vo.UserInfoVO; | @@ -9,6 +9,7 @@ import com.diligrp.cashier.mall.domain.rtmall.vo.UserInfoVO; | ||
| 9 | import com.diligrp.cashier.mall.exception.RtMartMallException; | 9 | import com.diligrp.cashier.mall.exception.RtMartMallException; |
| 10 | import com.diligrp.cashier.mall.sign.RtMallSign; | 10 | import com.diligrp.cashier.mall.sign.RtMallSign; |
| 11 | import com.diligrp.cashier.mall.type.RtMarkErrorCode; | 11 | import com.diligrp.cashier.mall.type.RtMarkErrorCode; |
| 12 | +import com.diligrp.cashier.mall.util.RtMallValidateUtils; | ||
| 12 | import com.diligrp.cashier.shared.annotation.ParamLogPrint; | 13 | import com.diligrp.cashier.shared.annotation.ParamLogPrint; |
| 13 | import com.diligrp.cashier.shared.annotation.Sign; | 14 | import com.diligrp.cashier.shared.annotation.Sign; |
| 14 | import com.diligrp.cashier.shared.domain.Message; | 15 | import com.diligrp.cashier.shared.domain.Message; |
| @@ -33,7 +34,7 @@ import java.util.Objects; | @@ -33,7 +34,7 @@ import java.util.Objects; | ||
| 33 | * @Description MallAuthApi | 34 | * @Description MallAuthApi |
| 34 | */ | 35 | */ |
| 35 | @RestController | 36 | @RestController |
| 36 | -@RequestMapping("/mall/auth") | 37 | +@RequestMapping(path = {"/mall", "/rt/mall"}) |
| 37 | @Validated | 38 | @Validated |
| 38 | public class MallAuthApi { | 39 | public class MallAuthApi { |
| 39 | private static final Logger log = LoggerFactory.getLogger(MallAuthApi.class); | 40 | private static final Logger log = LoggerFactory.getLogger(MallAuthApi.class); |
| @@ -43,10 +44,10 @@ public class MallAuthApi { | @@ -43,10 +44,10 @@ public class MallAuthApi { | ||
| 43 | /** | 44 | /** |
| 44 | * 获取授权连接 | 45 | * 获取授权连接 |
| 45 | */ | 46 | */ |
| 46 | - @PostMapping("") | 47 | + @PostMapping("/auth") |
| 47 | @ParamLogPrint(outPrint = true) | 48 | @ParamLogPrint(outPrint = true) |
| 48 | public Message<String> authLogin(@RequestBody @Valid AuthLoginCO authLogin) { | 49 | public Message<String> authLogin(@RequestBody @Valid AuthLoginCO authLogin) { |
| 49 | - return Message.success(MallInitializeContext.getByChannel(authLogin.getChannel()).authLogin(authLogin)); | 50 | + return Message.success(MallInitializeContext.getBySource(authLogin.getSource()).authLogin(authLogin)); |
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | /** | 53 | /** |
| @@ -57,12 +58,16 @@ public class MallAuthApi { | @@ -57,12 +58,16 @@ public class MallAuthApi { | ||
| 57 | @Sign(sign = RtMallSign.class) | 58 | @Sign(sign = RtMallSign.class) |
| 58 | public RtMarkMessage<UserInfoVO> userInfo(@RequestBody @Valid Object req) { | 59 | public RtMarkMessage<UserInfoVO> userInfo(@RequestBody @Valid Object req) { |
| 59 | UserInfoCO userInfo = JsonUtils.convertValue(req, UserInfoCO.class); | 60 | UserInfoCO userInfo = JsonUtils.convertValue(req, UserInfoCO.class); |
| 61 | + RtMallValidateUtils.valid(userInfo); | ||
| 62 | + | ||
| 63 | + // token认证 | ||
| 60 | Object cache = redisTemplate.opsForValue().get(MallConstants.MALL_TOKEN + userInfo.getToken()); | 64 | Object cache = redisTemplate.opsForValue().get(MallConstants.MALL_TOKEN + userInfo.getToken()); |
| 61 | if (Objects.isNull(cache)) { | 65 | if (Objects.isNull(cache)) { |
| 62 | throw new RtMartMallException(RtMarkErrorCode.E5001); | 66 | throw new RtMartMallException(RtMarkErrorCode.E5001); |
| 63 | } | 67 | } |
| 68 | + | ||
| 64 | AuthLoginCO authLogin = JsonUtils.fromJsonString(Objects.requireNonNull(cache).toString(), AuthLoginCO.class); | 69 | AuthLoginCO authLogin = JsonUtils.fromJsonString(Objects.requireNonNull(cache).toString(), AuthLoginCO.class); |
| 65 | - UserInfoVO userInfoVO = MallInitializeContext.getByChannel(authLogin.getChannel()).userInfo(authLogin); | 70 | + UserInfoVO userInfoVO = MallInitializeContext.getBySource(authLogin.getSource()).userInfo(authLogin); |
| 66 | return RtMarkMessage.success(userInfoVO); | 71 | return RtMarkMessage.success(userInfoVO); |
| 67 | } | 72 | } |
| 68 | } | 73 | } |
cashier-mall/src/main/java/com/diligrp/cashier/mall/api/RtMallOrderApi.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.api; | ||
| 2 | + | ||
| 3 | +import com.diligrp.cashier.mall.domain.rtmall.RtMarkMessage; | ||
| 4 | +import com.diligrp.cashier.mall.domain.rtmall.co.OrderCO; | ||
| 5 | +import com.diligrp.cashier.mall.domain.rtmall.co.OrderInfoCO; | ||
| 6 | +import com.diligrp.cashier.mall.domain.rtmall.vo.OrderPaymentVO; | ||
| 7 | +import com.diligrp.cashier.mall.domain.rtmall.vo.OrderSuccessVO; | ||
| 8 | +import com.diligrp.cashier.mall.service.biz.MallBizOrderService; | ||
| 9 | +import com.diligrp.cashier.mall.sign.RtMallSign; | ||
| 10 | +import com.diligrp.cashier.mall.util.RtMallValidateUtils; | ||
| 11 | +import com.diligrp.cashier.shared.annotation.ParamLogPrint; | ||
| 12 | +import com.diligrp.cashier.shared.annotation.RepeatSubmit; | ||
| 13 | +import com.diligrp.cashier.shared.annotation.Sign; | ||
| 14 | +import com.diligrp.cashier.shared.handler.duplication.SpelDuplicationSubmit; | ||
| 15 | +import com.diligrp.cashier.shared.util.JsonUtils; | ||
| 16 | +import jakarta.annotation.Resource; | ||
| 17 | +import jakarta.validation.Valid; | ||
| 18 | +import org.springframework.validation.annotation.Validated; | ||
| 19 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 20 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 21 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 22 | +import org.springframework.web.bind.annotation.RestController; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * @ClassName RtMallOrderApi.java | ||
| 26 | + * @author dengwei | ||
| 27 | + * @version 1.0.0 | ||
| 28 | + * @Description RtMallOrderApi | ||
| 29 | + * @date 2025-12-26 11:31 | ||
| 30 | + */ | ||
| 31 | +@RestController | ||
| 32 | +@RequestMapping(path = {"/api/rt/mall", "/rt/mall"}) | ||
| 33 | +@Validated | ||
| 34 | +public class RtMallOrderApi { | ||
| 35 | + @Resource | ||
| 36 | + private MallBizOrderService mallBizOrderService; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * createOrder | ||
| 40 | + * @see https://shopex.yuque.com/hl0rrx/vlp0m4/nkwt5yrhdfzoy78s?singleDoc#oJ2JC | ||
| 41 | + * 创建订单接口 | ||
| 42 | + */ | ||
| 43 | + @PostMapping("/order/v1") | ||
| 44 | + @ParamLogPrint(outPrint = true) | ||
| 45 | + @Sign(sign = RtMallSign.class) | ||
| 46 | + @RepeatSubmit(prefix = "order_sync:", value = "#req['order_id']", duplicationSubmit = SpelDuplicationSubmit.class) | ||
| 47 | + public RtMarkMessage<OrderSuccessVO> createOrder(@Valid @RequestBody Object req) { | ||
| 48 | + OrderCO orderCo = JsonUtils.convertValue(req, OrderCO.class); | ||
| 49 | + RtMallValidateUtils.valid(orderCo); | ||
| 50 | + return RtMarkMessage.success(mallBizOrderService.createOrder(orderCo)); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * info | ||
| 55 | + * @see https://shopex.yuque.com/hl0rrx/vlp0m4/nkwt5yrhdfzoy78s?singleDoc#oJ2JC | ||
| 56 | + * 查询订单状态 | ||
| 57 | + */ | ||
| 58 | + @PostMapping("/order/v1/info") | ||
| 59 | + @ParamLogPrint(outPrint = true) | ||
| 60 | + @Sign(sign = RtMallSign.class) | ||
| 61 | + public RtMarkMessage<OrderPaymentVO> info(@Valid @RequestBody Object req) { | ||
| 62 | + OrderInfoCO orderInfoCo = JsonUtils.convertValue(req, OrderInfoCO.class); | ||
| 63 | + RtMallValidateUtils.valid(orderInfoCo); | ||
| 64 | + return RtMarkMessage.success(mallBizOrderService.info(orderInfoCo)); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * statusCallback | ||
| 69 | + * @see https://shopex.yuque.com/hl0rrx/vlp0m4/nkwt5yrhdfzoy78s?singleDoc#oJ2JC | ||
| 70 | + * 查询订单状态 | ||
| 71 | + */ | ||
| 72 | + @PostMapping("/order/v1/status/callback") | ||
| 73 | + @ParamLogPrint(outPrint = true) | ||
| 74 | + @Sign(sign = RtMallSign.class) | ||
| 75 | + public RtMarkMessage<?> statusCallback(@Valid @RequestBody Object req) { | ||
| 76 | + return RtMarkMessage.success(); | ||
| 77 | + } | ||
| 78 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/api/RtMallOrderRefundApi.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.api; | ||
| 2 | + | ||
| 3 | +import com.diligrp.cashier.mall.domain.rtmall.RtMarkMessage; | ||
| 4 | +import com.diligrp.cashier.mall.domain.rtmall.co.OrderCO; | ||
| 5 | +import com.diligrp.cashier.mall.domain.rtmall.vo.OrderSuccessVO; | ||
| 6 | +import com.diligrp.cashier.mall.service.biz.MallBizOrderService; | ||
| 7 | +import com.diligrp.cashier.mall.sign.RtMallSign; | ||
| 8 | +import com.diligrp.cashier.mall.util.RtMallValidateUtils; | ||
| 9 | +import com.diligrp.cashier.shared.annotation.ParamLogPrint; | ||
| 10 | +import com.diligrp.cashier.shared.annotation.RepeatSubmit; | ||
| 11 | +import com.diligrp.cashier.shared.annotation.Sign; | ||
| 12 | +import com.diligrp.cashier.shared.handler.duplication.SpelDuplicationSubmit; | ||
| 13 | +import com.diligrp.cashier.shared.util.JsonUtils; | ||
| 14 | +import jakarta.annotation.Resource; | ||
| 15 | +import jakarta.validation.Valid; | ||
| 16 | +import org.springframework.validation.annotation.Validated; | ||
| 17 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 18 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 19 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 20 | +import org.springframework.web.bind.annotation.RestController; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * @ClassName RtMallOrderRefundApi.java | ||
| 24 | + * @author dengwei | ||
| 25 | + * @version 1.0.0 | ||
| 26 | + * @Description RtMallOrderRefundApi | ||
| 27 | + */ | ||
| 28 | +@RestController | ||
| 29 | +@RequestMapping(path = {"/api/rt/mall", "/rt/mall"}) | ||
| 30 | +@Validated | ||
| 31 | +public class RtMallOrderRefundApi { | ||
| 32 | + @Resource | ||
| 33 | + private MallBizOrderService mallBizOrderService; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * createOrder | ||
| 37 | + * @see https://shopex.yuque.com/hl0rrx/vlp0m4/nkwt5yrhdfzoy78s?singleDoc#oJ2JC | ||
| 38 | + * 创建订单接口 | ||
| 39 | + */ | ||
| 40 | + @PostMapping("/refund/v1") | ||
| 41 | + @ParamLogPrint(outPrint = true) | ||
| 42 | + @Sign(sign = RtMallSign.class) | ||
| 43 | + @RepeatSubmit(prefix = "order_sync:", value = "#req['order_id']", duplicationSubmit = SpelDuplicationSubmit.class) | ||
| 44 | + public RtMarkMessage<OrderSuccessVO> refund(@Valid @RequestBody Object req) { | ||
| 45 | + OrderCO orderCo = JsonUtils.convertValue(req, OrderCO.class); | ||
| 46 | + RtMallValidateUtils.valid(orderCo); | ||
| 47 | + return RtMarkMessage.success(mallBizOrderService.createOrder(orderCo)); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * info | ||
| 52 | + * @see https://shopex.yuque.com/hl0rrx/vlp0m4/nkwt5yrhdfzoy78s?singleDoc#oJ2JC | ||
| 53 | + * 查询订单状态 | ||
| 54 | + */ | ||
| 55 | + @PostMapping("/refund/v1/info") | ||
| 56 | + @ParamLogPrint(outPrint = true) | ||
| 57 | + @Sign(sign = RtMallSign.class) | ||
| 58 | + public RtMarkMessage<?> info(@Valid @RequestBody Object req) { | ||
| 59 | + OrderCO orderCo = JsonUtils.convertValue(req, OrderCO.class); | ||
| 60 | + RtMallValidateUtils.valid(orderCo); | ||
| 61 | + return RtMarkMessage.success(); | ||
| 62 | + } | ||
| 63 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/context/MallInitializeContext.java
| @@ -23,7 +23,7 @@ import java.util.Optional; | @@ -23,7 +23,7 @@ import java.util.Optional; | ||
| 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<String, AbstractChannel> SOURCE_CHANNEL_MAP = Maps.newConcurrentMap(); | 26 | + public static Map<Integer, AbstractChannel> 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 | ||
| 29 | /** | 29 | /** |
| @@ -32,7 +32,7 @@ public class MallInitializeContext implements InitializingBean, DisposableBean { | @@ -32,7 +32,7 @@ public class MallInitializeContext implements InitializingBean, DisposableBean { | ||
| 32 | @Override | 32 | @Override |
| 33 | public void afterPropertiesSet() throws Exception { | 33 | public void afterPropertiesSet() throws Exception { |
| 34 | SpringContextUtils.getBeanOfTpe(AbstractChannel.class).forEach((key, value) -> { | 34 | SpringContextUtils.getBeanOfTpe(AbstractChannel.class).forEach((key, value) -> { |
| 35 | - SOURCE_CHANNEL_MAP.put(value.channel(), value); | 35 | + SOURCE_CHANNEL_MAP.put(value.source(), value); |
| 36 | }); | 36 | }); |
| 37 | 37 | ||
| 38 | SpringContextUtils.getBeanOfTpe(AbstractPayChannel.class).forEach((key, value) -> { | 38 | SpringContextUtils.getBeanOfTpe(AbstractPayChannel.class).forEach((key, value) -> { |
| @@ -51,8 +51,8 @@ public class MallInitializeContext implements InitializingBean, DisposableBean { | @@ -51,8 +51,8 @@ public class MallInitializeContext implements InitializingBean, DisposableBean { | ||
| 51 | /** | 51 | /** |
| 52 | * getByType | 52 | * getByType |
| 53 | */ | 53 | */ |
| 54 | - public static AbstractChannel getByChannel(String channel) { | ||
| 55 | - return Optional.ofNullable(SOURCE_CHANNEL_MAP.get(channel)).orElseThrow(() -> new MallException("不支持该渠道!")); | 54 | + public static AbstractChannel getBySource(Integer source) { |
| 55 | + return Optional.ofNullable(SOURCE_CHANNEL_MAP.get(source)).orElseThrow(() -> new MallException("不支持该渠道!")); | ||
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | /** | 58 | /** |
cashier-mall/src/main/java/com/diligrp/cashier/mall/dao/MallBizOrderAddressDao.java
| @@ -3,6 +3,11 @@ package com.diligrp.cashier.mall.dao; | @@ -3,6 +3,11 @@ package com.diligrp.cashier.mall.dao; | ||
| 3 | import com.diligrp.cashier.mall.model.MallBizOrderAddress; | 3 | import com.diligrp.cashier.mall.model.MallBizOrderAddress; |
| 4 | import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport; | 4 | import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport; |
| 5 | 5 | ||
| 6 | +/** | ||
| 7 | + * MallBizOrderAddressDao | ||
| 8 | + * | ||
| 9 | + * @author dengwei | ||
| 10 | + */ | ||
| 6 | public interface MallBizOrderAddressDao extends MybatisMapperSupport { | 11 | public interface MallBizOrderAddressDao extends MybatisMapperSupport { |
| 7 | int deleteByPrimaryKey(Long id); | 12 | int deleteByPrimaryKey(Long id); |
| 8 | 13 |
cashier-mall/src/main/java/com/diligrp/cashier/mall/dao/MallBizOrderDao.java
| @@ -7,6 +7,7 @@ import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport; | @@ -7,6 +7,7 @@ import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport; | ||
| 7 | /** | 7 | /** |
| 8 | * MallBizOrderDao | 8 | * MallBizOrderDao |
| 9 | * | 9 | * |
| 10 | + * @author dengwei | ||
| 10 | */ | 11 | */ |
| 11 | public interface MallBizOrderDao extends MybatisMapperSupport { | 12 | public interface MallBizOrderDao extends MybatisMapperSupport { |
| 12 | int deleteByPrimaryKey(Long id); | 13 | int deleteByPrimaryKey(Long id); |
cashier-mall/src/main/java/com/diligrp/cashier/mall/dao/MallBizOrderItemDao.java
| @@ -3,7 +3,15 @@ package com.diligrp.cashier.mall.dao; | @@ -3,7 +3,15 @@ package com.diligrp.cashier.mall.dao; | ||
| 3 | 3 | ||
| 4 | import com.diligrp.cashier.mall.model.MallBizOrderItem; | 4 | import com.diligrp.cashier.mall.model.MallBizOrderItem; |
| 5 | import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport; | 5 | import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport; |
| 6 | +import org.apache.ibatis.annotations.Param; | ||
| 6 | 7 | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * MallBizOrderItemDao | ||
| 12 | + * | ||
| 13 | + * @author dengwei | ||
| 14 | + */ | ||
| 7 | public interface MallBizOrderItemDao extends MybatisMapperSupport { | 15 | public interface MallBizOrderItemDao extends MybatisMapperSupport { |
| 8 | int deleteByPrimaryKey(Long id); | 16 | int deleteByPrimaryKey(Long id); |
| 9 | 17 | ||
| @@ -16,4 +24,6 @@ public interface MallBizOrderItemDao extends MybatisMapperSupport { | @@ -16,4 +24,6 @@ public interface MallBizOrderItemDao extends MybatisMapperSupport { | ||
| 16 | int updateByPrimaryKeySelective(MallBizOrderItem record); | 24 | int updateByPrimaryKeySelective(MallBizOrderItem record); |
| 17 | 25 | ||
| 18 | int updateByPrimaryKey(MallBizOrderItem record); | 26 | int updateByPrimaryKey(MallBizOrderItem record); |
| 27 | + | ||
| 28 | + void batchInsert(@Param("list") List<MallBizOrderItem> mallBizOrderItems); | ||
| 19 | } | 29 | } |
cashier-mall/src/main/java/com/diligrp/cashier/mall/dao/MallBizPaymentDao.java
| @@ -3,6 +3,11 @@ package com.diligrp.cashier.mall.dao; | @@ -3,6 +3,11 @@ package com.diligrp.cashier.mall.dao; | ||
| 3 | import com.diligrp.cashier.mall.model.MallBizPayment; | 3 | import com.diligrp.cashier.mall.model.MallBizPayment; |
| 4 | import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport; | 4 | import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport; |
| 5 | 5 | ||
| 6 | +/** | ||
| 7 | + * MallBizPaymentDao | ||
| 8 | + * | ||
| 9 | + * @author dengwei | ||
| 10 | + */ | ||
| 6 | public interface MallBizPaymentDao extends MybatisMapperSupport { | 11 | public interface MallBizPaymentDao extends MybatisMapperSupport { |
| 7 | int deleteByPrimaryKey(Long id); | 12 | int deleteByPrimaryKey(Long id); |
| 8 | 13 |
cashier-mall/src/main/java/com/diligrp/cashier/mall/dao/MallBizRefundItemDao.java
| @@ -4,6 +4,11 @@ package com.diligrp.cashier.mall.dao; | @@ -4,6 +4,11 @@ package com.diligrp.cashier.mall.dao; | ||
| 4 | import com.diligrp.cashier.mall.model.MallBizRefundItem; | 4 | import com.diligrp.cashier.mall.model.MallBizRefundItem; |
| 5 | import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport; | 5 | import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport; |
| 6 | 6 | ||
| 7 | +/** | ||
| 8 | + * MallBizRefundItemDao | ||
| 9 | + * | ||
| 10 | + * @author dengwei | ||
| 11 | + */ | ||
| 7 | public interface MallBizRefundItemDao extends MybatisMapperSupport { | 12 | public interface MallBizRefundItemDao extends MybatisMapperSupport { |
| 8 | int deleteByPrimaryKey(Long id); | 13 | int deleteByPrimaryKey(Long id); |
| 9 | 14 |
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/RtMarkMessage.java
| @@ -51,13 +51,14 @@ public class RtMarkMessage<T> { | @@ -51,13 +51,14 @@ public class RtMarkMessage<T> { | ||
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | public static RtMarkMessage<?> success() { | 53 | public static RtMarkMessage<?> success() { |
| 54 | - return failure(RtMarkErrorCode.E0000.getCode(), MallConstants.RESULT_SUCCESS); | 54 | + return success(null); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | public static <E> RtMarkMessage<E> success(E data) { | 57 | public static <E> RtMarkMessage<E> success(E data) { |
| 58 | RtMarkMessage<E> result = new RtMarkMessage<>(); | 58 | RtMarkMessage<E> result = new RtMarkMessage<>(); |
| 59 | result.code = RtMarkErrorCode.E0000.getCode(); | 59 | result.code = RtMarkErrorCode.E0000.getCode(); |
| 60 | result.result = MallConstants.RESULT_SUCCESS; | 60 | result.result = MallConstants.RESULT_SUCCESS; |
| 61 | + result.msg = RtMarkErrorCode.E0000.getMessage(); | ||
| 61 | result.data = data; | 62 | result.data = data; |
| 62 | return result; | 63 | return result; |
| 63 | } | 64 | } |
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/co/OrderCO.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.domain.rtmall.co; | ||
| 2 | + | ||
| 3 | +import com.diligrp.cashier.mall.domain.rtmall.RtMarkBaseCO; | ||
| 4 | +import com.diligrp.cashier.shared.jackson.deserializer.SecondToDateDeserializer; | ||
| 5 | +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
| 6 | +import jakarta.validation.Valid; | ||
| 7 | +import jakarta.validation.constraints.NotBlank; | ||
| 8 | +import jakarta.validation.constraints.NotNull; | ||
| 9 | + | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * @ClassName OrderCreateCO.java | ||
| 15 | + * @author dengwei | ||
| 16 | + * @version 1.0.0 | ||
| 17 | + * @Description OrderCO | ||
| 18 | + * @date 2025-12-26 14:16 | ||
| 19 | + */ | ||
| 20 | +public class OrderCO extends RtMarkBaseCO { | ||
| 21 | + @NotBlank(message = "order_id is required") | ||
| 22 | + private String orderId; | ||
| 23 | + | ||
| 24 | + @NotBlank(message = "trade_id is required") | ||
| 25 | + private String tradeId; | ||
| 26 | + | ||
| 27 | + @NotBlank(message = "user_code is required") | ||
| 28 | + private String userCode; | ||
| 29 | + | ||
| 30 | + @NotNull(message = "order_time is required") | ||
| 31 | + @JsonDeserialize(using = SecondToDateDeserializer.class) | ||
| 32 | + private LocalDateTime orderTime; | ||
| 33 | + | ||
| 34 | + @NotBlank(message = "company_code is required") | ||
| 35 | + private String companyCode; | ||
| 36 | + | ||
| 37 | + private Integer orderExpire; | ||
| 38 | + | ||
| 39 | + @NotNull(message = "total_amount is required") | ||
| 40 | + private Long totalAmount; | ||
| 41 | + | ||
| 42 | + @NotNull(message = "freight_fee is required") | ||
| 43 | + private Long freightFee; | ||
| 44 | + | ||
| 45 | + @NotBlank(message = "shop_code is required") | ||
| 46 | + private String shopCode; | ||
| 47 | + | ||
| 48 | + @NotBlank(message = "shop_name is required") | ||
| 49 | + private String shopName; | ||
| 50 | + | ||
| 51 | + @Valid | ||
| 52 | + private List<OrderItemCO> itemList; | ||
| 53 | + | ||
| 54 | + private ReceiverInfoCO receiverInfo; | ||
| 55 | + | ||
| 56 | + public String getOrderId() { | ||
| 57 | + return orderId; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + public void setOrderId(String orderId) { | ||
| 61 | + this.orderId = orderId; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + public String getTradeId() { | ||
| 65 | + return tradeId; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + public void setTradeId(String tradeId) { | ||
| 69 | + this.tradeId = tradeId; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public String getUserCode() { | ||
| 73 | + return userCode; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public void setUserCode(String userCode) { | ||
| 77 | + this.userCode = userCode; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public LocalDateTime getOrderTime() { | ||
| 81 | + return orderTime; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public void setOrderTime(LocalDateTime orderTime) { | ||
| 85 | + this.orderTime = orderTime; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public String getCompanyCode() { | ||
| 89 | + return companyCode; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public void setCompanyCode(String companyCode) { | ||
| 93 | + this.companyCode = companyCode; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public Integer getOrderExpire() { | ||
| 97 | + return orderExpire; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public void setOrderExpire(Integer orderExpire) { | ||
| 101 | + this.orderExpire = orderExpire; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public Long getTotalAmount() { | ||
| 105 | + return totalAmount; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + public void setTotalAmount(Long totalAmount) { | ||
| 109 | + this.totalAmount = totalAmount; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public Long getFreightFee() { | ||
| 113 | + return freightFee; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + public void setFreightFee(Long freightFee) { | ||
| 117 | + this.freightFee = freightFee; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public String getShopCode() { | ||
| 121 | + return shopCode; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + public void setShopCode(String shopCode) { | ||
| 125 | + this.shopCode = shopCode; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + public String getShopName() { | ||
| 129 | + return shopName; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + public void setShopName(String shopName) { | ||
| 133 | + this.shopName = shopName; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + public List<OrderItemCO> getItemList() { | ||
| 137 | + return itemList; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + public void setItemList(List<OrderItemCO> itemList) { | ||
| 141 | + this.itemList = itemList; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + public ReceiverInfoCO getReceiverInfo() { | ||
| 145 | + return receiverInfo; | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + public void setReceiverInfo(ReceiverInfoCO receiverInfo) { | ||
| 149 | + this.receiverInfo = receiverInfo; | ||
| 150 | + } | ||
| 151 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/co/OrderInfoCO.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.domain.rtmall.co; | ||
| 2 | + | ||
| 3 | +import com.diligrp.cashier.mall.domain.rtmall.RtMarkBaseCO; | ||
| 4 | +import jakarta.validation.constraints.NotBlank; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @ClassName OrderInfoCO.java | ||
| 8 | + * @author dengwei | ||
| 9 | + * @version 1.0.0 | ||
| 10 | + * @Description OrderInfoCO | ||
| 11 | + */ | ||
| 12 | +public class OrderInfoCO extends RtMarkBaseCO { | ||
| 13 | + @NotBlank(message = "order_id is required") | ||
| 14 | + private String orderId; | ||
| 15 | + | ||
| 16 | + @NotBlank(message = "trade_id is required") | ||
| 17 | + private String tradeId; | ||
| 18 | + | ||
| 19 | + @NotBlank(message = "user_code is required") | ||
| 20 | + private String userCode; | ||
| 21 | + | ||
| 22 | + @NotBlank(message = "company_code is required") | ||
| 23 | + private String companyCode; | ||
| 24 | + | ||
| 25 | + public String getOrderId() { | ||
| 26 | + return orderId; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public void setOrderId(String orderId) { | ||
| 30 | + this.orderId = orderId; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + public String getTradeId() { | ||
| 34 | + return tradeId; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + public void setTradeId(String tradeId) { | ||
| 38 | + this.tradeId = tradeId; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + public String getUserCode() { | ||
| 42 | + return userCode; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + public void setUserCode(String userCode) { | ||
| 46 | + this.userCode = userCode; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + public String getCompanyCode() { | ||
| 50 | + return companyCode; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + public void setCompanyCode(String companyCode) { | ||
| 54 | + this.companyCode = companyCode; | ||
| 55 | + } | ||
| 56 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/co/OrderItemCO.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.domain.rtmall.co; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
| 4 | +import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
| 5 | +import jakarta.validation.constraints.NotBlank; | ||
| 6 | +import jakarta.validation.constraints.NotNull; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @ClassName OrderItemCO.java | ||
| 10 | + * @author dengwei | ||
| 11 | + * @version 1.0.0 | ||
| 12 | + * @Description OrderItemCO | ||
| 13 | + * @date 2025-12-26 14:20 | ||
| 14 | + */ | ||
| 15 | +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
| 16 | +public class OrderItemCO { | ||
| 17 | + @NotNull(message = "num is required") | ||
| 18 | + private Integer num; | ||
| 19 | + | ||
| 20 | + private String pic; | ||
| 21 | + | ||
| 22 | + @NotNull(message = "price is required") | ||
| 23 | + private Long price; | ||
| 24 | + | ||
| 25 | + @NotNull(message = "amount is required") | ||
| 26 | + private Long amount; | ||
| 27 | + | ||
| 28 | + @NotBlank(message = "item_bn is required") | ||
| 29 | + private String itemBn; | ||
| 30 | + | ||
| 31 | + @NotBlank(message = "item_name is required") | ||
| 32 | + private String itemName; | ||
| 33 | + | ||
| 34 | + @NotNull(message = "sub_order_id is required") | ||
| 35 | + private Long subOrderId; | ||
| 36 | + | ||
| 37 | + private String taxOutputRate; | ||
| 38 | + | ||
| 39 | + private String taxClassificationCode; | ||
| 40 | + | ||
| 41 | + private String taxClassificationName; | ||
| 42 | + | ||
| 43 | + public Integer getNum() { | ||
| 44 | + return num; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public void setNum(Integer num) { | ||
| 48 | + this.num = num; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public String getPic() { | ||
| 52 | + return pic; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + public void setPic(String pic) { | ||
| 56 | + this.pic = pic; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public Long getPrice() { | ||
| 60 | + return price; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public void setPrice(Long price) { | ||
| 64 | + this.price = price; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public Long getAmount() { | ||
| 68 | + return amount; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public void setAmount(Long amount) { | ||
| 72 | + this.amount = amount; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public String getItemBn() { | ||
| 76 | + return itemBn; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public void setItemBn(String itemBn) { | ||
| 80 | + this.itemBn = itemBn; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public String getItemName() { | ||
| 84 | + return itemName; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + public void setItemName(String itemName) { | ||
| 88 | + this.itemName = itemName; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + public Long getSubOrderId() { | ||
| 92 | + return subOrderId; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + public void setSubOrderId(Long subOrderId) { | ||
| 96 | + this.subOrderId = subOrderId; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public String getTaxOutputRate() { | ||
| 100 | + return taxOutputRate; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + public void setTaxOutputRate(String taxOutputRate) { | ||
| 104 | + this.taxOutputRate = taxOutputRate; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + public String getTaxClassificationCode() { | ||
| 108 | + return taxClassificationCode; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + public void setTaxClassificationCode(String taxClassificationCode) { | ||
| 112 | + this.taxClassificationCode = taxClassificationCode; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + public String getTaxClassificationName() { | ||
| 116 | + return taxClassificationName; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + public void setTaxClassificationName(String taxClassificationName) { | ||
| 120 | + this.taxClassificationName = taxClassificationName; | ||
| 121 | + } | ||
| 122 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/co/ReceiverInfoCO.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.domain.rtmall.co; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
| 4 | +import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @ClassName ReceiverInfoCO.java | ||
| 8 | + * @author dengwei | ||
| 9 | + * @version 1.0.0 | ||
| 10 | + * @Description ReceiverInfoCO | ||
| 11 | + * @date 2025-12-26 14:19 | ||
| 12 | + */ | ||
| 13 | +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
| 14 | +public class ReceiverInfoCO { | ||
| 15 | + private String receiverName; | ||
| 16 | + private String receiverMobile; | ||
| 17 | + private String receiverAddress; | ||
| 18 | + | ||
| 19 | + public String getReceiverName() { | ||
| 20 | + return receiverName; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + public void setReceiverName(String receiverName) { | ||
| 24 | + this.receiverName = receiverName; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public String getReceiverMobile() { | ||
| 28 | + return receiverMobile; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public void setReceiverMobile(String receiverMobile) { | ||
| 32 | + this.receiverMobile = receiverMobile; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public String getReceiverAddress() { | ||
| 36 | + return receiverAddress; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public void setReceiverAddress(String receiverAddress) { | ||
| 40 | + this.receiverAddress = receiverAddress; | ||
| 41 | + } | ||
| 42 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/vo/OrderPaymentVO.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.domain.rtmall.vo; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
| 4 | +import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @ClassName OrderPaymentVO.java | ||
| 8 | + * @author dengwei | ||
| 9 | + * @version 1.0.0 | ||
| 10 | + * @Description OrderPaymentVO | ||
| 11 | + */ | ||
| 12 | +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
| 13 | +public class OrderPaymentVO { | ||
| 14 | + /** | ||
| 15 | + * 商户支付单号 | ||
| 16 | + */ | ||
| 17 | + private String outTradeNo; | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 支付状态, 0:待支付,1:支付成功 | ||
| 21 | + * @see com.diligrp.cashier.mall.type.PayState | ||
| 22 | + */ | ||
| 23 | + private String payStatus; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 支付金额,单位分 | ||
| 27 | + */ | ||
| 28 | + private String payFee; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 支付时间 | ||
| 32 | + */ | ||
| 33 | + private Long payTime; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 支付流水号(可为空, 支付成功时必传) | ||
| 37 | + */ | ||
| 38 | + private String transactionId; | ||
| 39 | + | ||
| 40 | + public String getOutTradeNo() { | ||
| 41 | + return outTradeNo; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public void setOutTradeNo(String outTradeNo) { | ||
| 45 | + this.outTradeNo = outTradeNo; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public String getPayStatus() { | ||
| 49 | + return payStatus; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public void setPayStatus(String payStatus) { | ||
| 53 | + this.payStatus = payStatus; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + public String getPayFee() { | ||
| 57 | + return payFee; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + public void setPayFee(String payFee) { | ||
| 61 | + this.payFee = payFee; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + public Long getPayTime() { | ||
| 65 | + return payTime; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + public void setPayTime(Long payTime) { | ||
| 69 | + this.payTime = payTime; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public String getTransactionId() { | ||
| 73 | + return transactionId; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public void setTransactionId(String transactionId) { | ||
| 77 | + this.transactionId = transactionId; | ||
| 78 | + } | ||
| 79 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/vo/OrderSuccessVO.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.domain.rtmall.vo; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
| 4 | +import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @ClassName OrderSuccessVO.java | ||
| 8 | + * @author dengwei | ||
| 9 | + * @version 1.0.0 | ||
| 10 | + * @Description OrderSuccessVO | ||
| 11 | + * @date 2025-12-26 14:13 | ||
| 12 | + */ | ||
| 13 | +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
| 14 | +public class OrderSuccessVO { | ||
| 15 | + private String outTradeNo; | ||
| 16 | + private String cashierUrl; | ||
| 17 | + | ||
| 18 | + public OrderSuccessVO() { | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + public OrderSuccessVO(String outTradeNo, String cashierUrl) { | ||
| 22 | + this.outTradeNo = outTradeNo; | ||
| 23 | + this.cashierUrl = cashierUrl; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public String getOutTradeNo() { | ||
| 27 | + return outTradeNo; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public void setOutTradeNo(String outTradeNo) { | ||
| 31 | + this.outTradeNo = outTradeNo; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public String getCashierUrl() { | ||
| 35 | + return cashierUrl; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public void setCashierUrl(String cashierUrl) { | ||
| 39 | + this.cashierUrl = cashierUrl; | ||
| 40 | + } | ||
| 41 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/model/MallBizOrder.java
| 1 | package com.diligrp.cashier.mall.model; | 1 | package com.diligrp.cashier.mall.model; |
| 2 | 2 | ||
| 3 | +import com.diligrp.cashier.mall.domain.rtmall.co.AuthLoginCO; | ||
| 4 | +import com.diligrp.cashier.mall.domain.rtmall.co.OrderCO; | ||
| 5 | +import com.diligrp.cashier.mall.type.OrderState; | ||
| 6 | +import com.diligrp.cashier.mall.type.RtmartState; | ||
| 7 | +import com.diligrp.cashier.mall.util.MallSnowflakeKeyManager; | ||
| 3 | import com.diligrp.cashier.shared.domain.BaseDO; | 8 | import com.diligrp.cashier.shared.domain.BaseDO; |
| 9 | +import com.diligrp.cashier.shared.util.SpringContextUtils; | ||
| 10 | +import com.diligrp.cashier.trade.type.SnowflakeKey; | ||
| 11 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| 12 | +import org.springframework.beans.BeanUtils; | ||
| 4 | 13 | ||
| 5 | import java.time.LocalDateTime; | 14 | import java.time.LocalDateTime; |
| 15 | +import java.util.List; | ||
| 16 | +import java.util.Optional; | ||
| 6 | 17 | ||
| 7 | /** | 18 | /** |
| 8 | * MallBizOrder | 19 | * MallBizOrder |
| 9 | * | 20 | * |
| 21 | + * @author dengwei | ||
| 10 | */ | 22 | */ |
| 23 | +@JsonIgnoreProperties({"version"}) | ||
| 11 | public class MallBizOrder extends BaseDO { | 24 | public class MallBizOrder extends BaseDO { |
| 12 | /** | 25 | /** |
| 13 | * 订单单号-系统生成 | 26 | * 订单单号-系统生成 |
| @@ -84,15 +97,15 @@ public class MallBizOrder extends BaseDO { | @@ -84,15 +97,15 @@ public class MallBizOrder extends BaseDO { | ||
| 84 | 97 | ||
| 85 | /** | 98 | /** |
| 86 | * 订单状态(0-notpay-未支付-1-payed-已支付 2-notpaycancel-未支付取消 3-payedcancel-已支付取消 4-done-订单完成 5-buyer_confirm-待用户收货) | 99 | * 订单状态(0-notpay-未支付-1-payed-已支付 2-notpaycancel-未支付取消 3-payedcancel-已支付取消 4-done-订单完成 5-buyer_confirm-待用户收货) |
| 87 | - * @see com.diligrp.cashier.mall.type.OrderStatus | 100 | + * @see OrderState |
| 88 | */ | 101 | */ |
| 89 | - private Integer status; | 102 | + private Integer state; |
| 90 | 103 | ||
| 91 | /** | 104 | /** |
| 92 | * 配送状态(1-transfer-转单 2-package-打包 3-collect-揽件 4-delivery-配达) | 105 | * 配送状态(1-transfer-转单 2-package-打包 3-collect-揽件 4-delivery-配达) |
| 93 | - * @see com.diligrp.cashier.mall.type.RtmartStatus | 106 | + * @see RtmartState |
| 94 | */ | 107 | */ |
| 95 | - private Integer rtmartStatus; | 108 | + private Integer rtmartState; |
| 96 | 109 | ||
| 97 | /** | 110 | /** |
| 98 | * 下单时间 | 111 | * 下单时间 |
| @@ -104,12 +117,19 @@ public class MallBizOrder extends BaseDO { | @@ -104,12 +117,19 @@ public class MallBizOrder extends BaseDO { | ||
| 104 | */ | 117 | */ |
| 105 | private Integer orderExpire; | 118 | private Integer orderExpire; |
| 106 | 119 | ||
| 120 | + /** | ||
| 121 | + * 订单地址信息 | ||
| 122 | + */ | ||
| 123 | + private MallBizOrderAddress mallBizOrderAddress; | ||
| 124 | + | ||
| 125 | + private List<MallBizOrderItem> mallBizOrderItems; | ||
| 126 | + | ||
| 107 | public String getOrderNo() { | 127 | public String getOrderNo() { |
| 108 | return orderNo; | 128 | return orderNo; |
| 109 | } | 129 | } |
| 110 | 130 | ||
| 111 | public void setOrderNo(String orderNo) { | 131 | public void setOrderNo(String orderNo) { |
| 112 | - this.orderNo = orderNo == null ? null : orderNo.trim(); | 132 | + this.orderNo = orderNo; |
| 113 | } | 133 | } |
| 114 | 134 | ||
| 115 | public String getOrderId() { | 135 | public String getOrderId() { |
| @@ -117,7 +137,7 @@ public class MallBizOrder extends BaseDO { | @@ -117,7 +137,7 @@ public class MallBizOrder extends BaseDO { | ||
| 117 | } | 137 | } |
| 118 | 138 | ||
| 119 | public void setOrderId(String orderId) { | 139 | public void setOrderId(String orderId) { |
| 120 | - this.orderId = orderId == null ? null : orderId.trim(); | 140 | + this.orderId = orderId; |
| 121 | } | 141 | } |
| 122 | 142 | ||
| 123 | public String getTradeId() { | 143 | public String getTradeId() { |
| @@ -125,7 +145,7 @@ public class MallBizOrder extends BaseDO { | @@ -125,7 +145,7 @@ public class MallBizOrder extends BaseDO { | ||
| 125 | } | 145 | } |
| 126 | 146 | ||
| 127 | public void setTradeId(String tradeId) { | 147 | public void setTradeId(String tradeId) { |
| 128 | - this.tradeId = tradeId == null ? null : tradeId.trim(); | 148 | + this.tradeId = tradeId; |
| 129 | } | 149 | } |
| 130 | 150 | ||
| 131 | public String getChannel() { | 151 | public String getChannel() { |
| @@ -133,7 +153,7 @@ public class MallBizOrder extends BaseDO { | @@ -133,7 +153,7 @@ public class MallBizOrder extends BaseDO { | ||
| 133 | } | 153 | } |
| 134 | 154 | ||
| 135 | public void setChannel(String channel) { | 155 | public void setChannel(String channel) { |
| 136 | - this.channel = channel == null ? null : channel.trim(); | 156 | + this.channel = channel; |
| 137 | } | 157 | } |
| 138 | 158 | ||
| 139 | public String getMchId() { | 159 | public String getMchId() { |
| @@ -141,7 +161,23 @@ public class MallBizOrder extends BaseDO { | @@ -141,7 +161,23 @@ public class MallBizOrder extends BaseDO { | ||
| 141 | } | 161 | } |
| 142 | 162 | ||
| 143 | public void setMchId(String mchId) { | 163 | public void setMchId(String mchId) { |
| 144 | - this.mchId = mchId == null ? null : mchId.trim(); | 164 | + this.mchId = mchId; |
| 165 | + } | ||
| 166 | + | ||
| 167 | + public Integer getSource() { | ||
| 168 | + return source; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + public void setSource(Integer source) { | ||
| 172 | + this.source = source; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + public Integer getOrderType() { | ||
| 176 | + return orderType; | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + public void setOrderType(Integer orderType) { | ||
| 180 | + this.orderType = orderType; | ||
| 145 | } | 181 | } |
| 146 | 182 | ||
| 147 | public String getUserCode() { | 183 | public String getUserCode() { |
| @@ -149,7 +185,7 @@ public class MallBizOrder extends BaseDO { | @@ -149,7 +185,7 @@ public class MallBizOrder extends BaseDO { | ||
| 149 | } | 185 | } |
| 150 | 186 | ||
| 151 | public void setUserCode(String userCode) { | 187 | public void setUserCode(String userCode) { |
| 152 | - this.userCode = userCode == null ? null : userCode.trim(); | 188 | + this.userCode = userCode; |
| 153 | } | 189 | } |
| 154 | 190 | ||
| 155 | public String getUsername() { | 191 | public String getUsername() { |
| @@ -157,7 +193,7 @@ public class MallBizOrder extends BaseDO { | @@ -157,7 +193,7 @@ public class MallBizOrder extends BaseDO { | ||
| 157 | } | 193 | } |
| 158 | 194 | ||
| 159 | public void setUsername(String username) { | 195 | public void setUsername(String username) { |
| 160 | - this.username = username == null ? null : username.trim(); | 196 | + this.username = username; |
| 161 | } | 197 | } |
| 162 | 198 | ||
| 163 | public String getCompanyCode() { | 199 | public String getCompanyCode() { |
| @@ -165,7 +201,7 @@ public class MallBizOrder extends BaseDO { | @@ -165,7 +201,7 @@ public class MallBizOrder extends BaseDO { | ||
| 165 | } | 201 | } |
| 166 | 202 | ||
| 167 | public void setCompanyCode(String companyCode) { | 203 | public void setCompanyCode(String companyCode) { |
| 168 | - this.companyCode = companyCode == null ? null : companyCode.trim(); | 204 | + this.companyCode = companyCode; |
| 169 | } | 205 | } |
| 170 | 206 | ||
| 171 | public String getShopCode() { | 207 | public String getShopCode() { |
| @@ -173,7 +209,7 @@ public class MallBizOrder extends BaseDO { | @@ -173,7 +209,7 @@ public class MallBizOrder extends BaseDO { | ||
| 173 | } | 209 | } |
| 174 | 210 | ||
| 175 | public void setShopCode(String shopCode) { | 211 | public void setShopCode(String shopCode) { |
| 176 | - this.shopCode = shopCode == null ? null : shopCode.trim(); | 212 | + this.shopCode = shopCode; |
| 177 | } | 213 | } |
| 178 | 214 | ||
| 179 | public String getShopName() { | 215 | public String getShopName() { |
| @@ -181,7 +217,7 @@ public class MallBizOrder extends BaseDO { | @@ -181,7 +217,7 @@ public class MallBizOrder extends BaseDO { | ||
| 181 | } | 217 | } |
| 182 | 218 | ||
| 183 | public void setShopName(String shopName) { | 219 | public void setShopName(String shopName) { |
| 184 | - this.shopName = shopName == null ? null : shopName.trim(); | 220 | + this.shopName = shopName; |
| 185 | } | 221 | } |
| 186 | 222 | ||
| 187 | public Long getTotalAmount() { | 223 | public Long getTotalAmount() { |
| @@ -200,6 +236,22 @@ public class MallBizOrder extends BaseDO { | @@ -200,6 +236,22 @@ public class MallBizOrder extends BaseDO { | ||
| 200 | this.freightFee = freightFee; | 236 | this.freightFee = freightFee; |
| 201 | } | 237 | } |
| 202 | 238 | ||
| 239 | + public Integer getState() { | ||
| 240 | + return state; | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + public void setState(Integer state) { | ||
| 244 | + this.state = state; | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + public Integer getRtmartState() { | ||
| 248 | + return rtmartState; | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + public void setRtmartState(Integer rtmartState) { | ||
| 252 | + this.rtmartState = rtmartState; | ||
| 253 | + } | ||
| 254 | + | ||
| 203 | public LocalDateTime getOrderTime() { | 255 | public LocalDateTime getOrderTime() { |
| 204 | return orderTime; | 256 | return orderTime; |
| 205 | } | 257 | } |
| @@ -215,4 +267,64 @@ public class MallBizOrder extends BaseDO { | @@ -215,4 +267,64 @@ public class MallBizOrder extends BaseDO { | ||
| 215 | public void setOrderExpire(Integer orderExpire) { | 267 | public void setOrderExpire(Integer orderExpire) { |
| 216 | this.orderExpire = orderExpire; | 268 | this.orderExpire = orderExpire; |
| 217 | } | 269 | } |
| 270 | + | ||
| 271 | + public MallBizOrderAddress getMallBizOrderAddress() { | ||
| 272 | + return mallBizOrderAddress; | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + public void setMallBizOrderAddress(MallBizOrderAddress mallBizOrderAddress) { | ||
| 276 | + this.mallBizOrderAddress = mallBizOrderAddress; | ||
| 277 | + } | ||
| 278 | + | ||
| 279 | + public List<MallBizOrderItem> getMallBizOrderItems() { | ||
| 280 | + return mallBizOrderItems; | ||
| 281 | + } | ||
| 282 | + | ||
| 283 | + public void setMallBizOrderItems(List<MallBizOrderItem> mallBizOrderItems) { | ||
| 284 | + this.mallBizOrderItems = mallBizOrderItems; | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + /** | ||
| 288 | + * of | ||
| 289 | + */ | ||
| 290 | + public static MallBizOrder of(OrderCO orderCo, AuthLoginCO authLogin) { | ||
| 291 | + orderCo.setVersion(null); | ||
| 292 | + MallBizOrder mallBizOrder = new MallBizOrder(); | ||
| 293 | + BeanUtils.copyProperties(orderCo, mallBizOrder); | ||
| 294 | + | ||
| 295 | + MallSnowflakeKeyManager snowflakeKeyManager = SpringContextUtils.getBean(MallSnowflakeKeyManager.class); | ||
| 296 | + mallBizOrder.setId(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_ORDER_ID)); | ||
| 297 | + mallBizOrder.setOrderNo(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_ORDER_ID).toString()); | ||
| 298 | + BeanUtils.copyProperties(authLogin, mallBizOrder); | ||
| 299 | + | ||
| 300 | + Optional.ofNullable(orderCo.getReceiverInfo()) | ||
| 301 | + .ifPresent(receiverInfo -> { | ||
| 302 | + MallBizOrderAddress address = new MallBizOrderAddress(); | ||
| 303 | + mallBizOrder.setMallBizOrderAddress(address); | ||
| 304 | + | ||
| 305 | + address.setId(mallBizOrder.getId()); | ||
| 306 | + address.setReceiverName(receiverInfo.getReceiverName()); | ||
| 307 | + address.setReceiverMobile(receiverInfo.getReceiverMobile()); | ||
| 308 | + address.setReceiverAddress(receiverInfo.getReceiverAddress()); | ||
| 309 | + }); | ||
| 310 | + | ||
| 311 | + Optional.ofNullable(orderCo.getItemList()) | ||
| 312 | + .ifPresent(itemList -> { | ||
| 313 | + List<MallBizOrderItem> orderItems = itemList | ||
| 314 | + .stream() | ||
| 315 | + .map(itemCo -> { | ||
| 316 | + MallBizOrderItem item = new MallBizOrderItem(); | ||
| 317 | + BeanUtils.copyProperties(itemCo, item); | ||
| 318 | + | ||
| 319 | + item.setId(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_ORDER_ID)); | ||
| 320 | + item.setBizOrderId(mallBizOrder.getId()); | ||
| 321 | + item.setOrderId(orderCo.getOrderId()); | ||
| 322 | + item.setShopCode(orderCo.getShopCode()); | ||
| 323 | + item.setShopName(orderCo.getShopName()); | ||
| 324 | + return item; | ||
| 325 | + }).toList(); | ||
| 326 | + mallBizOrder.setMallBizOrderItems(orderItems); | ||
| 327 | + }); | ||
| 328 | + return mallBizOrder; | ||
| 329 | + } | ||
| 218 | } | 330 | } |
cashier-mall/src/main/java/com/diligrp/cashier/mall/model/MallBizOrderItem.java
| @@ -21,7 +21,7 @@ public class MallBizOrderItem extends BaseDO { | @@ -21,7 +21,7 @@ public class MallBizOrderItem extends BaseDO { | ||
| 21 | /** | 21 | /** |
| 22 | * 业务侧子订单号 | 22 | * 业务侧子订单号 |
| 23 | */ | 23 | */ |
| 24 | - private String subOrderId; | 24 | + private Long subOrderId; |
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| 27 | * 店铺编码 | 27 | * 店铺编码 |
| @@ -94,12 +94,12 @@ public class MallBizOrderItem extends BaseDO { | @@ -94,12 +94,12 @@ public class MallBizOrderItem extends BaseDO { | ||
| 94 | this.orderId = orderId == null ? null : orderId.trim(); | 94 | this.orderId = orderId == null ? null : orderId.trim(); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | - public String getSubOrderId() { | 97 | + public Long getSubOrderId() { |
| 98 | return subOrderId; | 98 | return subOrderId; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | - public void setSubOrderId(String subOrderId) { | ||
| 102 | - this.subOrderId = subOrderId == null ? null : subOrderId.trim(); | 101 | + public void setSubOrderId(Long subOrderId) { |
| 102 | + this.subOrderId = subOrderId; | ||
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | public String getShopCode() { | 105 | public String getShopCode() { |
cashier-mall/src/main/java/com/diligrp/cashier/mall/model/MallBizPayment.java
| 1 | package com.diligrp.cashier.mall.model; | 1 | package com.diligrp.cashier.mall.model; |
| 2 | 2 | ||
| 3 | +import com.diligrp.cashier.mall.domain.rtmall.co.OrderCO; | ||
| 4 | +import com.diligrp.cashier.mall.property.MallDynamicProperty; | ||
| 5 | +import com.diligrp.cashier.mall.property.RtMallDynamicProperty; | ||
| 6 | +import com.diligrp.cashier.mall.type.PayState; | ||
| 7 | +import com.diligrp.cashier.mall.util.MallSnowflakeKeyManager; | ||
| 3 | import com.diligrp.cashier.shared.domain.BaseDO; | 8 | import com.diligrp.cashier.shared.domain.BaseDO; |
| 9 | +import com.diligrp.cashier.shared.util.SpringContextUtils; | ||
| 10 | +import com.diligrp.cashier.trade.type.SnowflakeKey; | ||
| 4 | 11 | ||
| 5 | import java.time.LocalDateTime; | 12 | import java.time.LocalDateTime; |
| 6 | 13 | ||
| @@ -72,9 +79,9 @@ public class MallBizPayment extends BaseDO { | @@ -72,9 +79,9 @@ public class MallBizPayment extends BaseDO { | ||
| 72 | 79 | ||
| 73 | /** | 80 | /** |
| 74 | * 支付状态 | 81 | * 支付状态 |
| 75 | - * @see com.diligrp.cashier.mall.type.PayStatus | 82 | + * @see PayState |
| 76 | */ | 83 | */ |
| 77 | - private Integer payStatus; | 84 | + private Integer payState; |
| 78 | 85 | ||
| 79 | /** | 86 | /** |
| 80 | * dili支付成功时间 | 87 | * dili支付成功时间 |
| @@ -96,6 +103,29 @@ public class MallBizPayment extends BaseDO { | @@ -96,6 +103,29 @@ public class MallBizPayment extends BaseDO { | ||
| 96 | */ | 103 | */ |
| 97 | private String paymentCallback; | 104 | private String paymentCallback; |
| 98 | 105 | ||
| 106 | + public static MallBizPayment of(final OrderCO orderCo, | ||
| 107 | + final MallBizOrder mallBizOrder) { | ||
| 108 | + MallSnowflakeKeyManager snowflakeKeyManager = SpringContextUtils.getBean(MallSnowflakeKeyManager.class); | ||
| 109 | + | ||
| 110 | + MallBizPayment mallBizPayment = new MallBizPayment(); | ||
| 111 | + mallBizPayment.setId(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_PAYMENT_ID)); | ||
| 112 | + mallBizPayment.setPayTradeNo(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_PAYMENT_ID).toString()); | ||
| 113 | + mallBizPayment.setBizOrderId(mallBizOrder.getId()); | ||
| 114 | + mallBizPayment.setOrderId(orderCo.getOrderId()); | ||
| 115 | + mallBizPayment.setTradeId(orderCo.getTradeId()); | ||
| 116 | + mallBizPayment.setPayFee(orderCo.getTotalAmount()); | ||
| 117 | + | ||
| 118 | + // TODO 2025/12/29: 支付信息 | ||
| 119 | + mallBizPayment.setPayPaymentId("6666666666"); | ||
| 120 | + String cashierUrl = SpringContextUtils.getBean(MallDynamicProperty.class).getUrl(); | ||
| 121 | + mallBizPayment.setCashierUrl(cashierUrl.concat("?payTradeNo=").concat(mallBizPayment.getPayTradeNo())); | ||
| 122 | + | ||
| 123 | + RtMallDynamicProperty rtMallDynamicProperty = SpringContextUtils.getBean(RtMallDynamicProperty.class); | ||
| 124 | + RtMallDynamicProperty.AppSecretDynamicProperty property = rtMallDynamicProperty.getBySourceAndType(mallBizOrder.getSource(), mallBizOrder.getOrderType()); | ||
| 125 | + mallBizPayment.setPaymentCallback(property.getCallbackDomain()); | ||
| 126 | + return mallBizPayment; | ||
| 127 | + } | ||
| 128 | + | ||
| 99 | public String getPayTradeNo() { | 129 | public String getPayTradeNo() { |
| 100 | return payTradeNo; | 130 | return payTradeNo; |
| 101 | } | 131 | } |
| @@ -192,12 +222,12 @@ public class MallBizPayment extends BaseDO { | @@ -192,12 +222,12 @@ public class MallBizPayment extends BaseDO { | ||
| 192 | this.payFee = payFee; | 222 | this.payFee = payFee; |
| 193 | } | 223 | } |
| 194 | 224 | ||
| 195 | - public Integer getPayStatus() { | ||
| 196 | - return payStatus; | 225 | + public Integer getPayState() { |
| 226 | + return payState; | ||
| 197 | } | 227 | } |
| 198 | 228 | ||
| 199 | - public void setPayStatus(Integer payStatus) { | ||
| 200 | - this.payStatus = payStatus; | 229 | + public void setPayState(Integer payState) { |
| 230 | + this.payState = payState; | ||
| 201 | } | 231 | } |
| 202 | 232 | ||
| 203 | public LocalDateTime getPayTime() { | 233 | public LocalDateTime getPayTime() { |
cashier-mall/src/main/java/com/diligrp/cashier/mall/model/MallBizRefund.java
| 1 | package com.diligrp.cashier.mall.model; | 1 | package com.diligrp.cashier.mall.model; |
| 2 | 2 | ||
| 3 | +import com.diligrp.cashier.mall.type.RefundState; | ||
| 3 | import com.diligrp.cashier.shared.domain.BaseDO; | 4 | import com.diligrp.cashier.shared.domain.BaseDO; |
| 4 | 5 | ||
| 5 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
| @@ -82,9 +83,9 @@ public class MallBizRefund extends BaseDO { | @@ -82,9 +83,9 @@ public class MallBizRefund extends BaseDO { | ||
| 82 | 83 | ||
| 83 | /** | 84 | /** |
| 84 | * 退款状态 | 85 | * 退款状态 |
| 85 | - * @see com.diligrp.cashier.mall.type.RefundStatus | 86 | + * @see RefundState |
| 86 | */ | 87 | */ |
| 87 | - private Integer refundStatus; | 88 | + private Integer refundState; |
| 88 | 89 | ||
| 89 | /** | 90 | /** |
| 90 | * 退款原因 | 91 | * 退款原因 |
| @@ -213,12 +214,12 @@ public class MallBizRefund extends BaseDO { | @@ -213,12 +214,12 @@ public class MallBizRefund extends BaseDO { | ||
| 213 | this.freightFee = freightFee; | 214 | this.freightFee = freightFee; |
| 214 | } | 215 | } |
| 215 | 216 | ||
| 216 | - public Integer getRefundStatus() { | ||
| 217 | - return refundStatus; | 217 | + public Integer getRefundState() { |
| 218 | + return refundState; | ||
| 218 | } | 219 | } |
| 219 | 220 | ||
| 220 | - public void setRefundStatus(Integer refundStatus) { | ||
| 221 | - this.refundStatus = refundStatus; | 221 | + public void setRefundState(Integer refundState) { |
| 222 | + this.refundState = refundState; | ||
| 222 | } | 223 | } |
| 223 | 224 | ||
| 224 | public String getRefundReason() { | 225 | public String getRefundReason() { |
cashier-mall/src/main/java/com/diligrp/cashier/mall/property/MallDynamicProperty.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.property; | ||
| 2 | + | ||
| 3 | +import org.springframework.beans.factory.annotation.Value; | ||
| 4 | +import org.springframework.boot.context.properties.ConfigurationProperties; | ||
| 5 | +import org.springframework.cloud.context.config.annotation.RefreshScope; | ||
| 6 | +import org.springframework.context.annotation.Configuration; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @ClassName MallDynamicProperty.java | ||
| 10 | + * @author dengwei | ||
| 11 | + * @version 1.0.0 | ||
| 12 | + * @Description MallDynamicProperty | ||
| 13 | + * @date 2025-12-29 16:42 | ||
| 14 | + */ | ||
| 15 | +@Configuration | ||
| 16 | +@RefreshScope | ||
| 17 | +@ConfigurationProperties(prefix = "cashier.cash") | ||
| 18 | +public class MallDynamicProperty { | ||
| 19 | + /** | ||
| 20 | + * 收银台URL | ||
| 21 | + */ | ||
| 22 | + @Value("${url:}") | ||
| 23 | + private String url; | ||
| 24 | + | ||
| 25 | + public String getUrl() { | ||
| 26 | + return url; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public void setUrl(String url) { | ||
| 30 | + this.url = url; | ||
| 31 | + } | ||
| 32 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/property/RtMallDynamicProperty.java
| 1 | package com.diligrp.cashier.mall.property; | 1 | package com.diligrp.cashier.mall.property; |
| 2 | 2 | ||
| 3 | +import com.diligrp.cashier.mall.exception.RtMartMallException; | ||
| 4 | +import com.diligrp.cashier.mall.type.RtMarkErrorCode; | ||
| 3 | import org.springframework.beans.factory.annotation.Value; | 5 | import org.springframework.beans.factory.annotation.Value; |
| 4 | import org.springframework.boot.context.properties.ConfigurationProperties; | 6 | import org.springframework.boot.context.properties.ConfigurationProperties; |
| 5 | import org.springframework.cloud.context.config.annotation.RefreshScope; | 7 | import org.springframework.cloud.context.config.annotation.RefreshScope; |
| @@ -19,6 +21,8 @@ import java.util.Optional; | @@ -19,6 +21,8 @@ import java.util.Optional; | ||
| 19 | @RefreshScope | 21 | @RefreshScope |
| 20 | @ConfigurationProperties(prefix = "rtmall.sign") | 22 | @ConfigurationProperties(prefix = "rtmall.sign") |
| 21 | public class RtMallDynamicProperty { | 23 | public class RtMallDynamicProperty { |
| 24 | + @Value("${domain:}") | ||
| 25 | + private String domain; | ||
| 22 | 26 | ||
| 23 | private List<AppSecretDynamicProperty> appSecrets; | 27 | private List<AppSecretDynamicProperty> appSecrets; |
| 24 | 28 | ||
| @@ -41,6 +45,9 @@ public class RtMallDynamicProperty { | @@ -41,6 +45,9 @@ public class RtMallDynamicProperty { | ||
| 41 | @Value("${authUrl:https://hourh5-em-shop.feiniugo.com}") | 45 | @Value("${authUrl:https://hourh5-em-shop.feiniugo.com}") |
| 42 | private String authUrl; | 46 | private String authUrl; |
| 43 | 47 | ||
| 48 | + @Value("${callbackDomain:}") | ||
| 49 | + private String callbackDomain; | ||
| 50 | + | ||
| 44 | public Integer getSource() { | 51 | public Integer getSource() { |
| 45 | return source; | 52 | return source; |
| 46 | } | 53 | } |
| @@ -88,6 +95,22 @@ public class RtMallDynamicProperty { | @@ -88,6 +95,22 @@ public class RtMallDynamicProperty { | ||
| 88 | public void setCompanyCode(String companyCode) { | 95 | public void setCompanyCode(String companyCode) { |
| 89 | this.companyCode = companyCode; | 96 | this.companyCode = companyCode; |
| 90 | } | 97 | } |
| 98 | + | ||
| 99 | + public String getCallbackDomain() { | ||
| 100 | + return callbackDomain; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + public void setCallbackDomain(String callbackDomain) { | ||
| 104 | + this.callbackDomain = callbackDomain; | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + public String getDomain() { | ||
| 109 | + return domain; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public void setDomain(String domain) { | ||
| 113 | + this.domain = domain; | ||
| 91 | } | 114 | } |
| 92 | 115 | ||
| 93 | public List<AppSecretDynamicProperty> getAppSecrets() { | 116 | public List<AppSecretDynamicProperty> getAppSecrets() { |
| @@ -121,7 +144,7 @@ public class RtMallDynamicProperty { | @@ -121,7 +144,7 @@ public class RtMallDynamicProperty { | ||
| 121 | .stream() | 144 | .stream() |
| 122 | .filter(item -> item.getSource().equals(source) && item.getOrderType().equals(orderType)) | 145 | .filter(item -> item.getSource().equals(source) && item.getOrderType().equals(orderType)) |
| 123 | .findFirst() | 146 | .findFirst() |
| 124 | - .orElse(null); | 147 | + .orElseThrow(() -> new RtMartMallException(RtMarkErrorCode.E5002)); |
| 125 | } | 148 | } |
| 126 | 149 | ||
| 127 | /** | 150 | /** |
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/MallBizOrderItemService.java
0 → 100644
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/MallBizOrderService.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.service.biz; | ||
| 2 | + | ||
| 3 | +import com.diligrp.cashier.mall.domain.rtmall.co.OrderCO; | ||
| 4 | +import com.diligrp.cashier.mall.domain.rtmall.co.OrderInfoCO; | ||
| 5 | +import com.diligrp.cashier.mall.domain.rtmall.vo.OrderPaymentVO; | ||
| 6 | +import com.diligrp.cashier.mall.domain.rtmall.vo.OrderSuccessVO; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @ClassName MallBizOrderService.java | ||
| 10 | + * @author dengwei | ||
| 11 | + * @version 1.0.0 | ||
| 12 | + * @Description MallBizOrderService | ||
| 13 | + * @date 2025-12-26 14:42 | ||
| 14 | + */ | ||
| 15 | +public interface MallBizOrderService { | ||
| 16 | + /** | ||
| 17 | + * createOrder | ||
| 18 | + */ | ||
| 19 | + OrderSuccessVO createOrder(OrderCO orderCo); | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * info | ||
| 23 | + */ | ||
| 24 | + OrderPaymentVO info(OrderInfoCO orderInfoCo); | ||
| 25 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/MallBizPaymentService.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.service.biz; | ||
| 2 | + | ||
| 3 | +import com.diligrp.cashier.mall.model.MallBizPayment; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @ClassName MallBizPaymentService.java | ||
| 7 | + * @author dengwei | ||
| 8 | + * @version 1.0.0 | ||
| 9 | + * @Description MallBizPaymentService | ||
| 10 | + * @date 2025-12-26 14:46 | ||
| 11 | + */ | ||
| 12 | +public interface MallBizPaymentService { | ||
| 13 | + void save(MallBizPayment mallBizPayment); | ||
| 14 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/impl/MallBizOrderItemServiceImpl.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.service.biz.impl; | ||
| 2 | + | ||
| 3 | +import com.diligrp.cashier.mall.service.biz.MallBizOrderItemService; | ||
| 4 | +import org.slf4j.Logger; | ||
| 5 | +import org.slf4j.LoggerFactory; | ||
| 6 | +import org.springframework.stereotype.Service; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @ClassName MallBizOrderItemServiceImpl.java | ||
| 10 | + * @author dengwei | ||
| 11 | + * @version 1.0.0 | ||
| 12 | + * @Description MallBizOrderItemServiceImpl | ||
| 13 | + * @date 2025-12-26 14:44 | ||
| 14 | + */ | ||
| 15 | +@Service | ||
| 16 | +public class MallBizOrderItemServiceImpl implements MallBizOrderItemService { | ||
| 17 | + private static final Logger log = LoggerFactory.getLogger(MallBizOrderItemServiceImpl.class); | ||
| 18 | + | ||
| 19 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/impl/MallBizOrderServiceImpl.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.service.biz.impl; | ||
| 2 | + | ||
| 3 | +import com.diligrp.cashier.mall.MallConstants; | ||
| 4 | +import com.diligrp.cashier.mall.dao.MallBizOrderAddressDao; | ||
| 5 | +import com.diligrp.cashier.mall.dao.MallBizOrderDao; | ||
| 6 | +import com.diligrp.cashier.mall.dao.MallBizOrderItemDao; | ||
| 7 | +import com.diligrp.cashier.mall.domain.rtmall.co.AuthLoginCO; | ||
| 8 | +import com.diligrp.cashier.mall.domain.rtmall.co.OrderCO; | ||
| 9 | +import com.diligrp.cashier.mall.domain.rtmall.co.OrderInfoCO; | ||
| 10 | +import com.diligrp.cashier.mall.domain.rtmall.vo.OrderPaymentVO; | ||
| 11 | +import com.diligrp.cashier.mall.domain.rtmall.vo.OrderSuccessVO; | ||
| 12 | +import com.diligrp.cashier.mall.exception.RtMartMallException; | ||
| 13 | +import com.diligrp.cashier.mall.model.MallBizOrder; | ||
| 14 | +import com.diligrp.cashier.mall.model.MallBizPayment; | ||
| 15 | +import com.diligrp.cashier.mall.service.biz.MallBizOrderService; | ||
| 16 | +import com.diligrp.cashier.mall.service.biz.MallBizPaymentService; | ||
| 17 | +import com.diligrp.cashier.mall.type.RtMarkErrorCode; | ||
| 18 | +import com.diligrp.cashier.mall.util.MallSnowflakeKeyManager; | ||
| 19 | +import com.diligrp.cashier.shared.util.JsonUtils; | ||
| 20 | +import com.diligrp.cashier.trade.type.SnowflakeKey; | ||
| 21 | +import jakarta.annotation.Resource; | ||
| 22 | +import org.slf4j.Logger; | ||
| 23 | +import org.slf4j.LoggerFactory; | ||
| 24 | +import org.springframework.data.redis.core.RedisTemplate; | ||
| 25 | +import org.springframework.stereotype.Service; | ||
| 26 | +import org.springframework.transaction.annotation.Transactional; | ||
| 27 | + | ||
| 28 | +import java.util.Objects; | ||
| 29 | +import java.util.Optional; | ||
| 30 | + | ||
| 31 | +/** | ||
| 32 | + * @ClassName MallBizOrderServiceImpl.java | ||
| 33 | + * @author dengwei | ||
| 34 | + * @version 1.0.0 | ||
| 35 | + * @Description MallBizOrderServiceImpl | ||
| 36 | + * @date 2025-12-26 14:42 | ||
| 37 | + */ | ||
| 38 | +@Service | ||
| 39 | +public class MallBizOrderServiceImpl implements MallBizOrderService { | ||
| 40 | + private static final Logger log = LoggerFactory.getLogger(MallBizOrderServiceImpl.class); | ||
| 41 | + | ||
| 42 | + @Resource | ||
| 43 | + private RedisTemplate<String, Object> redisTemplate; | ||
| 44 | + @Resource | ||
| 45 | + private MallSnowflakeKeyManager mallSnowflakeKeyManager; | ||
| 46 | + @Resource | ||
| 47 | + private MallBizPaymentService mallBizPaymentService; | ||
| 48 | + @Resource | ||
| 49 | + private MallBizOrderDao mallBizOrderDao; | ||
| 50 | + @Resource | ||
| 51 | + private MallBizOrderAddressDao mallBizOrderAddressDao; | ||
| 52 | + @Resource | ||
| 53 | + private MallBizOrderItemDao mallBizOrderItemDao; | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * createOrder | ||
| 57 | + * | ||
| 58 | + */ | ||
| 59 | + @Override | ||
| 60 | + @Transactional(rollbackFor = {Exception.class}) | ||
| 61 | + public OrderSuccessVO createOrder(OrderCO orderCo) { | ||
| 62 | + AuthLoginCO authLogin = getAuthLogin(orderCo.getUserCode()); | ||
| 63 | + | ||
| 64 | + // order | ||
| 65 | + MallBizOrder mallBizOrder = MallBizOrder.of(orderCo, authLogin); | ||
| 66 | + | ||
| 67 | + // payment | ||
| 68 | + MallBizPayment mallBizPayment = MallBizPayment.of(orderCo, mallBizOrder); | ||
| 69 | + | ||
| 70 | + // save | ||
| 71 | + commonCreate(mallBizOrder, mallBizPayment); | ||
| 72 | + return new OrderSuccessVO(mallSnowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_ORDER_ID).toString(), "https://www.baidu.com"); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * info | ||
| 77 | + * | ||
| 78 | + */ | ||
| 79 | + @Override | ||
| 80 | + public OrderPaymentVO info(OrderInfoCO orderInfoCo) { | ||
| 81 | + return null; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * getAuthLogin | ||
| 86 | + */ | ||
| 87 | + private AuthLoginCO getAuthLogin(String userCode) { | ||
| 88 | + Object cache = redisTemplate.opsForValue().get(MallConstants.MALL_USER_INFO + userCode); | ||
| 89 | + if (Objects.isNull(cache)) { | ||
| 90 | + throw new RtMartMallException(RtMarkErrorCode.E5001); | ||
| 91 | + } | ||
| 92 | + AuthLoginCO authLogin = JsonUtils.fromJsonString(Objects.requireNonNull(cache).toString(), AuthLoginCO.class); | ||
| 93 | + log.info("get auth login info: {}", JsonUtils.toJsonString(authLogin)); | ||
| 94 | + return authLogin; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * commonCreate | ||
| 99 | + * | ||
| 100 | + */ | ||
| 101 | + public void commonCreate(MallBizOrder mallBizOrder, MallBizPayment mallBizPayment) { | ||
| 102 | + mallBizOrderDao.insertSelective(mallBizOrder); | ||
| 103 | + Optional.ofNullable(mallBizOrder.getMallBizOrderAddress()) | ||
| 104 | + .ifPresent(mallBizOrderAddress -> { | ||
| 105 | + mallBizOrderAddressDao.insertSelective(mallBizOrderAddress); | ||
| 106 | + }); | ||
| 107 | + | ||
| 108 | + Optional.ofNullable(mallBizOrder.getMallBizOrderItems()).ifPresent(mallBizOrderItems -> { | ||
| 109 | + mallBizOrderItemDao.batchInsert(mallBizOrderItems); | ||
| 110 | + }); | ||
| 111 | + | ||
| 112 | + Optional.ofNullable(mallBizPayment).ifPresent(mallBizPaymentService::save); | ||
| 113 | + } | ||
| 114 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/impl/MallBizPaymentServiceImpl.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.service.biz.impl; | ||
| 2 | + | ||
| 3 | +import com.diligrp.cashier.mall.dao.MallBizPaymentDao; | ||
| 4 | +import com.diligrp.cashier.mall.model.MallBizPayment; | ||
| 5 | +import com.diligrp.cashier.mall.service.biz.MallBizPaymentService; | ||
| 6 | +import jakarta.annotation.Resource; | ||
| 7 | +import org.slf4j.Logger; | ||
| 8 | +import org.slf4j.LoggerFactory; | ||
| 9 | +import org.springframework.stereotype.Service; | ||
| 10 | +import org.springframework.transaction.annotation.Transactional; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * @ClassName MallBizPaymentServiceImpl.java | ||
| 14 | + * @author dengwei | ||
| 15 | + * @version 1.0.0 | ||
| 16 | + * @Description MallBizPaymentServiceImpl | ||
| 17 | + * @date 2025-12-26 14:47 | ||
| 18 | + */ | ||
| 19 | +@Service | ||
| 20 | +public class MallBizPaymentServiceImpl implements MallBizPaymentService { | ||
| 21 | + private static final Logger log = LoggerFactory.getLogger(MallBizPaymentServiceImpl.class); | ||
| 22 | + | ||
| 23 | + @Resource | ||
| 24 | + private MallBizPaymentDao mallBizPaymentDao; | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + @Transactional(rollbackFor = {Exception.class}) | ||
| 28 | + public void save(MallBizPayment mallBizPayment) { | ||
| 29 | + mallBizPaymentDao.insertSelective(mallBizPayment); | ||
| 30 | + } | ||
| 31 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/sourcechannel/AbstractChannel.java
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/sourcechannel/RtMallChannel.java
| @@ -3,7 +3,7 @@ package com.diligrp.cashier.mall.service.sourcechannel; | @@ -3,7 +3,7 @@ package com.diligrp.cashier.mall.service.sourcechannel; | ||
| 3 | import com.diligrp.cashier.mall.domain.rtmall.co.AuthLoginCO; | 3 | import com.diligrp.cashier.mall.domain.rtmall.co.AuthLoginCO; |
| 4 | import com.diligrp.cashier.mall.domain.rtmall.vo.UserInfoVO; | 4 | import com.diligrp.cashier.mall.domain.rtmall.vo.UserInfoVO; |
| 5 | import com.diligrp.cashier.mall.property.RtMallDynamicProperty; | 5 | import com.diligrp.cashier.mall.property.RtMallDynamicProperty; |
| 6 | -import com.diligrp.cashier.mall.type.OrderChannel; | 6 | +import com.diligrp.cashier.mall.type.OrderSource; |
| 7 | import com.diligrp.cashier.mall.util.RtMallSignMd5Utils; | 7 | import com.diligrp.cashier.mall.util.RtMallSignMd5Utils; |
| 8 | import com.diligrp.cashier.shared.util.JsonUtils; | 8 | import com.diligrp.cashier.shared.util.JsonUtils; |
| 9 | import com.diligrp.cashier.shared.util.UrlParamParserUtils; | 9 | import com.diligrp.cashier.shared.util.UrlParamParserUtils; |
| @@ -55,7 +55,7 @@ public class RtMallChannel extends AbstractChannel { | @@ -55,7 +55,7 @@ public class RtMallChannel extends AbstractChannel { | ||
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | @Override | 57 | @Override |
| 58 | - public String channel() { | ||
| 59 | - return OrderChannel.RT_MART.getCode(); | 58 | + public Integer source() { |
| 59 | + return OrderSource.RT_MART.getCode(); | ||
| 60 | } | 60 | } |
| 61 | } | 61 | } |
cashier-mall/src/main/java/com/diligrp/cashier/mall/sign/RtMallSign.java
| @@ -30,7 +30,7 @@ public class RtMallSign implements SecuritySign { | @@ -30,7 +30,7 @@ public class RtMallSign implements SecuritySign { | ||
| 30 | private static final Logger log = LoggerFactory.getLogger(RtMallSign.class); | 30 | private static final Logger log = LoggerFactory.getLogger(RtMallSign.class); |
| 31 | 31 | ||
| 32 | @Resource | 32 | @Resource |
| 33 | - private RtMallDynamicProperty mallDynamicProperty; | 33 | + private RtMallDynamicProperty rtMallDynamicProperty; |
| 34 | 34 | ||
| 35 | @Override | 35 | @Override |
| 36 | public void sign(HttpServletRequest request, HttpServletResponse response, Object data) { | 36 | public void sign(HttpServletRequest request, HttpServletResponse response, Object data) { |
| @@ -50,7 +50,7 @@ public class RtMallSign implements SecuritySign { | @@ -50,7 +50,7 @@ public class RtMallSign implements SecuritySign { | ||
| 50 | } | 50 | } |
| 51 | paramMap.remove("sign"); | 51 | paramMap.remove("sign"); |
| 52 | 52 | ||
| 53 | - RtMallDynamicProperty.AppSecretDynamicProperty property = mallDynamicProperty.getByAppKey(appKey.toString()); | 53 | + RtMallDynamicProperty.AppSecretDynamicProperty property = rtMallDynamicProperty.getByAppKey(appKey.toString()); |
| 54 | if (Objects.isNull(property)) { | 54 | if (Objects.isNull(property)) { |
| 55 | throw new RtMartMallException(RtMarkErrorCode.E4003); | 55 | throw new RtMartMallException(RtMarkErrorCode.E4003); |
| 56 | } | 56 | } |
cashier-mall/src/main/java/com/diligrp/cashier/mall/type/OrderChannel.java
| @@ -8,8 +8,8 @@ package com.diligrp.cashier.mall.type; | @@ -8,8 +8,8 @@ package com.diligrp.cashier.mall.type; | ||
| 8 | * @date 2025-12-25 11:18 | 8 | * @date 2025-12-25 11:18 |
| 9 | */ | 9 | */ |
| 10 | public enum OrderChannel { | 10 | public enum OrderChannel { |
| 11 | - RT_MART("1", "大润发"), | ||
| 12 | - SAM("2", "山姆"); | 11 | + RT_MART("1", "中瑞"), |
| 12 | + SAM("2", "地利"); | ||
| 13 | 13 | ||
| 14 | public final String code; | 14 | public final String code; |
| 15 | public final String description; | 15 | public final String description; |
cashier-mall/src/main/java/com/diligrp/cashier/mall/type/OrderStatus.java renamed to cashier-mall/src/main/java/com/diligrp/cashier/mall/type/OrderState.java
| @@ -6,7 +6,7 @@ package com.diligrp.cashier.mall.type; | @@ -6,7 +6,7 @@ package com.diligrp.cashier.mall.type; | ||
| 6 | * @version 1.0.0 | 6 | * @version 1.0.0 |
| 7 | * @Description OrderStatus | 7 | * @Description OrderStatus |
| 8 | */ | 8 | */ |
| 9 | -public enum OrderStatus { | 9 | +public enum OrderState { |
| 10 | NOT_PAY(0, "notpay", "未支付"), | 10 | NOT_PAY(0, "notpay", "未支付"), |
| 11 | PAYED(1, "payed", "已支付"), | 11 | PAYED(1, "payed", "已支付"), |
| 12 | NOT_PAY_CANCEL(2, "notpaycancel", "未支付取消"), | 12 | NOT_PAY_CANCEL(2, "notpaycancel", "未支付取消"), |
| @@ -19,7 +19,7 @@ public enum OrderStatus { | @@ -19,7 +19,7 @@ public enum OrderStatus { | ||
| 19 | public final String key; | 19 | public final String key; |
| 20 | public final String name; | 20 | public final String name; |
| 21 | 21 | ||
| 22 | - OrderStatus(int code, String key, String name) { | 22 | + OrderState(int code, String key, String name) { |
| 23 | this.code = code; | 23 | this.code = code; |
| 24 | this.key = key; | 24 | this.key = key; |
| 25 | this.name = name; | 25 | this.name = name; |
cashier-mall/src/main/java/com/diligrp/cashier/mall/type/PayStatus.java renamed to cashier-mall/src/main/java/com/diligrp/cashier/mall/type/PayState.java
| @@ -7,7 +7,7 @@ package com.diligrp.cashier.mall.type; | @@ -7,7 +7,7 @@ package com.diligrp.cashier.mall.type; | ||
| 7 | * @Description PayStatus | 7 | * @Description PayStatus |
| 8 | * @date 2025-12-26 11:01 | 8 | * @date 2025-12-26 11:01 |
| 9 | */ | 9 | */ |
| 10 | -public enum PayStatus { | 10 | +public enum PayState { |
| 11 | PENDING(0, "待支付"), | 11 | PENDING(0, "待支付"), |
| 12 | SUCCESS(1, "成功"), | 12 | SUCCESS(1, "成功"), |
| 13 | FAILED(2, "失败"), | 13 | FAILED(2, "失败"), |
| @@ -16,7 +16,7 @@ public enum PayStatus { | @@ -16,7 +16,7 @@ public enum PayStatus { | ||
| 16 | public final int code; | 16 | public final int code; |
| 17 | public final String description; | 17 | public final String description; |
| 18 | 18 | ||
| 19 | - PayStatus(int code, String description) { | 19 | + PayState(int code, String description) { |
| 20 | this.code = code; | 20 | this.code = code; |
| 21 | this.description = description; | 21 | this.description = description; |
| 22 | } | 22 | } |
cashier-mall/src/main/java/com/diligrp/cashier/mall/type/RefundStatus.java renamed to cashier-mall/src/main/java/com/diligrp/cashier/mall/type/RefundState.java
| @@ -7,7 +7,7 @@ package com.diligrp.cashier.mall.type; | @@ -7,7 +7,7 @@ package com.diligrp.cashier.mall.type; | ||
| 7 | * @Description RefundStatus | 7 | * @Description RefundStatus |
| 8 | * @date 2025-12-26 11:08 | 8 | * @date 2025-12-26 11:08 |
| 9 | */ | 9 | */ |
| 10 | -public enum RefundStatus { | 10 | +public enum RefundState { |
| 11 | PENDING(0, "待退款"), | 11 | PENDING(0, "待退款"), |
| 12 | SUCCESS(1, "成功"), | 12 | SUCCESS(1, "成功"), |
| 13 | FAILED(2, "失败"), | 13 | FAILED(2, "失败"), |
| @@ -16,7 +16,7 @@ public enum RefundStatus { | @@ -16,7 +16,7 @@ public enum RefundStatus { | ||
| 16 | public final int code; | 16 | public final int code; |
| 17 | public final String description; | 17 | public final String description; |
| 18 | 18 | ||
| 19 | - RefundStatus(int code, String description) { | 19 | + RefundState(int code, String description) { |
| 20 | this.code = code; | 20 | this.code = code; |
| 21 | this.description = description; | 21 | this.description = description; |
| 22 | } | 22 | } |
cashier-mall/src/main/java/com/diligrp/cashier/mall/type/RtMarkErrorCode.java
| @@ -13,8 +13,11 @@ public enum RtMarkErrorCode { | @@ -13,8 +13,11 @@ public enum RtMarkErrorCode { | ||
| 13 | E4002("E4002", "timestamp 不合法"), | 13 | E4002("E4002", "timestamp 不合法"), |
| 14 | E4003("E4003", "app_key 错误"), | 14 | E4003("E4003", "app_key 错误"), |
| 15 | E4004("E4004", "签名错误"), | 15 | E4004("E4004", "签名错误"), |
| 16 | + E4005("E4005", "参数异常"), | ||
| 16 | E5000("E5000", "未知错误"), | 17 | E5000("E5000", "未知错误"), |
| 17 | - E5001("E5001", "认证失败"); | 18 | + E5001("E5001", "认证失败"), |
| 19 | + E5002("E5002", "不支持的类型"), | ||
| 20 | + ; | ||
| 18 | 21 | ||
| 19 | public final String code; | 22 | public final String code; |
| 20 | public final String message; | 23 | public final String message; |
cashier-mall/src/main/java/com/diligrp/cashier/mall/type/RtmartStatus.java renamed to cashier-mall/src/main/java/com/diligrp/cashier/mall/type/RtmartState.java
| @@ -7,7 +7,7 @@ package com.diligrp.cashier.mall.type; | @@ -7,7 +7,7 @@ package com.diligrp.cashier.mall.type; | ||
| 7 | * @Description RtmartStatus | 7 | * @Description RtmartStatus |
| 8 | * @date 2025-12-26 10:03 | 8 | * @date 2025-12-26 10:03 |
| 9 | */ | 9 | */ |
| 10 | -public enum RtmartStatus { | 10 | +public enum RtmartState { |
| 11 | TRANSFER(1, "transfer", "转单"), | 11 | TRANSFER(1, "transfer", "转单"), |
| 12 | PACKAGE(2, "package", "打包"), | 12 | PACKAGE(2, "package", "打包"), |
| 13 | COLLECT(3, "collect", "揽件"), | 13 | COLLECT(3, "collect", "揽件"), |
| @@ -18,7 +18,7 @@ public enum RtmartStatus { | @@ -18,7 +18,7 @@ public enum RtmartStatus { | ||
| 18 | public final String key; | 18 | public final String key; |
| 19 | public final String name; | 19 | public final String name; |
| 20 | 20 | ||
| 21 | - RtmartStatus(int code, String key, String name) { | 21 | + RtmartState(int code, String key, String name) { |
| 22 | this.code = code; | 22 | this.code = code; |
| 23 | this.key = key; | 23 | this.key = key; |
| 24 | this.name = name; | 24 | this.name = name; |
cashier-mall/src/main/java/com/diligrp/cashier/mall/util/MallSnowflakeKeyManager.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.util; | ||
| 2 | + | ||
| 3 | +import com.diligrp.cashier.assistant.service.impl.SnowflakeKeyManager; | ||
| 4 | +import com.diligrp.cashier.trade.type.SnowflakeKey; | ||
| 5 | +import jakarta.annotation.Resource; | ||
| 6 | +import org.springframework.stereotype.Component; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @ClassName MallSnowflakeKeyManager.java | ||
| 10 | + * @author dengwei | ||
| 11 | + * @version 1.0.0 | ||
| 12 | + * @Description MallSnowflakeKeyManager | ||
| 13 | + * @date 2025-12-26 16:46 | ||
| 14 | + */ | ||
| 15 | +@Component | ||
| 16 | +public class MallSnowflakeKeyManager { | ||
| 17 | + @Resource | ||
| 18 | + private SnowflakeKeyManager snowflakeKeyManager; | ||
| 19 | + | ||
| 20 | + public Long nextId(SnowflakeKey snowflakeKey) { | ||
| 21 | + return Long.valueOf(snowflakeKeyManager.getKeyGenerator(snowflakeKey).nextId()); | ||
| 22 | + } | ||
| 23 | +} |
cashier-mall/src/main/java/com/diligrp/cashier/mall/util/RtMallValidateUtils.java
0 → 100644
| 1 | +package com.diligrp.cashier.mall.util; | ||
| 2 | + | ||
| 3 | +import com.diligrp.cashier.mall.exception.RtMartMallException; | ||
| 4 | +import com.diligrp.cashier.mall.type.RtMarkErrorCode; | ||
| 5 | +import com.diligrp.cashier.shared.util.ValidateUtils; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @ClassName RtMallValidateUtils.java | ||
| 9 | + * @author dengwei | ||
| 10 | + * @version 1.0.0 | ||
| 11 | + * @Description RtMallValidateUtils | ||
| 12 | + * @date 2025-12-26 15:14 | ||
| 13 | + */ | ||
| 14 | +public class RtMallValidateUtils { | ||
| 15 | + public static <T> void valid(T t) { | ||
| 16 | + ValidateUtils.valid(t, (msg) -> { | ||
| 17 | + throw new RtMartMallException(RtMarkErrorCode.E4005.getCode(), msg); | ||
| 18 | + }); | ||
| 19 | + } | ||
| 20 | +} |
cashier-mall/src/main/resources/com/diligrp/cashier/dao/mapper/MallBizOrderDao.xml
| @@ -17,8 +17,8 @@ | @@ -17,8 +17,8 @@ | ||
| 17 | <result column="shop_name" jdbcType="VARCHAR" property="shopName" /> | 17 | <result column="shop_name" jdbcType="VARCHAR" property="shopName" /> |
| 18 | <result column="total_amount" jdbcType="BIGINT" property="totalAmount" /> | 18 | <result column="total_amount" jdbcType="BIGINT" property="totalAmount" /> |
| 19 | <result column="freight_fee" jdbcType="BIGINT" property="freightFee" /> | 19 | <result column="freight_fee" jdbcType="BIGINT" property="freightFee" /> |
| 20 | - <result column="status" jdbcType="TINYINT" property="status" /> | ||
| 21 | - <result column="rtmart_status" jdbcType="TINYINT" property="rtmartStatus" /> | 20 | + <result column="state" jdbcType="TINYINT" property="state" /> |
| 21 | + <result column="rtmart_state" jdbcType="TINYINT" property="rtmartState" /> | ||
| 22 | <result column="order_time" jdbcType="TIMESTAMP" property="orderTime" /> | 22 | <result column="order_time" jdbcType="TIMESTAMP" property="orderTime" /> |
| 23 | <result column="order_expire" jdbcType="INTEGER" property="orderExpire" /> | 23 | <result column="order_expire" jdbcType="INTEGER" property="orderExpire" /> |
| 24 | <result column="version" jdbcType="INTEGER" property="version" /> | 24 | <result column="version" jdbcType="INTEGER" property="version" /> |
| @@ -27,8 +27,8 @@ | @@ -27,8 +27,8 @@ | ||
| 27 | </resultMap> | 27 | </resultMap> |
| 28 | <sql id="Base_Column_List"> | 28 | <sql id="Base_Column_List"> |
| 29 | id, order_no, order_id, trade_id, channel, mch_id, source, order_type, user_code, | 29 | id, order_no, order_id, trade_id, channel, mch_id, source, order_type, user_code, |
| 30 | - username, company_code, shop_code, shop_name, total_amount, freight_fee, status, | ||
| 31 | - rtmart_status, order_time, order_expire, version, created_time, modified_time | 30 | + username, company_code, shop_code, shop_name, total_amount, freight_fee, state, |
| 31 | + rtmart_state, order_time, order_expire, version, created_time, modified_time | ||
| 32 | </sql> | 32 | </sql> |
| 33 | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 33 | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| 34 | select | 34 | select |
| @@ -46,7 +46,7 @@ | @@ -46,7 +46,7 @@ | ||
| 46 | source, order_type, user_code, | 46 | source, order_type, user_code, |
| 47 | username, company_code, shop_code, | 47 | username, company_code, shop_code, |
| 48 | shop_name, total_amount, freight_fee, | 48 | shop_name, total_amount, freight_fee, |
| 49 | - status, rtmart_status, order_time, | 49 | + state, rtmart_state, order_time, |
| 50 | order_expire, version, created_time, | 50 | order_expire, version, created_time, |
| 51 | modified_time) | 51 | modified_time) |
| 52 | values (#{id,jdbcType=BIGINT}, #{orderNo,jdbcType=VARCHAR}, #{orderId,jdbcType=VARCHAR}, | 52 | values (#{id,jdbcType=BIGINT}, #{orderNo,jdbcType=VARCHAR}, #{orderId,jdbcType=VARCHAR}, |
| @@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
| 54 | #{source,jdbcType=TINYINT}, #{orderType,jdbcType=TINYINT}, #{userCode,jdbcType=VARCHAR}, | 54 | #{source,jdbcType=TINYINT}, #{orderType,jdbcType=TINYINT}, #{userCode,jdbcType=VARCHAR}, |
| 55 | #{username,jdbcType=VARCHAR}, #{companyCode,jdbcType=VARCHAR}, #{shopCode,jdbcType=VARCHAR}, | 55 | #{username,jdbcType=VARCHAR}, #{companyCode,jdbcType=VARCHAR}, #{shopCode,jdbcType=VARCHAR}, |
| 56 | #{shopName,jdbcType=VARCHAR}, #{totalAmount,jdbcType=BIGINT}, #{freightFee,jdbcType=BIGINT}, | 56 | #{shopName,jdbcType=VARCHAR}, #{totalAmount,jdbcType=BIGINT}, #{freightFee,jdbcType=BIGINT}, |
| 57 | - #{status,jdbcType=TINYINT}, #{rtmartStatus,jdbcType=TINYINT}, #{orderTime,jdbcType=TIMESTAMP}, | 57 | + #{state,jdbcType=TINYINT}, #{rtmartState,jdbcType=TINYINT}, #{orderTime,jdbcType=TIMESTAMP}, |
| 58 | #{orderExpire,jdbcType=INTEGER}, #{version,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, | 58 | #{orderExpire,jdbcType=INTEGER}, #{version,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, |
| 59 | #{modifiedTime,jdbcType=TIMESTAMP}) | 59 | #{modifiedTime,jdbcType=TIMESTAMP}) |
| 60 | </insert> | 60 | </insert> |
| @@ -106,11 +106,11 @@ | @@ -106,11 +106,11 @@ | ||
| 106 | <if test="freightFee != null"> | 106 | <if test="freightFee != null"> |
| 107 | freight_fee, | 107 | freight_fee, |
| 108 | </if> | 108 | </if> |
| 109 | - <if test="status != null"> | ||
| 110 | - status, | 109 | + <if test="state != null"> |
| 110 | + state, | ||
| 111 | </if> | 111 | </if> |
| 112 | - <if test="rtmartStatus != null"> | ||
| 113 | - rtmart_status, | 112 | + <if test="rtmartState != null"> |
| 113 | + rtmart_state, | ||
| 114 | </if> | 114 | </if> |
| 115 | <if test="orderTime != null"> | 115 | <if test="orderTime != null"> |
| 116 | order_time, | 116 | order_time, |
| @@ -174,11 +174,11 @@ | @@ -174,11 +174,11 @@ | ||
| 174 | <if test="freightFee != null"> | 174 | <if test="freightFee != null"> |
| 175 | #{freightFee,jdbcType=BIGINT}, | 175 | #{freightFee,jdbcType=BIGINT}, |
| 176 | </if> | 176 | </if> |
| 177 | - <if test="status != null"> | ||
| 178 | - #{status,jdbcType=TINYINT}, | 177 | + <if test="state != null"> |
| 178 | + #{state,jdbcType=TINYINT}, | ||
| 179 | </if> | 179 | </if> |
| 180 | - <if test="rtmartStatus != null"> | ||
| 181 | - #{rtmartStatus,jdbcType=TINYINT}, | 180 | + <if test="rtmartState != null"> |
| 181 | + #{rtmartState,jdbcType=TINYINT}, | ||
| 182 | </if> | 182 | </if> |
| 183 | <if test="orderTime != null"> | 183 | <if test="orderTime != null"> |
| 184 | #{orderTime,jdbcType=TIMESTAMP}, | 184 | #{orderTime,jdbcType=TIMESTAMP}, |
| @@ -242,11 +242,11 @@ | @@ -242,11 +242,11 @@ | ||
| 242 | <if test="freightFee != null"> | 242 | <if test="freightFee != null"> |
| 243 | freight_fee = #{freightFee,jdbcType=BIGINT}, | 243 | freight_fee = #{freightFee,jdbcType=BIGINT}, |
| 244 | </if> | 244 | </if> |
| 245 | - <if test="status != null"> | ||
| 246 | - status = #{status,jdbcType=TINYINT}, | 245 | + <if test="state != null"> |
| 246 | + state = #{state,jdbcType=TINYINT}, | ||
| 247 | </if> | 247 | </if> |
| 248 | - <if test="rtmartStatus != null"> | ||
| 249 | - rtmart_status = #{rtmartStatus,jdbcType=TINYINT}, | 248 | + <if test="rtmartState != null"> |
| 249 | + rtmart_state = #{rtmartState,jdbcType=TINYINT}, | ||
| 250 | </if> | 250 | </if> |
| 251 | <if test="orderTime != null"> | 251 | <if test="orderTime != null"> |
| 252 | order_time = #{orderTime,jdbcType=TIMESTAMP}, | 252 | order_time = #{orderTime,jdbcType=TIMESTAMP}, |
| @@ -282,8 +282,8 @@ | @@ -282,8 +282,8 @@ | ||
| 282 | shop_name = #{shopName,jdbcType=VARCHAR}, | 282 | shop_name = #{shopName,jdbcType=VARCHAR}, |
| 283 | total_amount = #{totalAmount,jdbcType=BIGINT}, | 283 | total_amount = #{totalAmount,jdbcType=BIGINT}, |
| 284 | freight_fee = #{freightFee,jdbcType=BIGINT}, | 284 | freight_fee = #{freightFee,jdbcType=BIGINT}, |
| 285 | - status = #{status,jdbcType=TINYINT}, | ||
| 286 | - rtmart_status = #{rtmartStatus,jdbcType=TINYINT}, | 285 | + state = #{state,jdbcType=TINYINT}, |
| 286 | + rtmart_state = #{rtmartState,jdbcType=TINYINT}, | ||
| 287 | order_time = #{orderTime,jdbcType=TIMESTAMP}, | 287 | order_time = #{orderTime,jdbcType=TIMESTAMP}, |
| 288 | order_expire = #{orderExpire,jdbcType=INTEGER}, | 288 | order_expire = #{orderExpire,jdbcType=INTEGER}, |
| 289 | version = #{version,jdbcType=INTEGER}, | 289 | version = #{version,jdbcType=INTEGER}, |
cashier-mall/src/main/resources/com/diligrp/cashier/dao/mapper/MallBizOrderItemDao.xml
| @@ -143,7 +143,7 @@ | @@ -143,7 +143,7 @@ | ||
| 143 | </if> | 143 | </if> |
| 144 | </trim> | 144 | </trim> |
| 145 | </insert> | 145 | </insert> |
| 146 | - <update id="updateByPrimaryKeySelective" parameterType="com.diligrp.cashier.mall.model.MallBizOrderItem"> | 146 | + <update id="updateByPrimaryKeySelective" parameterType="com.diligrp.cashier.mall.model.MallBizOrderItem"> |
| 147 | update mall_biz_order_item | 147 | update mall_biz_order_item |
| 148 | <set> | 148 | <set> |
| 149 | <if test="bizOrderId != null"> | 149 | <if test="bizOrderId != null"> |
| @@ -209,4 +209,41 @@ | @@ -209,4 +209,41 @@ | ||
| 209 | tax_classification_name = #{taxClassificationName,jdbcType=VARCHAR} | 209 | tax_classification_name = #{taxClassificationName,jdbcType=VARCHAR} |
| 210 | where id = #{id,jdbcType=BIGINT} | 210 | where id = #{id,jdbcType=BIGINT} |
| 211 | </update> | 211 | </update> |
| 212 | + | ||
| 213 | + <insert id="batchInsert"> | ||
| 214 | + insert into mall_biz_order_item ( | ||
| 215 | + id, | ||
| 216 | + biz_order_id, | ||
| 217 | + order_id, | ||
| 218 | + sub_order_id, | ||
| 219 | + shop_code, | ||
| 220 | + shop_name, | ||
| 221 | + item_bn, | ||
| 222 | + item_name, | ||
| 223 | + num, | ||
| 224 | + price, | ||
| 225 | + amount, | ||
| 226 | + pic, | ||
| 227 | + tax_output_rate, | ||
| 228 | + tax_classification_code, | ||
| 229 | + tax_classification_name) | ||
| 230 | + values | ||
| 231 | + <foreach collection="list" item="item" separator=","> | ||
| 232 | + (#{item.id,jdbcType=BIGINT}, | ||
| 233 | + #{item.bizOrderId,jdbcType=BIGINT}, | ||
| 234 | + #{item.orderId,jdbcType=VARCHAR}, | ||
| 235 | + #{item.subOrderId,jdbcType=VARCHAR}, | ||
| 236 | + #{item.shopCode,jdbcType=VARCHAR}, | ||
| 237 | + #{item.shopName,jdbcType=VARCHAR}, | ||
| 238 | + #{item.itemBn,jdbcType=VARCHAR}, | ||
| 239 | + #{item.itemName,jdbcType=VARCHAR}, | ||
| 240 | + #{item.num,jdbcType=INTEGER}, | ||
| 241 | + #{item.price,jdbcType=BIGINT}, | ||
| 242 | + #{item.amount,jdbcType=BIGINT}, | ||
| 243 | + #{item.pic,jdbcType=VARCHAR}, | ||
| 244 | + #{item.taxOutputRate,jdbcType=VARCHAR}, | ||
| 245 | + #{item.taxClassificationCode,jdbcType=VARCHAR}, | ||
| 246 | + #{item.taxClassificationName,jdbcType=VARCHAR}) | ||
| 247 | + </foreach> | ||
| 248 | + </insert> | ||
| 212 | </mapper> | 249 | </mapper> |
cashier-mall/src/main/resources/com/diligrp/cashier/dao/mapper/MallBizPaymentDao.xml
| @@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
| 15 | <result column="account_id" jdbcType="BIGINT" property="accountId" /> | 15 | <result column="account_id" jdbcType="BIGINT" property="accountId" /> |
| 16 | <result column="fund_account_id" jdbcType="BIGINT" property="fundAccountId" /> | 16 | <result column="fund_account_id" jdbcType="BIGINT" property="fundAccountId" /> |
| 17 | <result column="pay_fee" jdbcType="BIGINT" property="payFee" /> | 17 | <result column="pay_fee" jdbcType="BIGINT" property="payFee" /> |
| 18 | - <result column="pay_status" jdbcType="TINYINT" property="payStatus" /> | 18 | + <result column="pay_state" jdbcType="TINYINT" property="payState" /> |
| 19 | <result column="pay_time" jdbcType="TIMESTAMP" property="payTime" /> | 19 | <result column="pay_time" jdbcType="TIMESTAMP" property="payTime" /> |
| 20 | <result column="channel_id" jdbcType="TINYINT" property="channelId" /> | 20 | <result column="channel_id" jdbcType="TINYINT" property="channelId" /> |
| 21 | <result column="cashier_url" jdbcType="VARCHAR" property="cashierUrl" /> | 21 | <result column="cashier_url" jdbcType="VARCHAR" property="cashierUrl" /> |
| @@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
| 26 | </resultMap> | 26 | </resultMap> |
| 27 | <sql id="Base_Column_List"> | 27 | <sql id="Base_Column_List"> |
| 28 | id, pay_trade_no, biz_order_id, order_id, trade_id, pay_payment_id, mch_id, card_no, | 28 | id, pay_trade_no, biz_order_id, order_id, trade_id, pay_payment_id, mch_id, card_no, |
| 29 | - username, user_id, account_id, fund_account_id, pay_fee, pay_status, pay_time, channel_id, | 29 | + username, user_id, account_id, fund_account_id, pay_fee, pay_state, pay_time, channel_id, |
| 30 | cashier_url, payment_callback, version, created_time, modified_time | 30 | cashier_url, payment_callback, version, created_time, modified_time |
| 31 | </sql> | 31 | </sql> |
| 32 | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 32 | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| @@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
| 44 | order_id, trade_id, pay_payment_id, | 44 | order_id, trade_id, pay_payment_id, |
| 45 | mch_id, card_no, username, | 45 | mch_id, card_no, username, |
| 46 | user_id, account_id, fund_account_id, | 46 | user_id, account_id, fund_account_id, |
| 47 | - pay_fee, pay_status, pay_time, | 47 | + pay_fee, pay_state, pay_time, |
| 48 | channel_id, cashier_url, payment_callback, | 48 | channel_id, cashier_url, payment_callback, |
| 49 | version, created_time, modified_time | 49 | version, created_time, modified_time |
| 50 | ) | 50 | ) |
| @@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
| 52 | #{orderId,jdbcType=VARCHAR}, #{tradeId,jdbcType=VARCHAR}, #{payPaymentId,jdbcType=VARCHAR}, | 52 | #{orderId,jdbcType=VARCHAR}, #{tradeId,jdbcType=VARCHAR}, #{payPaymentId,jdbcType=VARCHAR}, |
| 53 | #{mchId,jdbcType=VARCHAR}, #{cardNo,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, | 53 | #{mchId,jdbcType=VARCHAR}, #{cardNo,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, |
| 54 | #{userId,jdbcType=BIGINT}, #{accountId,jdbcType=BIGINT}, #{fundAccountId,jdbcType=BIGINT}, | 54 | #{userId,jdbcType=BIGINT}, #{accountId,jdbcType=BIGINT}, #{fundAccountId,jdbcType=BIGINT}, |
| 55 | - #{payFee,jdbcType=BIGINT}, #{payStatus,jdbcType=TINYINT}, #{payTime,jdbcType=TIMESTAMP}, | 55 | + #{payFee,jdbcType=BIGINT}, #{payState,jdbcType=TINYINT}, #{payTime,jdbcType=TIMESTAMP}, |
| 56 | #{channelId,jdbcType=TINYINT}, #{cashierUrl,jdbcType=VARCHAR}, #{paymentCallback,jdbcType=VARCHAR}, | 56 | #{channelId,jdbcType=TINYINT}, #{cashierUrl,jdbcType=VARCHAR}, #{paymentCallback,jdbcType=VARCHAR}, |
| 57 | #{version,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, #{modifiedTime,jdbcType=TIMESTAMP} | 57 | #{version,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, #{modifiedTime,jdbcType=TIMESTAMP} |
| 58 | ) | 58 | ) |
| @@ -99,8 +99,8 @@ | @@ -99,8 +99,8 @@ | ||
| 99 | <if test="payFee != null"> | 99 | <if test="payFee != null"> |
| 100 | pay_fee, | 100 | pay_fee, |
| 101 | </if> | 101 | </if> |
| 102 | - <if test="payStatus != null"> | ||
| 103 | - pay_status, | 102 | + <if test="payState != null"> |
| 103 | + pay_state, | ||
| 104 | </if> | 104 | </if> |
| 105 | <if test="payTime != null"> | 105 | <if test="payTime != null"> |
| 106 | pay_time, | 106 | pay_time, |
| @@ -164,8 +164,8 @@ | @@ -164,8 +164,8 @@ | ||
| 164 | <if test="payFee != null"> | 164 | <if test="payFee != null"> |
| 165 | #{payFee,jdbcType=BIGINT}, | 165 | #{payFee,jdbcType=BIGINT}, |
| 166 | </if> | 166 | </if> |
| 167 | - <if test="payStatus != null"> | ||
| 168 | - #{payStatus,jdbcType=TINYINT}, | 167 | + <if test="payState != null"> |
| 168 | + #{payState,jdbcType=TINYINT}, | ||
| 169 | </if> | 169 | </if> |
| 170 | <if test="payTime != null"> | 170 | <if test="payTime != null"> |
| 171 | #{payTime,jdbcType=TIMESTAMP}, | 171 | #{payTime,jdbcType=TIMESTAMP}, |
| @@ -229,8 +229,8 @@ | @@ -229,8 +229,8 @@ | ||
| 229 | <if test="payFee != null"> | 229 | <if test="payFee != null"> |
| 230 | pay_fee = #{payFee,jdbcType=BIGINT}, | 230 | pay_fee = #{payFee,jdbcType=BIGINT}, |
| 231 | </if> | 231 | </if> |
| 232 | - <if test="payStatus != null"> | ||
| 233 | - pay_status = #{payStatus,jdbcType=TINYINT}, | 232 | + <if test="payState != null"> |
| 233 | + pay_state = #{payState,jdbcType=TINYINT}, | ||
| 234 | </if> | 234 | </if> |
| 235 | <if test="payTime != null"> | 235 | <if test="payTime != null"> |
| 236 | pay_time = #{payTime,jdbcType=TIMESTAMP}, | 236 | pay_time = #{payTime,jdbcType=TIMESTAMP}, |
| @@ -270,7 +270,7 @@ | @@ -270,7 +270,7 @@ | ||
| 270 | account_id = #{accountId,jdbcType=BIGINT}, | 270 | account_id = #{accountId,jdbcType=BIGINT}, |
| 271 | fund_account_id = #{fundAccountId,jdbcType=BIGINT}, | 271 | fund_account_id = #{fundAccountId,jdbcType=BIGINT}, |
| 272 | pay_fee = #{payFee,jdbcType=BIGINT}, | 272 | pay_fee = #{payFee,jdbcType=BIGINT}, |
| 273 | - pay_status = #{payStatus,jdbcType=TINYINT}, | 273 | + pay_state = #{payState,jdbcType=TINYINT}, |
| 274 | pay_time = #{payTime,jdbcType=TIMESTAMP}, | 274 | pay_time = #{payTime,jdbcType=TIMESTAMP}, |
| 275 | channel_id = #{channelId,jdbcType=TINYINT}, | 275 | channel_id = #{channelId,jdbcType=TINYINT}, |
| 276 | cashier_url = #{cashierUrl,jdbcType=VARCHAR}, | 276 | cashier_url = #{cashierUrl,jdbcType=VARCHAR}, |
cashier-shared/src/main/java/com/diligrp/cashier/shared/Constants.java
| @@ -14,4 +14,6 @@ public final class Constants { | @@ -14,4 +14,6 @@ public final class Constants { | ||
| 14 | public static final int MAX_POOL_SIZE = 200; | 14 | public static final int MAX_POOL_SIZE = 200; |
| 15 | 15 | ||
| 16 | public final static String CONTENT_TYPE = "application/json;charset=UTF-8"; | 16 | public final static String CONTENT_TYPE = "application/json;charset=UTF-8"; |
| 17 | -} | ||
| 18 | \ No newline at end of file | 17 | \ No newline at end of file |
| 18 | + | ||
| 19 | + public final static String PRODUCT_NAME = "cashier:"; | ||
| 20 | +} |
cashier-shared/src/main/java/com/diligrp/cashier/shared/aop/RepeatSubmitAop.java
| @@ -71,6 +71,6 @@ public class RepeatSubmitAop { | @@ -71,6 +71,6 @@ public class RepeatSubmitAop { | ||
| 71 | */ | 71 | */ |
| 72 | @AfterThrowing(value = "@annotation(repeatSubmit)", throwing = "e") | 72 | @AfterThrowing(value = "@annotation(repeatSubmit)", throwing = "e") |
| 73 | public void doAfterThrowing(JoinPoint joinPoint, RepeatSubmit repeatSubmit, Exception e) { | 73 | public void doAfterThrowing(JoinPoint joinPoint, RepeatSubmit repeatSubmit, Exception e) { |
| 74 | - log.error("repeat submit aspect after throwing"); | 74 | + log.error("business handler exception"); |
| 75 | } | 75 | } |
| 76 | } | 76 | } |
cashier-shared/src/main/java/com/diligrp/cashier/shared/util/ValidateUtils.java
0 → 100644
| 1 | +package com.diligrp.cashier.shared.util; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.ConstraintViolation; | ||
| 4 | +import jakarta.validation.Validation; | ||
| 5 | +import jakarta.validation.Validator; | ||
| 6 | +import jakarta.validation.ValidatorFactory; | ||
| 7 | +import org.apache.commons.lang3.StringUtils; | ||
| 8 | + | ||
| 9 | +import java.util.List; | ||
| 10 | +import java.util.Set; | ||
| 11 | +import java.util.function.Consumer; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * @ClassName ValidateUtils.java | ||
| 15 | + * @author dengwei | ||
| 16 | + * @version 1.0.0 | ||
| 17 | + * @Description ValidateUtils | ||
| 18 | + * @date 2025-12-26 15:00 | ||
| 19 | + */ | ||
| 20 | +public class ValidateUtils { | ||
| 21 | + private static final Validator VALIDATOR; | ||
| 22 | + | ||
| 23 | + static { | ||
| 24 | + ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); | ||
| 25 | + VALIDATOR = factory.getValidator(); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 校验器 | ||
| 30 | + */ | ||
| 31 | + public static <T> void valid(T t, Consumer<String> consumer) { | ||
| 32 | + Set<ConstraintViolation<T>> errors = VALIDATOR.validate(t); | ||
| 33 | + List<String> msg = errors.stream().map(ConstraintViolation::getMessage).toList(); | ||
| 34 | + if (!msg.isEmpty()) { | ||
| 35 | + consumer.accept(StringUtils.join(msg, "、")); | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | +} |
cashier-trade/src/main/java/com/diligrp/cashier/trade/type/SnowflakeKey.java
| @@ -4,6 +4,9 @@ import com.diligrp.cashier.assistant.service.impl.SnowflakeKeyManager; | @@ -4,6 +4,9 @@ import com.diligrp.cashier.assistant.service.impl.SnowflakeKeyManager; | ||
| 4 | 4 | ||
| 5 | public enum SnowflakeKey implements SnowflakeKeyManager.SnowflakeKey { | 5 | public enum SnowflakeKey implements SnowflakeKeyManager.SnowflakeKey { |
| 6 | TRADE_ID, | 6 | TRADE_ID, |
| 7 | - | ||
| 8 | - PAYMENT_ID | 7 | + PAYMENT_ID, |
| 8 | + MALL_BIZ_ORDER_ID, | ||
| 9 | + MALL_BIZ_PAYMENT_ID, | ||
| 10 | + MALL_BIZ_REFUND_ID, | ||
| 11 | + ; | ||
| 9 | } | 12 | } |