支付回调未更新售后状态、菜单模糊查询

This commit is contained in:
taozi
2021-12-21 17:37:14 +08:00
parent 9979315839
commit 98ebc6bc38
4 changed files with 73 additions and 10 deletions

View File

@ -8,12 +8,22 @@
*/ */
package co.yixiang.modules.system.service.dto; package co.yixiang.modules.system.service.dto;
import co.yixiang.annotation.Query;
import lombok.Data; import lombok.Data;
import java.sql.Timestamp;
import java.util.List;
/** /**
* @author hupeng * @author hupeng
* @date 2020-05-14 * @date 2020-05-14
*/ */
@Data @Data
public class MenuQueryCriteria{ public class MenuQueryCriteria{
@Query(blurry = "name")
private String blurry;
@Query(type = Query.Type.BETWEEN)
private List<Timestamp> createTime;
} }

View File

@ -12,6 +12,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
import co.yixiang.annotation.AnonymousAccess; import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.api.ApiResult; import co.yixiang.api.ApiResult;
import co.yixiang.constant.SystemConfigConstants; import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.enums.AfterSalesStatusEnum;
import co.yixiang.enums.BillDetailEnum; import co.yixiang.enums.BillDetailEnum;
import co.yixiang.enums.OrderInfoEnum; import co.yixiang.enums.OrderInfoEnum;
import co.yixiang.enums.PayMethodEnum; 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.domain.YxStoreOrder;
import co.yixiang.modules.order.service.YxStoreOrderService; import co.yixiang.modules.order.service.YxStoreOrderService;
import co.yixiang.modules.order.vo.YxStoreOrderQueryVo; 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.shop.service.YxSystemConfigService;
import co.yixiang.modules.user.domain.YxUserRecharge; import co.yixiang.modules.user.domain.YxUserRecharge;
import co.yixiang.modules.user.service.YxUserRechargeService; 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.WxPayConfiguration;
import co.yixiang.modules.mp.config.WxMaConfiguration; import co.yixiang.modules.mp.config.WxMaConfiguration;
import co.yixiang.utils.BigNum; 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.WxPayNotifyResponse;
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult; import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
@ -54,6 +58,7 @@ import java.io.PrintWriter;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects;
/** /**
* @ClassName WechatController * @ClassName WechatController
@ -69,6 +74,7 @@ public class WechatController {
private final YxStoreOrderService orderService; private final YxStoreOrderService orderService;
private final YxSystemConfigService systemConfigService; private final YxSystemConfigService systemConfigService;
private final YxUserRechargeService userRechargeService; private final YxUserRechargeService userRechargeService;
private final StoreAfterSalesService storeAfterSalesService;
/** /**
@ -202,6 +208,14 @@ public class WechatController {
storeOrder.setRefundPrice(refundFee); storeOrder.setRefundPrice(refundFee);
orderService.updateById(storeOrder); orderService.updateById(storeOrder);
orderService.retrunStock(orderId); orderService.retrunStock(orderId);
//售后状态修改
LambdaQueryWrapper<StoreAfterSales> 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("处理成功!"); return WxPayNotifyResponse.success("处理成功!");
} catch (WxPayException | IllegalAccessException e) { } catch (WxPayException | IllegalAccessException e) {
log.error(e.getMessage()); log.error(e.getMessage());

View File

@ -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);
}
}

View File

@ -1,11 +1,11 @@
package co.yixiang.modules.sales.service.impl; package co.yixiang.modules.sales.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import co.yixiang.api.YshopException; import co.yixiang.api.YshopException;
import co.yixiang.common.service.impl.BaseServiceImpl; import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus; import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.dozer.service.IGenerator; import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.AfterSalesStatusEnum;
import co.yixiang.enums.OrderInfoEnum; import co.yixiang.enums.OrderInfoEnum;
import co.yixiang.enums.ShopCommonEnum; import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.exception.ErrorRequestException; import co.yixiang.exception.ErrorRequestException;
@ -101,7 +101,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
storeAfterSales.setReasons(storeAfterSalesParam.getReasonForApplication()); storeAfterSales.setReasons(storeAfterSalesParam.getReasonForApplication());
storeAfterSales.setExplains(storeAfterSalesParam.getApplicationInstructions()); storeAfterSales.setExplains(storeAfterSalesParam.getApplicationInstructions());
storeAfterSales.setExplainImg(storeAfterSalesParam.getApplicationDescriptionPicture()); storeAfterSales.setExplainImg(storeAfterSalesParam.getApplicationDescriptionPicture());
storeAfterSales.setState(0); storeAfterSales.setState(AfterSalesStatusEnum.STATUS_0.getValue());
storeAfterSales.setSalesState(0); storeAfterSales.setSalesState(0);
storeAfterSales.setCreateTime(Timestamp.valueOf(LocalDateTime.now())); storeAfterSales.setCreateTime(Timestamp.valueOf(LocalDateTime.now()));
storeAfterSales.setIsDel(0); storeAfterSales.setIsDel(0);
@ -176,8 +176,8 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
integers.add(3); integers.add(3);
} }
baseMapper.selectPage(storeAfterSalesPage, Wrappers.<StoreAfterSales>lambdaQuery() baseMapper.selectPage(storeAfterSalesPage, Wrappers.<StoreAfterSales>lambdaQuery()
.eq(uid != null, StoreAfterSales::getUserId, uid).in(status == 1, StoreAfterSales::getState, integers) .eq(uid != null, StoreAfterSales::getUserId, uid).in(status.equals(AfterSalesStatusEnum.STATUS_1.getValue()), StoreAfterSales::getState, integers)
.in(status != 0, StoreAfterSales::getState, integers) .in(!status.equals(AfterSalesStatusEnum.STATUS_0.getValue()), StoreAfterSales::getState, integers)
.eq(StringUtils.isNotBlank(orderCode), StoreAfterSales::getOrderCode, orderCode) .eq(StringUtils.isNotBlank(orderCode), StoreAfterSales::getOrderCode, orderCode)
.orderByDesc(StoreAfterSales::getCreateTime) .orderByDesc(StoreAfterSales::getCreateTime)
.eq(StoreAfterSales::getIsDel, ShopCommonEnum.DELETE_0.getValue())); .eq(StoreAfterSales::getIsDel, ShopCommonEnum.DELETE_0.getValue()));
@ -237,7 +237,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
if (storeAfterSales == null) { if (storeAfterSales == null) {
throw new YshopException("未查询到售后订单信息"); throw new YshopException("未查询到售后订单信息");
} }
if (storeAfterSales.getState() == 2 || storeAfterSales.getState() == 3) { if (storeAfterSales.getState().equals(AfterSalesStatusEnum.STATUS_2.getValue()) || storeAfterSales.getState().equals(AfterSalesStatusEnum.STATUS_3.getValue())) {
throw new YshopException("订单不能撤销"); throw new YshopException("订单不能撤销");
} }
storeAfterSales.setSalesState(1); storeAfterSales.setSalesState(1);
@ -267,13 +267,13 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
@Override @Override
public Boolean addLogisticsInformation(String code, String name, String postalCode, String orderCode) { public Boolean addLogisticsInformation(String code, String name, String postalCode, String orderCode) {
StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.<StoreAfterSales>lambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode)); StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.<StoreAfterSales>lambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode));
if (storeAfterSales.getState() != 1) { if (!storeAfterSales.getState().equals(AfterSalesStatusEnum.STATUS_1.getValue())) {
throw new YshopException("当前状态不能添加物流信息!"); throw new YshopException("当前状态不能添加物流信息!");
} }
storeAfterSales.setShipperCode(code); storeAfterSales.setShipperCode(code);
storeAfterSales.setDeliverySn(postalCode); storeAfterSales.setDeliverySn(postalCode);
storeAfterSales.setDeliveryName(name); storeAfterSales.setDeliveryName(name);
storeAfterSales.setState(2); storeAfterSales.setState(AfterSalesStatusEnum.STATUS_2.getValue());
//操作记录 //操作记录
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus();
@ -297,7 +297,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
public Object salesCheck(Long salesId, String orderCode, Integer approvalStatus, String consignee, String phoneNumber, String address) { public Object salesCheck(Long salesId, String orderCode, Integer approvalStatus, String consignee, String phoneNumber, String address) {
StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.<StoreAfterSales>lambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode).eq(StoreAfterSales::getId, salesId)); StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.<StoreAfterSales>lambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode).eq(StoreAfterSales::getId, salesId));
if (approvalStatus == 0) { if (approvalStatus == 0) {
storeAfterSales.setState(1); storeAfterSales.setState(AfterSalesStatusEnum.STATUS_1.getValue());
if (storeAfterSales.getServiceType() == 1) { if (storeAfterSales.getServiceType() == 1) {
if (StringUtils.isEmpty(consignee) || StringUtils.isEmpty(phoneNumber) || StringUtils.isEmpty(address)) { if (StringUtils.isEmpty(consignee) || StringUtils.isEmpty(phoneNumber) || StringUtils.isEmpty(address)) {
throw new ErrorRequestException("请输入收货人信息"); throw new ErrorRequestException("请输入收货人信息");
@ -315,7 +315,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
storeAfterSalesStatus.setOperator("admin"); storeAfterSalesStatus.setOperator("admin");
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus); storeAfterSalesStatusMapper.insert(storeAfterSalesStatus);
} else { } else {
storeAfterSales.setState(1); storeAfterSales.setState(AfterSalesStatusEnum.STATUS_1.getValue());
storeAfterSales.setSalesState(2); storeAfterSales.setSalesState(2);
//操作记录 //操作记录
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus();
@ -334,7 +334,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
@Override @Override
public StoreAfterSales makeMoney(Long salesId, String orderCode) { public StoreAfterSales makeMoney(Long salesId, String orderCode) {
StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.<StoreAfterSales>lambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode).eq(StoreAfterSales::getId, salesId)); StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.<StoreAfterSales>lambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode).eq(StoreAfterSales::getId, salesId));
storeAfterSales.setState(3); storeAfterSales.setState(AfterSalesStatusEnum.STATUS_3.getValue());
baseMapper.updateById(storeAfterSales); baseMapper.updateById(storeAfterSales);
//操作记录 //操作记录
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus();