puzhibing
2024-12-16 6e936cc4af80fa65210d7e00a54e89a9e706305d
Merge remote-tracking branch 'origin/master'
16个文件已修改
8个文件已添加
720 ■■■■■ 已修改文件
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsArea.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/RefundPassMapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java 141 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassList.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassListVo.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/RefundPassInfo.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsBargainPriceController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/dto/GoodsAreaDto.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsShopMapper.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsShopService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsShopServiceImpl.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/RefundPassSettingVo.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopGoodsList.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopGoodsListVo.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsShopMapper.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsArea.java
@@ -11,6 +11,7 @@
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
 * <p>
@@ -94,7 +95,11 @@
    @ApiModelProperty(value = "获取返佣积分上级类型(1=直推上级,2=直帮上级)")
    @TableField("superior_type")
    private Integer superiorType;
    private String superiorType;
    @ApiModelProperty(value = "获取分佣金额上级类型(1=直推上级,2=直帮上级)")
    @TableField("superior_price_type")
    private String superiorPriceType;
    @ApiModelProperty(value = "核销门店可获得服务费")
    @TableField("servuce_shop_charges")
@@ -124,5 +129,8 @@
    @TableField("bound_shop_superiors_points")
    private Integer boundShopSuperiorsPoints;
    @TableField(exist = false)
    private List<GoodsArea> goodsAreaList;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java
@@ -70,11 +70,11 @@
    @ApiModelProperty(value = "获取返佣积分上级类型(1=直推上级,2=直帮上级)")
    @TableField("superior_type")
    private Integer superiorType;
    private String  superiorType;
    @ApiModelProperty(value = "获取分佣金额上级类型(1=直推上级,2=直帮上级)")
    @TableField("superior_price_type")
    private Integer superiorPriceType;
    private String superiorPriceType;
    @ApiModelProperty(value = "核销门店可获得服务费")
    @TableField("servuce_shop_charges")
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java
@@ -3,12 +3,17 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.order.model.Order;
import com.ruoyi.order.model.RefundPass;
import com.ruoyi.order.service.OrderService;
import com.ruoyi.order.service.RefundPassService;
import com.ruoyi.order.vo.ApplyRefundPass;
import com.ruoyi.order.vo.OrderRefundPassList;
import com.ruoyi.order.vo.OrderRefundPassListVo;
import com.ruoyi.order.vo.RefundPassInfo;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@@ -16,6 +21,7 @@
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
/**
 * <p>
@@ -27,7 +33,7 @@
 */
@RestController
@RequestMapping("/refund-pass")
public class RefundPassController {
public class RefundPassController extends BaseController {
    @Resource
@@ -119,5 +125,54 @@
        return R.ok();
    }
    
    @ResponseBody
    @GetMapping("/getOrderRefundPassList")
    @ApiOperation(value = "获取售后列表数据", tags = {"管理后台-售后管理", "门店后台-售后管理"})
    public TableDataInfo<OrderRefundPassList> getOrderRefundPassList(OrderRefundPassListVo refundPassListVo){
        startPage();
        List<OrderRefundPassList> orderRefundPassList = refundPassService.getOrderRefundPassList(refundPassListVo);
        return getDataTable(orderRefundPassList);
    }
    @ResponseBody
    @PostMapping("/authPassStatus/{id}/{status}")
    @ApiOperation(value = "审核售后", tags = {"管理后台-售后管理", "门店后台-售后管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"),
            @ApiImplicitParam(name = "status", value = "审核状态(2=同意,3=拒绝)", required = true, dataType = "int"),
            @ApiImplicitParam(name = "passRemark", value = "审核备注", required = false, dataType = "string"),
    })
    public R authPassStatus(@PathVariable("id") Long id, @PathVariable("status") Integer status, @RequestParam("passRemark") String passRemark){
        return refundPassService.authPassStatus(id, status, passRemark);
    }
    @ResponseBody
    @PutMapping("/refundPassReceive/{id}")
    @ApiOperation(value = "售后确认收货操作", tags = {"管理后台-售后管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"),
    })
    public R refundPassReceive(@PathVariable("id") Long id){
        return refundPassService.refundPassReceive(id);
    }
    @ResponseBody
    @GetMapping("/getRefundPassInfo/{id}")
    @ApiOperation(value = "获取售后数据详情", tags = {"管理后台-售后管理", "门店后台-售后管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"),
    })
    public R<RefundPassInfo> getRefundPassInfo(@PathVariable("id") Long id){
        RefundPassInfo refundPassInfo = refundPassService.getRefundPassInfo(id);
        return R.ok(refundPassInfo);
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/RefundPassMapper.java
@@ -2,6 +2,10 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.order.model.RefundPass;
import com.ruoyi.order.vo.OrderRefundPassList;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * <p>
@@ -12,5 +16,18 @@
 * @since 2024-11-21
 */
public interface RefundPassMapper extends BaseMapper<RefundPass> {
    /**
     * 管理后台获取售后管理列表数据
     * @param code 订单号
     * @param appUserIds 下单用户id
     * @param refundMethod 售后类型
     * @param status 售后状态
     * @return
     */
    List<OrderRefundPassList> getOrderRefundPassList(@Param("code") String code, @Param("appUserIds") List<Long> appUserIds,
                                                     @Param("shopId") Integer shopId, @Param("refundMethod") Integer refundMethod,
                                                     @Param("status") Integer status);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java
@@ -52,6 +52,13 @@
    
    
    /**
     * 返回订单支付金额和回退积分和会员等级
     * @param order
     */
    void refundPayMoney(Order order);
    /**
     * 收货操作
     * @param orderId
     * @return
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java
@@ -4,6 +4,13 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.order.model.RefundPass;
import com.ruoyi.order.vo.ApplyRefundPass;
import com.ruoyi.order.vo.OrderRefundPassList;
import com.ruoyi.order.vo.OrderRefundPassListVo;
import com.ruoyi.order.vo.RefundPassInfo;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
 * <p>
@@ -21,5 +28,37 @@
     * @return
     */
    R applyRefundPass(ApplyRefundPass applyRefundPass);
    /**
     * 管理后台获取售后管理列表数据
     * @return
     */
    List<OrderRefundPassList> getOrderRefundPassList(OrderRefundPassListVo refundPassListVo);
    /**
     * 售后订单审核操作
     * @param id
     * @param status
     * @param passRemark
     * @return
     */
    R authPassStatus(Long id, Integer status, String passRemark);
    /**
     * 售后确认收货操作
     * @param id
     * @return
     */
    R refundPassReceive(Long id);
    /**
     * 获取售后详情
     * @param id
     * @return
     */
    RefundPassInfo getRefundPassInfo(Long id);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -341,6 +341,16 @@
        }
        order.setOrderStatus(5);
        this.updateById(order);
        refundPayMoney(order);
        return R.ok();
    }
    /**
     * 返回订单支付金额和回退积分和会员等级
     * @param order
     */
    public void refundPayMoney(Order order){
        //开始退款
        Integer payMethod = order.getPayMethod();
        BigDecimal paymentAmount = order.getPaymentAmount();
@@ -350,16 +360,16 @@
        }
        if(2 == payMethod){
            //余额退款
            OrderBalancePayment orderBalancePayment = orderBalancePaymentService.getOne(new LambdaQueryWrapper<OrderBalancePayment>().eq(OrderBalancePayment::getOrderId, orderId));
            OrderBalancePayment orderBalancePayment = orderBalancePaymentService.getOne(new LambdaQueryWrapper<OrderBalancePayment>().eq(OrderBalancePayment::getOrderId, order.getId()));
            BigDecimal balance = appUser.getBalance();
            appUser.setTotalRedPacketAmount(appUser.getTotalRedPacketAmount().add(orderBalancePayment.getRedPacketAmount()).setScale(2, RoundingMode.HALF_EVEN));
            appUser.setTotalDistributionAmount(appUser.getTotalDistributionAmount().add(orderBalancePayment.getDistributionAmount()).setScale(2, RoundingMode.HALF_EVEN));
            appUser.setBalance(balance.add(paymentAmount).setScale(2, RoundingMode.HALF_EVEN));
            appUser.setShopAmount(appUser.getShopAmount().subtract(paymentAmount).setScale(2, RoundingMode.HALF_EVEN));
            //构建账户余额流水明细
            BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
            balanceChangeRecord.setOrderId(orderId);
            balanceChangeRecord.setOrderId(order.getId());
            balanceChangeRecord.setAppUserId(order.getAppUserId());
            balanceChangeRecord.setChangeType(6);
            balanceChangeRecord.setBeforeAmount(balance);
@@ -373,7 +383,7 @@
        if(3 == payMethod){
            //积分退款
            appUser.setLavePoint(appUser.getLavePoint() + order.getPoint());
            //开始运费退款,积分支付,运费是单独进行支付的,所以需要单独退款
            if(null != order.getExpressAmount() && BigDecimal.ZERO.compareTo(order.getExpressAmount()) < 0){
                BigDecimal expressAmount = order.getExpressAmount();
@@ -382,14 +392,14 @@
                }
                if(2 == order.getExpressPayMethod()){
                    //余额退款
                    OrderBalancePayment orderBalancePayment = orderBalancePaymentService.getOne(new LambdaQueryWrapper<OrderBalancePayment>().eq(OrderBalancePayment::getOrderId, orderId));
                    OrderBalancePayment orderBalancePayment = orderBalancePaymentService.getOne(new LambdaQueryWrapper<OrderBalancePayment>().eq(OrderBalancePayment::getOrderId, order.getId()));
                    BigDecimal balance = appUser.getBalance();
                    appUser.setTotalRedPacketAmount(appUser.getTotalRedPacketAmount().add(orderBalancePayment.getRedPacketAmount()).setScale(2, RoundingMode.HALF_EVEN));
                    appUser.setTotalDistributionAmount(appUser.getTotalDistributionAmount().add(orderBalancePayment.getDistributionAmount()).setScale(2, RoundingMode.HALF_EVEN));
                    appUser.setBalance(balance.add(expressAmount).setScale(2, RoundingMode.HALF_EVEN));
                    //构建账户余额流水明细
                    BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
                    balanceChangeRecord.setOrderId(orderId);
                    balanceChangeRecord.setOrderId(order.getId());
                    balanceChangeRecord.setAppUserId(order.getAppUserId());
                    balanceChangeRecord.setChangeType(6);
                    balanceChangeRecord.setBeforeAmount(balance);
@@ -425,10 +435,9 @@
        userPoint.setBalance(appUser.getLavePoint());
        userPoint.setCreateTime(LocalDateTime.now());
        userPoint.setAppUserId(order.getAppUserId());
        userPoint.setObjectId(orderId);
        userPoint.setObjectId(order.getId());
        userPointClient.saveUserPoint(userPoint);
        appUserClient.editAppUserById(appUser);
        return R.ok();
    }
    
    
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java
@@ -4,20 +4,33 @@
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.bean.BeanUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.order.mapper.RefundPassMapper;
import com.ruoyi.order.model.Order;
import com.ruoyi.order.model.RefundPass;
import com.ruoyi.order.service.OrderService;
import com.ruoyi.order.service.RefundPassService;
import com.ruoyi.order.vo.ApplyRefundPass;
import com.ruoyi.order.vo.*;
import com.ruoyi.other.api.domain.BaseSetting;
import com.ruoyi.other.api.feignClient.BaseSettingClient;
import com.ruoyi.other.api.feignClient.ShopClient;
import com.ruoyi.other.api.feignClient.TechnicianClient;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
 * <p>
@@ -35,6 +48,13 @@
    
    @Resource
    private BaseSettingClient baseSettingClient;
    @Resource
    private AppUserClient appUserClient;
    @Resource
    private TokenService tokenService;
    @Resource
    private SysUserClient sysUserClient;
    
    
    
@@ -80,4 +100,123 @@
        orderService.updateById(order);
        return R.ok();
    }
    /**
     * 管理后台获取售后管理列表数据
     * @return
     */
    @Override
    public List<OrderRefundPassList> getOrderRefundPassList(OrderRefundPassListVo refundPassListVo) {
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        Integer shopId = null;
        if(2 == sysUser.getRoleType()){
            shopId = sysUser.getObjectId();
        }
        List<Long> appUserIds = new ArrayList<>();
        //搜索条件,用户姓名
        if(StringUtils.isNotEmpty(refundPassListVo.getName())){
            List<AppUser> data = appUserClient.getAppUserByName(refundPassListVo.getName()).getData();
            List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList());
            appUserIds.addAll(collect);
        }
        //搜索条件,用户电话
        if(StringUtils.isNotEmpty(refundPassListVo.getPhone())){
            List<AppUser> data = appUserClient.getAppUserByPhone(refundPassListVo.getPhone()).getData();
            List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList());
            appUserIds.addAll(collect);
        }
        List<OrderRefundPassList> orderRefundPassList = this.baseMapper.getOrderRefundPassList(refundPassListVo.getCode(), appUserIds, shopId, refundPassListVo.getRefundMethod(), refundPassListVo.getStatus());
        for (OrderRefundPassList refundPassList : orderRefundPassList) {
            AppUser appUser = appUserClient.getAppUserById(refundPassList.getAppUserId());
            refundPassList.setUserName(appUser.getName());
            refundPassList.setPhone(appUser.getPhone());
        }
        return orderRefundPassList;
    }
    /**
     * 售后订单审核操作
     * @param id
     * @param status
     * @param passRemark
     * @return
     */
    @Override
    public R authPassStatus(Long id, Integer status, String passRemark) {
        RefundPass refundPass = this.getById(id);
        if(refundPass.getPassStatus() != 1){
            return R.fail("不能重复操作");
        }
        refundPass.setPassStatus(status);
        //退货退款
        if(refundPass.getRefundMethod() == 1 && 2 == status){
            refundPass.setStatus(4);
        }
        if(refundPass.getRefundMethod() == 2 && 2 == status){
            refundPass.setStatus(2);
        }
        refundPass.setPassRemark(passRemark);
        this.updateById(refundPass);
        //仅退款的售后需要将支付金额原路返回,然后再扣减支付获得的积分
        if(refundPass.getRefundMethod() == 2 && 2 == status){
            Order order = orderService.getById(refundPass.getOrderId());
            order.setOrderStatus(6);
            orderService.updateById(order);
            //返回订单支付金额和回退积分和会员等级
            orderService.refundPayMoney(order);
        }
        return R.ok();
    }
    /**
     * 售后确认收货操作
     * @param id
     * @return
     */
    @Override
    public R refundPassReceive(Long id) {
        RefundPass refundPass = this.getById(id);
        if(refundPass.getPassStatus() != 2){
            return R.fail("操作失败");
        }
        if(refundPass.getStatus() != 5){
            return R.fail("操作失败");
        }
        refundPass.setStatus(2);
        this.updateById(refundPass);
        //仅退款的售后需要将支付金额原路返回,然后再扣减支付获得的积分
        Order order = orderService.getById(refundPass.getOrderId());
        order.setOrderStatus(6);
        orderService.updateById(order);
        //返回订单支付金额和回退积分和会员等级
        orderService.refundPayMoney(order);
        return R.ok();
    }
    /**
     * 获取售后详情
     * @param id
     * @return
     */
    @Override
    public RefundPassInfo getRefundPassInfo(Long id) {
        RefundPass refundPass = this.getById(id);
        OrderInfoVo orderInfo = orderService.getOrderInfo(refundPass.getOrderId());
        RefundPassInfo refundPassInfo = new RefundPassInfo();
        BeanUtils.copyBeanProp(refundPassInfo, orderInfo);
        refundPassInfo.setId(id.toString());
        refundPassInfo.setPassStatus(refundPassInfo.getPassStatus());
        refundPassInfo.setPassRemark(refundPassInfo.getPassRemark());
        refundPassInfo.setPassCreateTime(refundPass.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        refundPassInfo.setRefundMethod(refundPass.getRefundMethod());
        refundPassInfo.setRefundReason(refundPass.getRefundReason());
        refundPassInfo.setUserRemark(refundPass.getUserRemark());
        refundPassInfo.setPics(refundPass.getPics());
        return refundPassInfo;
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassList.java
New file
@@ -0,0 +1,34 @@
package com.ruoyi.order.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @author zhibing.pu
 * @Date 2024/12/16 16:09
 */
@Data
@ApiModel
public class OrderRefundPassList {
    @ApiModelProperty("售后数据id")
    private String id;
    @ApiModelProperty("订单编号")
    private String orderNumber;
    @ApiModelProperty("下单用户")
    private String userName;
    @ApiModelProperty("联系电话")
    private String phone;
    @ApiModelProperty("申请时间")
    private String createTime;
    @ApiModelProperty("售后类型(1退货退款2仅退款)")
    private Integer refundMethod;
    @ApiModelProperty("申请原因")
    private String refundReason;
    @ApiModelProperty("状态(1待审核2同意3拒绝)")
    private Integer passStatus;
    /**
     * 用户id
     */
    private Long appUserId;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassListVo.java
New file
@@ -0,0 +1,25 @@
package com.ruoyi.order.vo;
import com.ruoyi.common.core.web.page.BasePage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @author zhibing.pu
 * @Date 2024/12/16 16:09
 */
@Data
@ApiModel
public class OrderRefundPassListVo extends BasePage {
    @ApiModelProperty("订单编号")
    private String code;
    @ApiModelProperty("下单用户姓名")
    private String name;
    @ApiModelProperty("联系电话")
    private String phone;
    @ApiModelProperty("售后类型(1退货退款2仅退款)")
    private Integer refundMethod;
    @ApiModelProperty("售后状态(1待审核2已完成3已拒绝4待退货5待平台收货)")
    private Integer status;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/RefundPassInfo.java
New file
@@ -0,0 +1,65 @@
package com.ruoyi.order.vo;
import com.ruoyi.order.util.vo.QueryKD100Vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
 * @author zhibing.pu
 * @Date 2024/12/16 17:11
 */
@Data
@ApiModel
public class RefundPassInfo {
    @ApiModelProperty("数据id")
    private String id;
    @ApiModelProperty("订单编号")
    private String orderNumber;
    @ApiModelProperty("下单时间")
    private String createTime;
    @ApiModelProperty("订单状态(1待发货2待收货3待使用4已完成5已取消6已退款7售后中8已评价)")
    private Integer orderStatus;
    @ApiModelProperty("下单用户")
    private String userName;
    @ApiModelProperty("联系电话")
    private String phone;
    @ApiModelProperty("订单类型")
    private String orderType;
    @ApiModelProperty("核销门店")
    private String shopName;
    @ApiModelProperty("支付方式(1=微信,2=余额,3=积分)")
    private Integer paymentMethod;
    @ApiModelProperty("订单总金额")
    private BigDecimal totalAmount;
    @ApiModelProperty("优惠券")
    private String couponName;
    @ApiModelProperty("抵扣金额")
    private BigDecimal discountAmount;
    @ApiModelProperty("快递费")
    private BigDecimal expressAmount;
    @ApiModelProperty("支付金额")
    private BigDecimal paymentAmount;
    @ApiModelProperty("获得积分")
    private Integer point;
    @ApiModelProperty("商品数量")
    private Integer goodsNum;
    @ApiModelProperty("商品信息")
    private String goodsJson;
    @ApiModelProperty("审核状态(1待审核2同意3拒绝)")
    private Integer passStatus;
    @ApiModelProperty("审核注释")
    private Integer passRemark;
    @ApiModelProperty("售后申请时间")
    private String passCreateTime;
    @ApiModelProperty("售后类型(1退货退款2仅退款)")
    private Integer refundMethod;
    @ApiModelProperty("申请原因")
    private String refundReason;
    @ApiModelProperty("备注")
    private String userRemark;
    @ApiModelProperty("申请图片")
    private String pics;
}
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml
@@ -1,7 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.account.mapper.RefundPassMapper">
<mapper namespace="com.ruoyi.order.mapper.RefundPassMapper">
    <select id="getOrderRefundPassList" resultType="com.ruoyi.order.vo.OrderRefundPassList">
        select
            a.id,
            b.order_number as orderNumber,
            b.app_user_id as appUserId,
            DATE_FORMAT(a.create_time, '%Y-%m-%d %H:%m:%s') as createTime,
            a.refund_method as refundMethod,
            a.refund_reason as refundReason,
            a.pass_status as passStatus
        from t_refund_pass a
        left join t_order b on (a.order_id = b.id)
        where a.del_flag = 0
        <if test="null != code and '' != code">
            and b.order_number like CONCAT('%', #{code}, '%')
        </if>
        <if test="null != appUserIds and appUserIds.size() > 0">
            and b.app_user_id in
            <foreach collection="appUserIds" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != refundMethod">
            and a.refund_method = #{refundMethod}
        </if>
        <if test="null != status">
            and a.status = #{status}
        </if>
        <if test="null != shopId">
            and b.shop_id = #{shopId} and b.order_type = 1
        </if>
        order by a.create_time desc
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java
@@ -1,10 +1,13 @@
package com.ruoyi.other.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.BaseSetting;
import com.ruoyi.other.service.BaseSettingService;
import com.ruoyi.other.vo.RefundPassSettingVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
@@ -56,7 +59,33 @@
    }
    
    
    @PostMapping("/setRefundPassSetting")
    @ApiOperation(value = "保存售后设置", tags = {"管理后台-售后管理"})
    public R setRefundPassSetting(@RequestBody RefundPassSettingVo settingVo){
        BaseSetting one = baseSettingService.getOne(new LambdaQueryWrapper<BaseSetting>().eq(BaseSetting::getId, 5));
        if(null == one){
            one = new BaseSetting();
            one.setId(5);
            one.setContent(JSON.toJSONString(settingVo));
            baseSettingService.save(one);
        }else{
            one.setContent(JSON.toJSONString(settingVo));
            baseSettingService.updateById(one);
        }
        return R.ok();
    }
    
    
    @PostMapping("/getRefundPassSetting")
    @ApiOperation(value = "获取售后设置", tags = {"管理后台-售后管理"})
    public R<RefundPassSettingVo> getRefundPassSetting(){
        BaseSetting one = baseSettingService.getOne(new LambdaQueryWrapper<BaseSetting>().eq(BaseSetting::getId, 5));
        if(null != one){
            RefundPassSettingVo refundPassSettingVo = JSON.parseObject(one.getContent(), RefundPassSettingVo.class);
            return R.ok(refundPassSettingVo);
        }
        return R.ok();
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsBargainPriceController.java
@@ -7,10 +7,14 @@
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.other.api.domain.*;
import com.ruoyi.other.api.vo.GetGoodsBargainPrice;
import com.ruoyi.other.service.*;
import com.ruoyi.other.vo.ShopGoodsList;
import com.ruoyi.other.vo.ShopGoodsListVo;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -195,5 +199,9 @@
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java
@@ -3,9 +3,14 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.other.api.domain.GoodsShop;
import com.ruoyi.other.api.vo.GetGoodsShopByGoodsIds;
import com.ruoyi.other.service.GoodsShopService;
import com.ruoyi.other.vo.ShopGoodsList;
import com.ruoyi.other.vo.ShopGoodsListVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -21,7 +26,7 @@
 */
@RestController
@RequestMapping("/goods-shop")
public class GoodsShopController {
public class GoodsShopController extends BaseController {
    @Resource
    private GoodsShopService goodsShopService;
@@ -54,5 +59,20 @@
                .in(goodsIds.getGoodsIds() !=null ,GoodsShop::getGoodsId, goodsIds.getGoodsIds()));
        return R.ok(list);
    }
    @ResponseBody
    @GetMapping("/getShopGoodsList")
    @ApiOperation(value = "获取商品管理列表", tags = {"门店后台-商品管理"})
    public TableDataInfo<ShopGoodsList> getShopGoodsList(ShopGoodsListVo shopGoodsListVo){
        startPage();
        List<ShopGoodsList> shopGoodsList = goodsShopService.getShopGoodsList(shopGoodsListVo);
        return getDataTable(shopGoodsList);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/dto/GoodsAreaDto.java
New file
@@ -0,0 +1,4 @@
package com.ruoyi.other.dto;
public class GoodsAreaDto {
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsShopMapper.java
@@ -2,6 +2,11 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.other.api.domain.GoodsShop;
import com.ruoyi.other.vo.ShopGoodsList;
import com.ruoyi.other.vo.ShopGoodsListVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * <p>
@@ -12,5 +17,17 @@
 * @since 2024-11-20
 */
public interface GoodsShopMapper extends BaseMapper<GoodsShop> {
    /**
     * 获取门店授权的服务商品
     * @param shopId
     * @param goodsId
     * @param goodsName
     * @param goodsCategoryId
     * @return
     */
    List<ShopGoodsList> getShopGoodsList(@Param("shopId") Integer shopId, @Param("goodsId") String goodsId,
                                         @Param("goodsName") String goodsName, @Param("goodsCategoryId") Integer goodsCategoryId);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsShopService.java
@@ -2,6 +2,10 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.other.api.domain.GoodsShop;
import com.ruoyi.other.vo.ShopGoodsList;
import com.ruoyi.other.vo.ShopGoodsListVo;
import java.util.List;
/**
 * <p>
@@ -12,5 +16,11 @@
 * @since 2024-11-20
 */
public interface GoodsShopService extends IService<GoodsShop> {
    /**
     * 获取门店授权的服务商品
     * @param shopGoodsListVo
     * @return
     */
    List<ShopGoodsList> getShopGoodsList(ShopGoodsListVo shopGoodsListVo);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -27,10 +27,7 @@
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -186,8 +183,20 @@
        // 特殊地区售价设置
        List<GoodsArea> goodsAreaList = goods.getGoodsAreaList();
        if (!CollectionUtils.isEmpty(goodsAreaList)){
            goodsAreaService.saveBatch(goodsAreaList);
            for (GoodsArea goodsArea : goodsAreaList) {
                List<GoodsArea> goodsAreaList1 = goodsArea.getGoodsAreaList();
                for (GoodsArea area : goodsAreaList1) {
                    area.setProvince(goodsArea.getProvince());
                    area.setCity(goodsArea.getCity());
                    area.setDistricts(goodsArea.getDistricts());
                    area.setProvinceCode(goodsArea.getProvinceCode());
                    area.setCityCode(goodsArea.getCityCode());
                    area.setDistrictsCode(goodsArea.getDistrictsCode());
                }
                goodsAreaService.saveBatch(goodsAreaList1);
            }
        }
    }
    @Override
@@ -207,7 +216,20 @@
        // 特殊地区售价设置
        List<GoodsArea> goodsAreaList = goods.getGoodsAreaList();
        goodsAreaService.updateBatchById(goodsAreaList);
        if (!CollectionUtils.isEmpty(goodsAreaList)){
            for (GoodsArea goodsArea : goodsAreaList) {
                List<GoodsArea> goodsAreaList1 = goodsArea.getGoodsAreaList();
                for (GoodsArea area : goodsAreaList1) {
                    area.setProvince(goodsArea.getProvince());
                    area.setCity(goodsArea.getCity());
                    area.setDistricts(goodsArea.getDistricts());
                    area.setProvinceCode(goodsArea.getProvinceCode());
                    area.setCityCode(goodsArea.getCityCode());
                    area.setDistrictsCode(goodsArea.getDistrictsCode());
                }
                goodsAreaService.updateBatchById(goodsAreaList1);
            }
        }
    }
    @Override
@@ -231,7 +253,19 @@
        // 特殊地区售价设置
        List<GoodsArea> goodsAreaList = goodsAreaService.list(new LambdaQueryWrapper<GoodsArea>()
                .eq(GoodsArea::getGoodsId, goodsId));
        goods.setGoodsAreaList(goodsAreaList);
        Map<String, List<GoodsArea>> listMap = goodsAreaList.stream()
                .collect(Collectors.groupingBy(goodsArea ->
                        goodsArea.getProvinceCode() + goodsArea.getCityCode() + goodsArea.getDistrictsCode()));
        List<GoodsArea> goodsAreaList1 = new ArrayList<>();
        listMap.forEach((s, goodsAreas) -> {
            GoodsArea goodsArea = goodsAreas.get(0);
            goodsArea.setGoodsAreaList(goodsAreas);
            goodsAreaList1.add(goodsArea);
        });
        goods.setGoodsAreaList(goodsAreaList1);
        return goods;
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsShopServiceImpl.java
@@ -1,10 +1,18 @@
package com.ruoyi.other.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.other.mapper.GoodsShopMapper;
import com.ruoyi.other.api.domain.GoodsShop;
import com.ruoyi.other.service.GoodsShopService;
import com.ruoyi.other.vo.ShopGoodsList;
import com.ruoyi.other.vo.ShopGoodsListVo;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
 * <p>
@@ -16,5 +24,25 @@
 */
@Service
public class GoodsShopServiceImpl extends ServiceImpl<GoodsShopMapper, GoodsShop> implements GoodsShopService {
    @Resource
    private TokenService tokenService;
    @Resource
    private SysUserClient sysUserClient;
    /**
     * 获取门店授权的服务商品
     * @param shopGoodsListVo
     * @return
     */
    @Override
    public List<ShopGoodsList> getShopGoodsList(ShopGoodsListVo shopGoodsListVo) {
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        List<ShopGoodsList> shopGoodsList = this.baseMapper.getShopGoodsList(sysUser.getObjectId(), shopGoodsListVo.getId(), shopGoodsListVo.getName(), shopGoodsListVo.getGoodsCategoryId());
        return shopGoodsList;
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/RefundPassSettingVo.java
New file
@@ -0,0 +1,22 @@
package com.ruoyi.other.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @author zhibing.pu
 * @Date 2024/12/16 15:55
 */
@Data
@ApiModel
public class RefundPassSettingVo {
    @ApiModelProperty("收货人姓名")
    private String name;
    @ApiModelProperty("收货人电话")
    private String phone;
    @ApiModelProperty("收货地址")
    private String address;
    @ApiModelProperty("售后周期")
    private Integer days;
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopGoodsList.java
New file
@@ -0,0 +1,20 @@
package com.ruoyi.other.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @author zhibing.pu
 * @Date 2024/12/16 17:32
 */
@Data
@ApiModel
public class ShopGoodsList {
    @ApiModelProperty("商品id")
    private String id;
    @ApiModelProperty("商品名称")
    private String name;
    @ApiModelProperty("商品分类")
    private String goodsCategory;
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopGoodsListVo.java
New file
@@ -0,0 +1,21 @@
package com.ruoyi.other.vo;
import com.ruoyi.common.core.web.page.BasePage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @author zhibing.pu
 * @Date 2024/12/16 17:32
 */
@Data
@ApiModel
public class ShopGoodsListVo extends BasePage {
    @ApiModelProperty("商品id")
    private String id;
    @ApiModelProperty("商品名称")
    private String name;
    @ApiModelProperty("商品分类id")
    private Integer goodsCategoryId;
}
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsShopMapper.xml
New file
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.other.mapper.GoodsShopMapper">
    <select id="getShopGoodsList" resultType="com.ruoyi.other.vo.ShopGoodsList">
        select
            a.id,
            a.name,
            b.name as goodsCategory
        from t_goods a
        left join t_goods_category b on (a.goods_category_id = b.id)
        where a.type = 1 and a.del_flag = 0 and a.status = 2 and (a.appoint_store = 2 or a.id in (select goods_id from t_goods_shop where shop_id = #{shopId}))
        <if test="null != goodsId and '' != goodsId">
            and a.id like CONCAT('%', #{goodsId}, '%')
        </if>
        <if test="null != goodsName and '' != goodsName">
            and a.name like CONCAT('%', #{goodsName}, '%')
        </if>
        <if test="null != goodsCategoryId">
            and a.goods_category_id = #{goodsCategoryId}
        </if>
        order by a.create_time desc
    </select>
</mapper>