|
|
@@ -3,6 +3,7 @@ package com.ruoyi.info.order.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
@@ -26,6 +27,7 @@ import com.ruoyi.info.order.exception.OrderRefundExceptionEnum;
|
|
|
import com.ruoyi.info.order.mapper.OrderRefundMapper;
|
|
|
import com.ruoyi.info.order.service.IOrderRefundService;
|
|
|
import com.ruoyi.info.order.service.IOrderService;
|
|
|
+import com.ruoyi.info.service.domain.vo.ServiceProductVo;
|
|
|
import com.ruoyi.system.enums.SequencePrefixEnum;
|
|
|
import com.ruoyi.system.service.ISysSequenceService;
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
@@ -60,12 +62,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService {
|
|
|
@Override
|
|
|
public TableDataInfo<OrderRefundVo> queryPageList(OrderRefundBo bo, PageQuery pageQuery) {
|
|
|
Page<OrderRefundVo> result = baseMapper.selectListPage(pageQuery.build(), bo);
|
|
|
- result.setRecords(result.getRecords().stream().map(orv -> {
|
|
|
- if (ObjectUtil.isNotNull(orv.getOrderVo())) {
|
|
|
- orv.setOrderVo(orderService.convertAllVo(orv.getOrderVo(), true, null));
|
|
|
- }
|
|
|
- return orv;
|
|
|
- }).collect(Collectors.toList()));
|
|
|
+ result.setRecords(convertList(result.getRecords()));
|
|
|
return TableDataInfo.build(result);
|
|
|
}
|
|
|
|
|
|
@@ -77,7 +74,21 @@ public class OrderRefundServiceImpl implements IOrderRefundService {
|
|
|
*/
|
|
|
@Override
|
|
|
public List<OrderRefundVo> queryList(OrderRefundBo bo) {
|
|
|
- return baseMapper.selectOrderRefundList(bo);
|
|
|
+ return convertList(baseMapper.selectOrderRefundList(bo));
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<OrderRefundVo> convertList(List<OrderRefundVo> voList) {
|
|
|
+ return voList.stream().map(orv -> {
|
|
|
+ if (ObjectUtil.isNotNull(orv.getOrderVo())) {
|
|
|
+ orv.setOrderVo(orderService.convertAllVo(orv.getOrderVo(), true, null));
|
|
|
+ }
|
|
|
+ //服务
|
|
|
+ ServiceProductVo serviceProductVo = JSONObject.parseObject(orv.getServiceInfo(), ServiceProductVo.class);
|
|
|
+ if (ObjectUtil.isNotNull(serviceProductVo)) {
|
|
|
+ orv.setServiceName(serviceProductVo.getName());
|
|
|
+ }
|
|
|
+ return orv;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
private LambdaQueryWrapper<OrderRefund> buildQueryWrapper(OrderRefundBo bo) {
|
|
|
@@ -162,6 +173,13 @@ public class OrderRefundServiceImpl implements IOrderRefundService {
|
|
|
}
|
|
|
OrderRefund add = BeanUtil.toBean(bo, OrderRefund.class);
|
|
|
validEntityBeforeSave(add);
|
|
|
+ //订单信息
|
|
|
+ add.setServiceId(order.getServiceId());
|
|
|
+ add.setServiceInfo(order.getServiceInfo());
|
|
|
+ add.setOrderNum(order.getOrderNum());
|
|
|
+ add.setSellingPrice(order.getSellingPrice());
|
|
|
+ add.setTotalPrice(order.getTotalPrice());
|
|
|
+ add.setPayPrice(order.getPayPrice());
|
|
|
add.setRefundStatus(RefundStatus.wait);
|
|
|
add.setOrderRefundNo(sysSequenceService.generateSequence(SequencePrefixEnum.PRE_ORDER_REFUND, DateUtil.format(new Date(), "yyMMdd"), 6));
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|