New file |
| | |
| | | package com.oying.modules.sh.service.impl; |
| | | |
| | | import com.oying.modules.sh.domain.OrderReturn; |
| | | import com.oying.modules.sh.domain.request.AuditOrderReturn; |
| | | import com.oying.utils.FileUtil; |
| | | import com.oying.utils.enums.ReturnAuditEnum; |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.oying.modules.sh.service.OrderReturnService; |
| | | import com.oying.modules.sh.domain.dto.OrderReturnQueryCriteria; |
| | | import com.oying.modules.sh.mapper.OrderReturnMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.oying.utils.PageUtil; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | import com.oying.utils.PageResult; |
| | | |
| | | /** |
| | | * @author lixin |
| | | * @description 服务实现 |
| | | * @date 2025-06-11 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class OrderReturnServiceImpl extends ServiceImpl<OrderReturnMapper, OrderReturn> implements OrderReturnService { |
| | | |
| | | private final OrderReturnMapper orderReturnMapper; |
| | | |
| | | @Override |
| | | public PageResult<OrderReturn> queryAll(OrderReturnQueryCriteria criteria, Page<Object> page) { |
| | | criteria.setOffset(page.offset()); |
| | | List<OrderReturn> list = orderReturnMapper.findAll(criteria, criteria.getBlurry()); |
| | | Long total = orderReturnMapper.countAll(criteria, criteria.getBlurry()); |
| | | return PageUtil.toPage(list, total); |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderReturn> queryAll(OrderReturnQueryCriteria criteria) { |
| | | return orderReturnMapper.findAll(criteria, criteria.getBlurry()); |
| | | } |
| | | |
| | | @Override |
| | | public OrderReturn getByReturnNum(String returnNum) { |
| | | return orderReturnMapper.getByReturnNum(returnNum); |
| | | } |
| | | |
| | | @Override |
| | | public void updatePayStatus(String returnNum, String status, String time) { |
| | | orderReturnMapper.updatePayStatus(returnNum, status, time); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void create(OrderReturn resources) { |
| | | orderReturnMapper.insert(resources); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(OrderReturn resources) { |
| | | OrderReturn orderReturn = getById(resources.getReturnId()); |
| | | orderReturn.copy(resources); |
| | | orderReturnMapper.updateById(orderReturn); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void audit(AuditOrderReturn resources) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteAll(List<Long> ids) { |
| | | orderReturnMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<OrderReturn> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (OrderReturn orderReturn : all) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("退单号", orderReturn.getReturnNum()); |
| | | map.put("订单号", orderReturn.getOrderNum()); |
| | | map.put("用户", orderReturn.getUserId()); |
| | | map.put("门店ID", orderReturn.getStoreId()); |
| | | map.put("原金额", orderReturn.getOriginalPrice()); |
| | | map.put("折扣价", orderReturn.getPaidPrice()); |
| | | map.put("实付金额", orderReturn.getActuallyPayPrice()); |
| | | map.put("退款价格", orderReturn.getRefundPrice()); |
| | | map.put("退款状态", orderReturn.getRefundStatus()); |
| | | map.put("退款成功时间", orderReturn.getSuccessTime()); |
| | | map.put("退款渠道", orderReturn.getChannel()); |
| | | map.put("退款原因", orderReturn.getReason()); |
| | | map.put("备注", orderReturn.getRemark()); |
| | | map.put("图片", orderReturn.getPhotos()); |
| | | map.put("审核状态", ReturnAuditEnum.getValue(orderReturn.getAuditStatus())); |
| | | map.put("审核人", orderReturn.getAuditUser()); |
| | | map.put("审核时间", orderReturn.getAuditTime()); |
| | | map.put("审核信息", orderReturn.getAuditMessage()); |
| | | map.put("创建人", orderReturn.getCreateBy()); |
| | | map.put("创建时间", orderReturn.getCreateTime()); |
| | | map.put("修改者", orderReturn.getUpdateBy()); |
| | | map.put("修改时间", orderReturn.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |