From 98ebc6bc380208fbb5c918522be6255590ffd1da Mon Sep 17 00:00:00 2001 From: taozi <9108791@qq.com> Date: Tue, 21 Dec 2021 17:37:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=9B=9E=E8=B0=83=E6=9C=AA?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=94=AE=E5=90=8E=E7=8A=B6=E6=80=81=E3=80=81?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=A8=A1=E7=B3=8A=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/service/dto/MenuQueryCriteria.java | 10 +++++ .../rest/controller/WechatController.java | 14 +++++++ .../yixiang/enums/AfterSalesStatusEnum.java | 39 +++++++++++++++++++ .../impl/StoreAfterSalesServiceImpl.java | 20 +++++----- 4 files changed, 73 insertions(+), 10 deletions(-) create mode 100644 yshop-common/src/main/java/co/yixiang/enums/AfterSalesStatusEnum.java diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/MenuQueryCriteria.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/MenuQueryCriteria.java index 3b2afc8a..fdc2637d 100644 --- a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/MenuQueryCriteria.java +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/MenuQueryCriteria.java @@ -8,12 +8,22 @@ */ package co.yixiang.modules.system.service.dto; +import co.yixiang.annotation.Query; import lombok.Data; +import java.sql.Timestamp; +import java.util.List; + /** * @author hupeng * @date 2020-05-14 */ @Data public class MenuQueryCriteria{ + + @Query(blurry = "name") + private String blurry; + + @Query(type = Query.Type.BETWEEN) + private List createTime; } diff --git a/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/controller/WechatController.java b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/controller/WechatController.java index dcc2f191..72211ebf 100644 --- a/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/controller/WechatController.java +++ b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/controller/WechatController.java @@ -12,6 +12,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService; import co.yixiang.annotation.AnonymousAccess; import co.yixiang.api.ApiResult; import co.yixiang.constant.SystemConfigConstants; +import co.yixiang.enums.AfterSalesStatusEnum; import co.yixiang.enums.BillDetailEnum; import co.yixiang.enums.OrderInfoEnum; import co.yixiang.enums.PayMethodEnum; @@ -19,6 +20,8 @@ import co.yixiang.enums.PayTypeEnum; import co.yixiang.modules.order.domain.YxStoreOrder; import co.yixiang.modules.order.service.YxStoreOrderService; import co.yixiang.modules.order.vo.YxStoreOrderQueryVo; +import co.yixiang.modules.sales.domain.StoreAfterSales; +import co.yixiang.modules.sales.service.StoreAfterSalesService; import co.yixiang.modules.shop.service.YxSystemConfigService; import co.yixiang.modules.user.domain.YxUserRecharge; import co.yixiang.modules.user.service.YxUserRechargeService; @@ -26,6 +29,7 @@ import co.yixiang.modules.mp.config.WxMpConfiguration; import co.yixiang.modules.mp.config.WxPayConfiguration; import co.yixiang.modules.mp.config.WxMaConfiguration; import co.yixiang.utils.BigNum; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse; import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult; @@ -54,6 +58,7 @@ import java.io.PrintWriter; import java.math.BigDecimal; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Objects; /** * @ClassName WechatController @@ -69,6 +74,7 @@ public class WechatController { private final YxStoreOrderService orderService; private final YxSystemConfigService systemConfigService; private final YxUserRechargeService userRechargeService; + private final StoreAfterSalesService storeAfterSalesService; /** @@ -202,6 +208,14 @@ public class WechatController { storeOrder.setRefundPrice(refundFee); orderService.updateById(storeOrder); orderService.retrunStock(orderId); + //售后状态修改 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(StoreAfterSales::getOrderCode, orderId); + StoreAfterSales storeAfterSales = storeAfterSalesService.getOne(wrapper); + if (Objects.nonNull(storeAfterSales)) { + storeAfterSales.setState(AfterSalesStatusEnum.STATUS_3.getValue()); + storeAfterSalesService.updateById(storeAfterSales); + } return WxPayNotifyResponse.success("处理成功!"); } catch (WxPayException | IllegalAccessException e) { log.error(e.getMessage()); diff --git a/yshop-common/src/main/java/co/yixiang/enums/AfterSalesStatusEnum.java b/yshop-common/src/main/java/co/yixiang/enums/AfterSalesStatusEnum.java new file mode 100644 index 00000000..513897b8 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/AfterSalesStatusEnum.java @@ -0,0 +1,39 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.stream.Stream; + +/** + * 售后状态枚举 + * + * @author hupeng + * @date 2021/12/21 + */ +@Getter +@AllArgsConstructor +public enum AfterSalesStatusEnum { + + STATUS_0(0,"已提交等待平台审核"), + STATUS_1(1,"平台已审核,等待用户发货/退款"), + STATUS_2(2,"用户已发货"), + STATUS_3(3,"已完成"); + + private Integer value; + private String desc; + + public static AfterSalesStatusEnum toType(int value) { + return Stream.of(AfterSalesStatusEnum.values()) + .filter(p -> p.value == value) + .findAny() + .orElse(null); + } + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java index f2b2f260..cf4c65bb 100644 --- a/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java @@ -1,11 +1,11 @@ package co.yixiang.modules.sales.service.impl; -import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.NumberUtil; import co.yixiang.api.YshopException; import co.yixiang.common.service.impl.BaseServiceImpl; import co.yixiang.common.utils.QueryHelpPlus; import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.AfterSalesStatusEnum; import co.yixiang.enums.OrderInfoEnum; import co.yixiang.enums.ShopCommonEnum; import co.yixiang.exception.ErrorRequestException; @@ -101,7 +101,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpllambdaQuery() - .eq(uid != null, StoreAfterSales::getUserId, uid).in(status == 1, StoreAfterSales::getState, integers) - .in(status != 0, StoreAfterSales::getState, integers) + .eq(uid != null, StoreAfterSales::getUserId, uid).in(status.equals(AfterSalesStatusEnum.STATUS_1.getValue()), StoreAfterSales::getState, integers) + .in(!status.equals(AfterSalesStatusEnum.STATUS_0.getValue()), StoreAfterSales::getState, integers) .eq(StringUtils.isNotBlank(orderCode), StoreAfterSales::getOrderCode, orderCode) .orderByDesc(StoreAfterSales::getCreateTime) .eq(StoreAfterSales::getIsDel, ShopCommonEnum.DELETE_0.getValue())); @@ -237,7 +237,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpllambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode)); - if (storeAfterSales.getState() != 1) { + if (!storeAfterSales.getState().equals(AfterSalesStatusEnum.STATUS_1.getValue())) { throw new YshopException("当前状态不能添加物流信息!"); } storeAfterSales.setShipperCode(code); storeAfterSales.setDeliverySn(postalCode); storeAfterSales.setDeliveryName(name); - storeAfterSales.setState(2); + storeAfterSales.setState(AfterSalesStatusEnum.STATUS_2.getValue()); //操作记录 StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); @@ -297,7 +297,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpllambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode).eq(StoreAfterSales::getId, salesId)); if (approvalStatus == 0) { - storeAfterSales.setState(1); + storeAfterSales.setState(AfterSalesStatusEnum.STATUS_1.getValue()); if (storeAfterSales.getServiceType() == 1) { if (StringUtils.isEmpty(consignee) || StringUtils.isEmpty(phoneNumber) || StringUtils.isEmpty(address)) { throw new ErrorRequestException("请输入收货人信息"); @@ -315,7 +315,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpllambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode).eq(StoreAfterSales::getId, salesId)); - storeAfterSales.setState(3); + storeAfterSales.setState(AfterSalesStatusEnum.STATUS_3.getValue()); baseMapper.updateById(storeAfterSales); //操作记录 StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus();