Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop into feature/pg

This commit is contained in:
paulGao 2022-01-21 19:01:10 +08:00
commit 3de2b9834d
15 changed files with 167 additions and 44 deletions

View File

@ -75,7 +75,7 @@ PS手机验证码为 111111
#### 平台管理端功能 #### 平台管理端功能
![平台管理端功能](https://pickmall.cn/assets/imgs/other/managerList.jpg) ![平台管理端功能](https://pickmall.cn/assets/imgs/other/managerList1.jpg)

View File

@ -10,6 +10,7 @@ import cn.lili.common.utils.SnowFlake;
import cn.lili.event.OrderStatusChangeEvent; import cn.lili.event.OrderStatusChangeEvent;
import cn.lili.event.TradeEvent; import cn.lili.event.TradeEvent;
import cn.lili.modules.goods.entity.dos.GoodsSku; import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.goods.entity.enums.GoodsTypeEnum;
import cn.lili.modules.goods.service.GoodsSkuService; import cn.lili.modules.goods.service.GoodsSkuService;
import cn.lili.modules.member.entity.enums.PointTypeEnum; import cn.lili.modules.member.entity.enums.PointTypeEnum;
import cn.lili.modules.member.service.MemberService; import cn.lili.modules.member.service.MemberService;
@ -34,6 +35,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 订单状态处理类 * 订单状态处理类
@ -90,6 +92,7 @@ public class FullDiscountExecute implements TradeEvent, OrderStatusChangeEvent {
@Override @Override
public void orderChange(OrderMessage orderMessage) { public void orderChange(OrderMessage orderMessage) {
//如果订单已支付
if (orderMessage.getNewStatus().equals(OrderStatusEnum.PAID)) { if (orderMessage.getNewStatus().equals(OrderStatusEnum.PAID)) {
log.debug("满减活动,订单状态操作 {}", CachePrefix.ORDER.getPrefix() + orderMessage.getOrderSn()); log.debug("满减活动,订单状态操作 {}", CachePrefix.ORDER.getPrefix() + orderMessage.getOrderSn());
renderGift(JSONUtil.toBean(cache.getString(CachePrefix.ORDER.getPrefix() + orderMessage.getOrderSn()), CartVO.class), orderMessage); renderGift(JSONUtil.toBean(cache.getString(CachePrefix.ORDER.getPrefix() + orderMessage.getOrderSn()), CartVO.class), orderMessage);
@ -142,49 +145,89 @@ public class FullDiscountExecute implements TradeEvent, OrderStatusChangeEvent {
* @param originOrder 赠品原订单信息 * @param originOrder 赠品原订单信息
*/ */
private void generatorGiftOrder(List<String> skuIds, Order originOrder) { private void generatorGiftOrder(List<String> skuIds, Order originOrder) {
//获取赠品列表
List<GoodsSku> goodsSkus = goodsSkuService.getGoodsSkuByIdFromCache(skuIds);
//赠品判定
if (goodsSkus == null || goodsSkus.isEmpty()) {
log.error("赠品不存在:{}", skuIds);
return;
}
//赠品分类分为实体商品/虚拟商品/电子卡券
List<GoodsSku> physicalSkus = goodsSkus.stream().filter(goodsSku -> goodsSku.getGoodsType().equals(GoodsTypeEnum.PHYSICAL_GOODS.name())).collect(Collectors.toList());
List<GoodsSku> virtualSkus = goodsSkus.stream().filter(goodsSku -> goodsSku.getGoodsType().equals(GoodsTypeEnum.VIRTUAL_GOODS.name())).collect(Collectors.toList());
List<GoodsSku> eCouponSkus = goodsSkus.stream().filter(goodsSku -> goodsSku.getGoodsType().equals(GoodsTypeEnum.E_COUPON.name())).collect(Collectors.toList());
//如果赠品不为空则生成对应的赠品订单
if (!physicalSkus.isEmpty()) {
giftOrderHandler(physicalSkus, originOrder, OrderTypeEnum.NORMAL);
}
if (!virtualSkus.isEmpty()) {
giftOrderHandler(virtualSkus, originOrder, OrderTypeEnum.VIRTUAL);
}
if (!eCouponSkus.isEmpty()) {
giftOrderHandler(eCouponSkus, originOrder, OrderTypeEnum.E_COUPON);
}
}
/**
* 赠品订单处理
*
* @param skuList 赠品列表
* @param originOrder 原始订单
* @param orderTypeEnum 订单类型
*/
private void giftOrderHandler(List<GoodsSku> skuList, Order originOrder, OrderTypeEnum orderTypeEnum) {
//初始化订单对象/订单日志/自订单
Order order = new Order();
List<OrderItem> orderItems = new ArrayList<>(); List<OrderItem> orderItems = new ArrayList<>();
List<OrderLog> orderLogs = new ArrayList<>(); List<OrderLog> orderLogs = new ArrayList<>();
Order order = new Order(); //初始化价格详情
PriceDetailDTO priceDetailDTO = new PriceDetailDTO(); PriceDetailDTO priceDetailDTO = new PriceDetailDTO();
//复制通用属性
BeanUtil.copyProperties(originOrder, order, "id"); BeanUtil.copyProperties(originOrder, order, "id");
BeanUtil.copyProperties(priceDetailDTO, order, "id"); BeanUtil.copyProperties(priceDetailDTO, order, "id");
//生成订单参数
order.setSn(SnowFlake.createStr("G")); order.setSn(SnowFlake.createStr("G"));
order.setOrderType(OrderPromotionTypeEnum.GIFT.name()); order.setOrderPromotionType(OrderPromotionTypeEnum.GIFT.name());
order.setOrderStatus(OrderStatusEnum.UNPAID.name()); order.setOrderStatus(OrderStatusEnum.UNPAID.name());
order.setPayStatus(PayStatusEnum.PAID.name()); order.setPayStatus(PayStatusEnum.PAID.name());
order.setDeliverStatus(DeliverStatusEnum.UNDELIVERED.name()); order.setOrderType(orderTypeEnum.name());
order.setNeedReceipt(false); order.setNeedReceipt(false);
order.setPriceDetailDTO(priceDetailDTO); order.setPriceDetailDTO(priceDetailDTO);
order.setClientType(originOrder.getClientType()); order.setClientType(originOrder.getClientType());
//订单日志
String message = "赠品订单[" + order.getSn() + "]创建"; String message = "赠品订单[" + order.getSn() + "]创建";
orderLogs.add(new OrderLog(order.getSn(), originOrder.getMemberId(), UserEnums.MEMBER.name(), originOrder.getMemberName(), message)); orderLogs.add(new OrderLog(order.getSn(), originOrder.getMemberId(), UserEnums.MEMBER.name(), originOrder.getMemberName(), message));
for (String skuId : skuIds) { //生成子订单
GoodsSku goodsSkuByIdFromCache = goodsSkuService.getGoodsSkuByIdFromCache(skuId); for (GoodsSku goodsSku : skuList) {
OrderItem orderItem = new OrderItem(); OrderItem orderItem = new OrderItem();
BeanUtil.copyProperties(goodsSkuByIdFromCache, orderItem, "id"); BeanUtil.copyProperties(goodsSku, orderItem, "id");
BeanUtil.copyProperties(priceDetailDTO, orderItem, "id"); BeanUtil.copyProperties(priceDetailDTO, orderItem, "id");
orderItem.setAfterSaleStatus(OrderItemAfterSaleStatusEnum.NEW.name()); orderItem.setAfterSaleStatus(OrderItemAfterSaleStatusEnum.NEW.name());
orderItem.setCommentStatus(CommentStatusEnum.NEW.name()); orderItem.setCommentStatus(CommentStatusEnum.NEW.name());
orderItem.setComplainStatus(OrderComplaintStatusEnum.NEW.name()); orderItem.setComplainStatus(OrderComplaintStatusEnum.NEW.name());
orderItem.setNum(1); orderItem.setNum(1);
orderItem.setOrderSn(order.getSn()); orderItem.setOrderSn(order.getSn());
orderItem.setImage(goodsSkuByIdFromCache.getThumbnail()); orderItem.setImage(goodsSku.getThumbnail());
orderItem.setGoodsName(goodsSkuByIdFromCache.getGoodsName()); orderItem.setGoodsName(goodsSku.getGoodsName());
orderItem.setSkuId(goodsSkuByIdFromCache.getId()); orderItem.setSkuId(goodsSku.getId());
orderItem.setCategoryId(goodsSkuByIdFromCache.getCategoryPath().substring( orderItem.setCategoryId(goodsSku.getCategoryPath().substring(
goodsSkuByIdFromCache.getCategoryPath().lastIndexOf(",") + 1 goodsSku.getCategoryPath().lastIndexOf(",") + 1
)); ));
orderItem.setGoodsPrice(goodsSkuByIdFromCache.getPrice()); orderItem.setGoodsPrice(goodsSku.getPrice());
orderItem.setPriceDetailDTO(priceDetailDTO); orderItem.setPriceDetailDTO(priceDetailDTO);
orderItems.add(orderItem); orderItems.add(orderItem);
} }
//保存订单
orderService.save(order); orderService.save(order);
orderItemService.saveBatch(orderItems); orderItemService.saveBatch(orderItems);
orderLogService.saveBatch(orderLogs); orderLogService.saveBatch(orderLogs);
//发送订单已付款消息 //发送订单已付款消息PS:不在这里处理逻辑是因为期望加交给消费者统一处理库存等等问题
OrderMessage orderMessage = new OrderMessage(); OrderMessage orderMessage = new OrderMessage();
orderMessage.setOrderSn(order.getSn()); orderMessage.setOrderSn(order.getSn());
orderMessage.setPaymentMethod(order.getPaymentMethod()); orderMessage.setPaymentMethod(order.getPaymentMethod());
@ -193,7 +236,5 @@ public class FullDiscountExecute implements TradeEvent, OrderStatusChangeEvent {
String destination = rocketmqCustomProperties.getOrderTopic() + ":" + OrderTagsEnum.STATUS_CHANGE.name(); String destination = rocketmqCustomProperties.getOrderTopic() + ":" + OrderTagsEnum.STATUS_CHANGE.name();
//发送订单变更mq消息 //发送订单变更mq消息
rocketMQTemplate.asyncSend(destination, JSONUtil.toJsonStr(orderMessage), RocketmqSendCallbackBuilder.commonCallback()); rocketMQTemplate.asyncSend(destination, JSONUtil.toJsonStr(orderMessage), RocketmqSendCallbackBuilder.commonCallback());
} }
} }

View File

@ -103,14 +103,18 @@ public class MemberPointExecute implements MemberRegisterEvent, GoodsCommentComp
} }
case COMPLETED: { case COMPLETED: {
Order order = orderService.getBySn(orderMessage.getOrderSn()); Order order = orderService.getBySn(orderMessage.getOrderSn());
//根据订单编号获取订单数据,如果订单促销类型不为空并且订单促销类型为积分订单 则直接返回 //如果是积分订单 则直接返回
if (StringUtils.isNotEmpty(order.getOrderPromotionType()) && order.getOrderPromotionType().equals(OrderPromotionTypeEnum.POINTS.name())) { if (StringUtils.isNotEmpty(order.getOrderPromotionType())
&& order.getOrderPromotionType().equals(OrderPromotionTypeEnum.POINTS.name())) {
return; return;
} }
//获取积分设置 //获取积分设置
PointSetting pointSetting = getPointSetting(); PointSetting pointSetting = getPointSetting();
if (pointSetting.getConsumer() == 0) {
return;
}
//计算赠送积分数量 //计算赠送积分数量
Double point = CurrencyUtil.mul(pointSetting.getMoney(), order.getFlowPrice(), 0); Double point = CurrencyUtil.mul(pointSetting.getConsumer(), order.getFlowPrice(), 0);
//赠送会员积分 //赠送会员积分
memberService.updateMemberPoint(point.longValue(), PointTypeEnum.INCREASE.name(), order.getMemberId(), "会员下单,赠送积分" + point + ""); memberService.updateMemberPoint(point.longValue(), PointTypeEnum.INCREASE.name(), order.getMemberId(), "会员下单,赠送积分" + point + "");
break; break;

View File

@ -36,9 +36,9 @@ public final class CurrencyUtil {
return result.doubleValue(); return result.doubleValue();
} }
/** /**
* 提供精确的法运算 * 提供精确的法运算
* *
* @return 累加之和 * @return 第一个参数为被减数其余数字为减数
*/ */
public static Double sub(double... params) { public static Double sub(double... params) {
BigDecimal result = BigDecimal.valueOf(params[0]); BigDecimal result = BigDecimal.valueOf(params[0]);

View File

@ -103,7 +103,7 @@ public class GoodsOperationDTO implements Serializable {
* @see cn.lili.modules.goods.entity.enums.GoodsTypeEnum * @see cn.lili.modules.goods.entity.enums.GoodsTypeEnum
*/ */
@ApiModelProperty(value = "商品类型") @ApiModelProperty(value = "商品类型")
@EnumValue(strValues = {"PHYSICAL_GOODS","VIRTUAL_GOODS","E_COUPON"},message = "商品类型参数值错误") @EnumValue(strValues = {"PHYSICAL_GOODS", "VIRTUAL_GOODS", "E_COUPON"}, message = "商品类型参数值错误")
private String goodsType; private String goodsType;
/** /**
@ -112,6 +112,9 @@ public class GoodsOperationDTO implements Serializable {
@ApiModelProperty(value = "商品视频") @ApiModelProperty(value = "商品视频")
private String goodsVideo; private String goodsVideo;
public String getGoodsName() {
//对商品对名称做一个极限处理这里没有用xss过滤是因为xss过滤为全局过滤影响很大
// 业务中全局代码中只有商品名称不能拥有英文逗号是由于商品名称存在一个数据库联合查询结果要根据逗号分组
return goodsName.replace(",", "");
}
} }

View File

@ -1,5 +1,6 @@
package cn.lili.modules.order.order.entity.dos; package cn.lili.modules.order.order.entity.dos;
import cn.lili.modules.order.order.entity.enums.PayStatusEnum;
import cn.lili.mybatis.BaseEntity; import cn.lili.mybatis.BaseEntity;
import cn.lili.common.utils.BeanUtil; import cn.lili.common.utils.BeanUtil;
import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum; import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum;
@ -82,6 +83,7 @@ public class Trade extends BaseEntity {
} }
BeanUtil.copyProperties(tradeDTO, this); BeanUtil.copyProperties(tradeDTO, this);
BeanUtil.copyProperties(tradeDTO.getPriceDetailDTO(), this); BeanUtil.copyProperties(tradeDTO.getPriceDetailDTO(), this);
this.setPayStatus(PayStatusEnum.UNPAID.name());
this.setId(originId); this.setId(originId);
} }
} }

View File

@ -309,7 +309,7 @@ public class PriceDetailDTO implements Serializable {
} }
public Double getUpdatePrice() { public Double getUpdatePrice() {
if (updatePrice == null || updatePrice <= 0) { if (updatePrice == null) {
return 0D; return 0D;
} }
return updatePrice; return updatePrice;

View File

@ -16,5 +16,10 @@ public enum OrderTypeEnum {
/** /**
* 虚拟订单 * 虚拟订单
*/ */
VIRTUAL VIRTUAL,
/**
* 虚拟订单
*/
E_COUPON,
} }

View File

@ -16,6 +16,7 @@ import cn.lili.modules.order.order.service.OrderPriceService;
import cn.lili.modules.order.order.service.OrderService; import cn.lili.modules.order.order.service.OrderService;
import cn.lili.modules.payment.kit.plugin.bank.BankTransferPlugin; import cn.lili.modules.payment.kit.plugin.bank.BankTransferPlugin;
import cn.lili.modules.system.aspect.annotation.SystemLogPoint; import cn.lili.modules.system.aspect.annotation.SystemLogPoint;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -29,6 +30,7 @@ import java.util.List;
* @author Chopper * @author Chopper
* @since 2020/11/17 7:36 下午 * @since 2020/11/17 7:36 下午
*/ */
@Slf4j
@Service @Service
public class OrderPriceServiceImpl implements OrderPriceService { public class OrderPriceServiceImpl implements OrderPriceService {
@ -106,10 +108,8 @@ public class OrderPriceServiceImpl implements OrderPriceService {
//订单修改金额=使用订单原始金额-修改后金额 //订单修改金额=使用订单原始金额-修改后金额
orderPriceDetailDTO.setUpdatePrice(CurrencyUtil.sub(orderPrice, orderPriceDetailDTO.getOriginalPrice())); orderPriceDetailDTO.setUpdatePrice(CurrencyUtil.sub(orderPrice, orderPriceDetailDTO.getOriginalPrice()));
order.setFlowPrice(orderPriceDetailDTO.getFlowPrice()); order.setFlowPrice(orderPriceDetailDTO.getFlowPrice());
order.setPriceDetail(JSONUtil.toJsonStr(orderPriceDetailDTO));
//修改订单 //修改订单
order.setPriceDetail(JSONUtil.toJsonStr(orderPriceDetailDTO)); order.setPriceDetailDTO(orderPriceDetailDTO);
orderService.updateById(order); orderService.updateById(order);
//修改子订单 //修改子订单

View File

@ -642,7 +642,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
public Double getPaymentTotal(String orderSn) { public Double getPaymentTotal(String orderSn) {
Order order = this.getBySn(orderSn); Order order = this.getBySn(orderSn);
Trade trade = tradeService.getBySn(order.getTradeSn()); Trade trade = tradeService.getBySn(order.getTradeSn());
if (trade.getPayStatus().equals(PayStatusEnum.PAID.name())) { //如果交易不为空则返回交易的金额否则返回订单金额
if (StringUtils.isNotEmpty(trade.getPayStatus())
&& trade.getPayStatus().equals(PayStatusEnum.PAID.name())) {
return trade.getFlowPrice(); return trade.getFlowPrice();
} }
return order.getFlowPrice(); return order.getFlowPrice();

View File

@ -273,7 +273,7 @@ public class AliPayPlugin implements Payment {
log.info("支付回调通知:支付失败-参数:{}", map); log.info("支付回调通知:支付失败-参数:{}", map);
} }
ThreadContextHolder.getHttpResponse().sendRedirect(domainProperties.getWap()+"/pages/order/myOrder?status=0"); ThreadContextHolder.getHttpResponse().sendRedirect(domainProperties.getWap() + "/pages/order/myOrder?status=0");
} catch (Exception e) { } catch (Exception e) {
log.error("支付回调同步通知异常", e); log.error("支付回调同步通知异常", e);
} }
@ -293,7 +293,11 @@ public class AliPayPlugin implements Payment {
log.info("支付回调响应:{}", JSONUtil.toJsonStr(map)); log.info("支付回调响应:{}", JSONUtil.toJsonStr(map));
boolean verifyResult = AlipaySignature.rsaCertCheckV1(map, alipayPaymentSetting.getAlipayPublicCertPath(), "UTF-8", boolean verifyResult = AlipaySignature.rsaCertCheckV1(map, alipayPaymentSetting.getAlipayPublicCertPath(), "UTF-8",
"RSA2"); "RSA2");
//支付完成判定
if (!"TRADE_FINISHED".equals(map.get("trade_status")) &&
!"TRADE_SUCCESS".equals(map.get("trade_status"))) {
return;
}
String payParamStr = map.get("passback_params"); String payParamStr = map.get("passback_params");
String payParamJson = URLDecoder.decode(payParamStr, StandardCharsets.UTF_8); String payParamJson = URLDecoder.decode(payParamStr, StandardCharsets.UTF_8);
PayParam payParam = BeanUtil.formatKeyValuePair(payParamJson, new PayParam()); PayParam payParam = BeanUtil.formatKeyValuePair(payParamJson, new PayParam());

View File

@ -258,9 +258,6 @@ public class WechatPlugin implements Payment {
WechatPaymentSetting setting = wechatPaymentSetting(); WechatPaymentSetting setting = wechatPaymentSetting();
String appid = setting.getAppId(); String appid = setting.getAppId();
if (appid == null) {
throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING);
}
UnifiedOrderModel unifiedOrderModel = new UnifiedOrderModel() UnifiedOrderModel unifiedOrderModel = new UnifiedOrderModel()
.setAppid(appid) .setAppid(appid)
.setMchid(setting.getMchId()) .setMchid(setting.getMchId())
@ -326,9 +323,6 @@ public class WechatPlugin implements Payment {
WechatPaymentSetting setting = wechatPaymentSetting(); WechatPaymentSetting setting = wechatPaymentSetting();
String appid = setting.getServiceAppId(); String appid = setting.getServiceAppId();
if (appid == null) {
throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING);
}
UnifiedOrderModel unifiedOrderModel = new UnifiedOrderModel() UnifiedOrderModel unifiedOrderModel = new UnifiedOrderModel()
.setAppid(appid) .setAppid(appid)
.setMchid(setting.getMchId()) .setMchid(setting.getMchId())
@ -397,10 +391,6 @@ public class WechatPlugin implements Payment {
//微信小程序appid 需要单独获取这里读取了联合登陆配置的appid 实际场景小程序自动登录所以这个appid是最为保险的做法 //微信小程序appid 需要单独获取这里读取了联合登陆配置的appid 实际场景小程序自动登录所以这个appid是最为保险的做法
//如果有2开需求这里需要调整修改这个appid的获取途径即可 //如果有2开需求这里需要调整修改这个appid的获取途径即可
String appid = wechatPaymentSetting().getMpAppId(); String appid = wechatPaymentSetting().getMpAppId();
if (appid == null) {
throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING);
}
String attach = URLEncoder.createDefault().encode(JSONUtil.toJsonStr(payParam), StandardCharsets.UTF_8); String attach = URLEncoder.createDefault().encode(JSONUtil.toJsonStr(payParam), StandardCharsets.UTF_8);
WechatPaymentSetting setting = wechatPaymentSetting(); WechatPaymentSetting setting = wechatPaymentSetting();

View File

@ -20,7 +20,10 @@ public class PointSetting implements Serializable {
@ApiModelProperty(value = "注册") @ApiModelProperty(value = "注册")
private Integer register; private Integer register;
@ApiModelProperty(value = "1元等级*积分") @ApiModelProperty(value = "消费1元赠送多少积分")
private Integer consumer;
@ApiModelProperty(value = "积分付款X积分=1元")
private Integer money; private Integer money;
@ApiModelProperty(value = "每日签到积分") @ApiModelProperty(value = "每日签到积分")
@ -32,5 +35,38 @@ public class PointSetting implements Serializable {
@ApiModelProperty(value = "积分具体设置") @ApiModelProperty(value = "积分具体设置")
private List<PointSettingItem> pointSettingItems = new ArrayList<>(); private List<PointSettingItem> pointSettingItems = new ArrayList<>();
public Integer getRegister() {
if (register == null || register < 0) {
return 0;
}
return register;
}
public Integer getMoney() {
if (money == null || money < 0) {
return 0;
}
return money;
}
public Integer getConsumer() {
if (consumer == null || consumer < 0) {
return 0;
}
return consumer;
}
public Integer getSignIn() {
if (signIn == null || signIn < 0) {
return 0;
}
return signIn;
}
public Integer getComment() {
if (comment == null || comment < 0) {
return 0;
}
return comment;
}
} }

View File

@ -20,6 +20,17 @@ public class PointSettingItem implements Comparable<PointSettingItem> {
@ApiModelProperty(value = "赠送积分") @ApiModelProperty(value = "赠送积分")
private Integer point; private Integer point;
public Integer getPoint() {
if (point != null || point < 0) {
return 0;
}
return point;
}
public void setPoint(Integer point) {
this.point = point;
}
@Override @Override
public int compareTo(PointSettingItem pointSettingItem) { public int compareTo(PointSettingItem pointSettingItem) {
return this.day - pointSettingItem.getDay(); return this.day - pointSettingItem.getDay();

View File

@ -1,5 +1,8 @@
package cn.lili.modules.system.entity.dto.payment; package cn.lili.modules.system.entity.dto.payment;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import com.alibaba.druid.util.StringUtils;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -14,7 +17,7 @@ import lombok.experimental.Accessors;
public class WechatPaymentSetting { public class WechatPaymentSetting {
/** /**
* APP应用id * APP应用id
*/ */
private String appId; private String appId;
/** /**
@ -49,4 +52,26 @@ public class WechatPaymentSetting {
* apiv3私钥 * apiv3私钥
*/ */
private String apiKey3; private String apiKey3;
public String getAppId() {
if (StringUtils.isEmpty(appId)) {
throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING);
}
return appId;
}
public String getMpAppId() {
if (StringUtils.isEmpty(mpAppId)) {
throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING);
}
return mpAppId;
}
public String getServiceAppId() {
if (StringUtils.isEmpty(serviceAppId)) {
throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING);
}
return serviceAppId;
}
} }