- 零零碎碎的
- 退货申请,物流信息
This commit is contained in:
parent
6e92e7162c
commit
6e91c41cca
@ -6,6 +6,7 @@ import cn.iocoder.mall.admin.api.DataDictService;
|
|||||||
import cn.iocoder.mall.admin.api.bo.DataDictBO;
|
import cn.iocoder.mall.admin.api.bo.DataDictBO;
|
||||||
import cn.iocoder.mall.order.api.OrderLogisticsService;
|
import cn.iocoder.mall.order.api.OrderLogisticsService;
|
||||||
import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoBO;
|
import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoBO;
|
||||||
|
import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoWithOrderBO;
|
||||||
import cn.iocoder.mall.order.api.constant.DictKeyConstants;
|
import cn.iocoder.mall.order.api.constant.DictKeyConstants;
|
||||||
import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum;
|
import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum;
|
||||||
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
|
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
|
||||||
@ -39,14 +40,20 @@ public class OrderLogisticsController {
|
|||||||
@Reference(validation = "true")
|
@Reference(validation = "true")
|
||||||
private DataDictService dataDictService;
|
private DataDictService dataDictService;
|
||||||
|
|
||||||
@GetMapping("logistics_info")
|
@GetMapping("info")
|
||||||
@ApiOperation("物流详细 - 返回订单所关联的所有物流信息")
|
@ApiOperation("物流详细 - 物流通用")
|
||||||
public CommonResult<OrderLogisticsInfoBO> logisticsInfo(@RequestParam("orderId") Integer orderId) {
|
public CommonResult<OrderLogisticsInfoBO> logistics(@RequestParam("logisticsId") Integer logisticsId) {
|
||||||
|
return orderLogisticsService.getLogisticsInfo(logisticsId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("info_order")
|
||||||
|
@ApiOperation("物流详细 - 返回订单所关联的所有物流信息(订单用的)")
|
||||||
|
public CommonResult<OrderLogisticsInfoWithOrderBO> logisticsInfoWithOrder(@RequestParam("orderId") Integer orderId) {
|
||||||
Integer userId = UserSecurityContextHolder.getContext().getUserId();
|
Integer userId = UserSecurityContextHolder.getContext().getUserId();
|
||||||
CommonResult<OrderLogisticsInfoBO> commonResult = orderLogisticsService.logisticsInfo(userId, orderId);
|
CommonResult<OrderLogisticsInfoWithOrderBO> commonResult = orderLogisticsService.getOrderLogisticsInfo(userId, orderId);
|
||||||
if (commonResult.isSuccess()) {
|
if (commonResult.isSuccess()) {
|
||||||
OrderLogisticsInfoBO orderLogisticsInfoBO = commonResult.getData();
|
OrderLogisticsInfoWithOrderBO orderLogisticsInfoBO = commonResult.getData();
|
||||||
List<OrderLogisticsInfoBO.Logistics> logisticsList = orderLogisticsInfoBO.getLogistics();
|
List<OrderLogisticsInfoWithOrderBO.Logistics> logisticsList = orderLogisticsInfoBO.getLogistics();
|
||||||
|
|
||||||
// 获取字典值
|
// 获取字典值
|
||||||
Set<Integer> dictValues = logisticsList.stream().map(o -> o.getLogistics()).collect(Collectors.toSet());
|
Set<Integer> dictValues = logisticsList.stream().map(o -> o.getLogistics()).collect(Collectors.toSet());
|
||||||
@ -72,7 +79,6 @@ public class OrderLogisticsController {
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return commonResult;
|
return commonResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
package cn.iocoder.mall.order.api;
|
package cn.iocoder.mall.order.api;
|
||||||
|
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
import cn.iocoder.common.framework.vo.CommonResult;
|
||||||
import cn.iocoder.mall.order.api.bo.OrderLogisticsBO;
|
import cn.iocoder.mall.order.api.bo.OrderLastLogisticsInfoBO;
|
||||||
import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoBO;
|
import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoBO;
|
||||||
|
import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoWithOrderBO;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单物流信息
|
* 订单物流信息
|
||||||
@ -14,13 +13,31 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface OrderLogisticsService {
|
public interface OrderLogisticsService {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物流信息
|
* 获取物流信息 - 根据id
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CommonResult<OrderLogisticsInfoBO> getLogisticsInfo(Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 last 物流信息 - 根据id
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CommonResult<OrderLastLogisticsInfoBO> getLastLogisticsInfo(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取物流信息 - 根据 orderId
|
||||||
*
|
*
|
||||||
* @param userId
|
* @param userId
|
||||||
* @param orderId
|
* @param orderId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
CommonResult<OrderLogisticsInfoBO> logisticsInfo(Integer userId, Integer orderId);
|
CommonResult<OrderLogisticsInfoWithOrderBO> getOrderLogisticsInfo(Integer userId, Integer orderId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.mall.order.api;
|
package cn.iocoder.mall.order.api;
|
||||||
|
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
import cn.iocoder.common.framework.vo.CommonResult;
|
||||||
|
import cn.iocoder.mall.order.api.bo.OrderReturnInfoBO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderReturnApplyDTO;
|
import cn.iocoder.mall.order.api.dto.OrderReturnApplyDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,5 +39,5 @@ public interface OrderReturnService {
|
|||||||
* @param orderId
|
* @param orderId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
CommonResult orderApplyInfo(Integer orderId);
|
CommonResult<OrderReturnInfoBO> orderApplyInfo(Integer orderId);
|
||||||
}
|
}
|
||||||
|
@ -18,60 +18,42 @@ import java.util.List;
|
|||||||
public class OrderLogisticsInfoBO implements Serializable {
|
public class OrderLogisticsInfoBO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单id
|
* id
|
||||||
*/
|
*/
|
||||||
private Integer orderId;
|
private Integer id;
|
||||||
/**
|
/**
|
||||||
* 订单编号
|
* 收件区域编号
|
||||||
*/
|
*/
|
||||||
private String orderNo;
|
private String areaNo;
|
||||||
/**
|
/**
|
||||||
* 物流信息
|
* 收件人名称
|
||||||
*/
|
*/
|
||||||
private List<Logistics> logistics;
|
private String name;
|
||||||
|
/**
|
||||||
|
* 收件手机号
|
||||||
|
*/
|
||||||
|
private String mobile;
|
||||||
|
/**
|
||||||
|
* 收件详细地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
/**
|
||||||
|
* 物流 (字典)
|
||||||
|
*/
|
||||||
|
private Integer logistics;
|
||||||
|
/**
|
||||||
|
* 物流 (字典) 转换后的值
|
||||||
|
*/
|
||||||
|
private String logisticsText;
|
||||||
|
/**
|
||||||
|
* 物流编号
|
||||||
|
*/
|
||||||
|
private String logisticsNo;
|
||||||
|
|
||||||
@Data
|
///
|
||||||
@Accessors(chain = true)
|
/// 物流信息
|
||||||
public static class Logistics {
|
|
||||||
|
|
||||||
/**
|
private List<LogisticsDetail> details;
|
||||||
* id
|
|
||||||
*/
|
|
||||||
private Integer id;
|
|
||||||
/**
|
|
||||||
* 收件区域编号
|
|
||||||
*/
|
|
||||||
private String areaNo;
|
|
||||||
/**
|
|
||||||
* 收件人名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
/**
|
|
||||||
* 收件手机号
|
|
||||||
*/
|
|
||||||
private String mobile;
|
|
||||||
/**
|
|
||||||
* 收件详细地址
|
|
||||||
*/
|
|
||||||
private String address;
|
|
||||||
/**
|
|
||||||
* 物流 (字典)
|
|
||||||
*/
|
|
||||||
private Integer logistics;
|
|
||||||
/**
|
|
||||||
* 物流 (字典) 转换后的值
|
|
||||||
*/
|
|
||||||
private String logisticsText;
|
|
||||||
/**
|
|
||||||
* 物流编号
|
|
||||||
*/
|
|
||||||
private String logisticsNo;
|
|
||||||
|
|
||||||
///
|
|
||||||
/// 物流信息
|
|
||||||
|
|
||||||
private List<LogisticsDetail> details;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
|
@ -25,6 +25,10 @@ public class OrderReturnInfoBO implements Serializable {
|
|||||||
* 订单 item
|
* 订单 item
|
||||||
*/
|
*/
|
||||||
private List<OrderItem> orderItems;
|
private List<OrderItem> orderItems;
|
||||||
|
/**
|
||||||
|
* 最后一个物流信息/最新物流信息
|
||||||
|
*/
|
||||||
|
private OrderLastLogisticsInfoBO lastLogisticsInfo;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@ -80,6 +84,10 @@ public class OrderReturnInfoBO implements Serializable {
|
|||||||
///
|
///
|
||||||
/// 退货原因
|
/// 退货原因
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退货金额
|
||||||
|
*/
|
||||||
|
private Integer refundPrice;
|
||||||
/**
|
/**
|
||||||
* 退货原因(字典值)
|
* 退货原因(字典值)
|
||||||
*/
|
*/
|
||||||
|
@ -42,6 +42,7 @@ public enum OrderErrorCodeEnum {
|
|||||||
|
|
||||||
// 工具类服务 1008004000
|
// 工具类服务 1008004000
|
||||||
DICT_SERVER_INVOKING_FAIL(1008004000, "字典服务调用失败!"),
|
DICT_SERVER_INVOKING_FAIL(1008004000, "字典服务调用失败!"),
|
||||||
|
ORDER_LOGISTICS_INVOKING_FAIL(1008004001, "订单物流调用失败!"),
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
package cn.iocoder.mall.order.biz.convert;
|
package cn.iocoder.mall.order.biz.convert;
|
||||||
|
|
||||||
import cn.iocoder.mall.order.api.bo.OrderLogisticsBO;
|
import cn.iocoder.mall.order.api.bo.OrderLastLogisticsInfoBO;
|
||||||
import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoBO;
|
import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoBO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderCreateDTO;
|
import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoWithOrderBO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderDeliveryDTO;
|
import cn.iocoder.mall.order.api.dto.OrderDeliveryDTO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderLogisticsUpdateDTO;
|
import cn.iocoder.mall.order.api.dto.OrderLogisticsUpdateDTO;
|
||||||
import cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDO;
|
import cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDO;
|
||||||
|
import cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDetailDO;
|
||||||
import cn.iocoder.mall.order.biz.dataobject.OrderRecipientDO;
|
import cn.iocoder.mall.order.biz.dataobject.OrderRecipientDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mappings;
|
import org.mapstruct.Mappings;
|
||||||
|
import org.mapstruct.Named;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -34,5 +36,21 @@ public interface OrderLogisticsConvert {
|
|||||||
OrderLogisticsDO convert(OrderRecipientDO orderRecipientDO);
|
OrderLogisticsDO convert(OrderRecipientDO orderRecipientDO);
|
||||||
|
|
||||||
@Mappings({})
|
@Mappings({})
|
||||||
List<OrderLogisticsInfoBO.Logistics> convertLogistics(List<OrderLogisticsDO> orderLogisticsDOList);
|
List<OrderLogisticsInfoWithOrderBO.Logistics> convertLogistics(List<OrderLogisticsDO> orderLogisticsDOList);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
List<OrderLogisticsInfoWithOrderBO.LogisticsDetail> convertLogisticsDetail(List<OrderLogisticsDetailDO> orderLogisticsDOList);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
OrderLogisticsInfoBO convert(OrderLogisticsDO orderLogisticsDO);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
List<OrderLogisticsInfoBO.LogisticsDetail> convert(List<OrderLogisticsDetailDO> orderLogisticsDetailDOList);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
@Named(value = "orderLastLogisticsInfoBO")
|
||||||
|
OrderLastLogisticsInfoBO convertOrderLastLogisticsInfoBO(OrderLogisticsDO orderLogisticsDO);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
OrderLastLogisticsInfoBO.LogisticsDetail convertLastLogisticsDetail(OrderLogisticsDetailDO orderLogisticsDetailDO);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cn.iocoder.mall.order.biz.convert;
|
package cn.iocoder.mall.order.biz.convert;
|
||||||
|
|
||||||
import cn.iocoder.mall.order.api.bo.OrderInfoBO;
|
import cn.iocoder.mall.order.api.bo.OrderInfoBO;
|
||||||
import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoBO;
|
import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoWithOrderBO;
|
||||||
import cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDetailDO;
|
import cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDetailDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mappings;
|
import org.mapstruct.Mappings;
|
||||||
@ -20,9 +20,6 @@ public interface OrderLogisticsDetailConvert {
|
|||||||
|
|
||||||
OrderLogisticsDetailConvert INSTANCE = Mappers.getMapper(OrderLogisticsDetailConvert.class);
|
OrderLogisticsDetailConvert INSTANCE = Mappers.getMapper(OrderLogisticsDetailConvert.class);
|
||||||
|
|
||||||
@Mappings({})
|
|
||||||
List<OrderLogisticsInfoBO.LogisticsDetail> convertLogisticsDetail(List<OrderLogisticsDetailDO> orderLogisticsDOList);
|
|
||||||
|
|
||||||
@Mappings({})
|
@Mappings({})
|
||||||
OrderInfoBO.LogisticsDetail convertLogisticsDetail(OrderLogisticsDetailDO orderLogisticsDetailDO);
|
OrderInfoBO.LogisticsDetail convertLogisticsDetail(OrderLogisticsDetailDO orderLogisticsDetailDO);
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,17 @@ public interface OrderLogisticsDetailMapper {
|
|||||||
* @param orderLogisticsIds
|
* @param orderLogisticsIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
OrderLogisticsDetailDO selectLatest(
|
OrderLogisticsDetailDO selectLast(
|
||||||
@Param("orderLogisticsIds") Collection<Integer> orderLogisticsIds
|
@Param("orderLogisticsIds") Collection<Integer> orderLogisticsIds
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询 - 根据 last 根据物理id
|
||||||
|
*
|
||||||
|
* @param orderLogisticsId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
OrderLogisticsDetailDO selectLastByLogisticsId(
|
||||||
|
@Param("orderLogisticsId") Integer orderLogisticsId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,16 @@ public interface OrderLogisticsMapper {
|
|||||||
*/
|
*/
|
||||||
void updateById(OrderLogisticsDO orderLogisticsDO);
|
void updateById(OrderLogisticsDO orderLogisticsDO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询 - 根据 ids
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
OrderLogisticsDO selectById(
|
||||||
|
@Param("id") Integer id
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询 - 根据 ids
|
* 查询 - 根据 ids
|
||||||
*
|
*
|
||||||
|
@ -41,6 +41,10 @@ public class OrderReturnDO extends BaseDO {
|
|||||||
///
|
///
|
||||||
/// 退货原因
|
/// 退货原因
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退货金额
|
||||||
|
*/
|
||||||
|
private Integer refundPrice;
|
||||||
/**
|
/**
|
||||||
* 退货原因(字典值)
|
* 退货原因(字典值)
|
||||||
*
|
*
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package cn.iocoder.mall.order.biz.service;
|
package cn.iocoder.mall.order.biz.service;
|
||||||
|
|
||||||
import cn.iocoder.common.framework.constant.DeletedStatusEnum;
|
import cn.iocoder.common.framework.constant.DeletedStatusEnum;
|
||||||
import cn.iocoder.common.framework.util.CollectionUtil;
|
|
||||||
import cn.iocoder.common.framework.util.DateUtil;
|
import cn.iocoder.common.framework.util.DateUtil;
|
||||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
import cn.iocoder.common.framework.vo.CommonResult;
|
||||||
import cn.iocoder.mall.order.api.OrderLogisticsService;
|
import cn.iocoder.mall.order.api.OrderLogisticsService;
|
||||||
|
import cn.iocoder.mall.order.api.bo.OrderLastLogisticsInfoBO;
|
||||||
import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoBO;
|
import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoBO;
|
||||||
|
import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoWithOrderBO;
|
||||||
import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum;
|
import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum;
|
||||||
import cn.iocoder.mall.order.biz.convert.OrderLogisticsConvert;
|
import cn.iocoder.mall.order.biz.convert.OrderLogisticsConvert;
|
||||||
import cn.iocoder.mall.order.biz.convert.OrderLogisticsDetailConvert;
|
import cn.iocoder.mall.order.biz.convert.OrderLogisticsDetailConvert;
|
||||||
@ -46,7 +47,46 @@ public class OrderLogisticsServiceImpl implements OrderLogisticsService {
|
|||||||
private OrderLogisticsDetailMapper orderLogisticsDetailMapper;
|
private OrderLogisticsDetailMapper orderLogisticsDetailMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommonResult<OrderLogisticsInfoBO> logisticsInfo(Integer userId, Integer orderId) {
|
public CommonResult<OrderLogisticsInfoBO> getLogisticsInfo(Integer id) {
|
||||||
|
OrderLogisticsDO orderLogisticsDO = orderLogisticsMapper.selectById(id);
|
||||||
|
if (orderLogisticsDO == null) {
|
||||||
|
return CommonResult.success(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<OrderLogisticsDetailDO> orderLogisticsDetailDOList = orderLogisticsDetailMapper
|
||||||
|
.selectByOrderLogisticsId(orderLogisticsDO.getId());
|
||||||
|
|
||||||
|
// 转换数据结构
|
||||||
|
List<OrderLogisticsInfoBO.LogisticsDetail> logisticsDetails
|
||||||
|
= OrderLogisticsConvert.INSTANCE.convert(orderLogisticsDetailDOList);
|
||||||
|
|
||||||
|
OrderLogisticsInfoBO orderLogisticsInfo2BO = OrderLogisticsConvert.INSTANCE.convert(orderLogisticsDO);
|
||||||
|
orderLogisticsInfo2BO.setDetails(logisticsDetails);
|
||||||
|
return CommonResult.success(orderLogisticsInfo2BO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<OrderLastLogisticsInfoBO> getLastLogisticsInfo(Integer id) {
|
||||||
|
OrderLogisticsDO orderLogisticsDO = orderLogisticsMapper.selectById(id);
|
||||||
|
if (orderLogisticsDO == null) {
|
||||||
|
return CommonResult.success(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
OrderLogisticsDetailDO orderLastLogisticsDetailDO = orderLogisticsDetailMapper.selectLastByLogisticsId(id);
|
||||||
|
|
||||||
|
// 转换数据结构
|
||||||
|
OrderLastLogisticsInfoBO.LogisticsDetail lastLogisticsDetail
|
||||||
|
= OrderLogisticsConvert.INSTANCE.convertLastLogisticsDetail(orderLastLogisticsDetailDO);
|
||||||
|
|
||||||
|
OrderLastLogisticsInfoBO lastLogisticsInfoBO = OrderLogisticsConvert
|
||||||
|
.INSTANCE.convertOrderLastLogisticsInfoBO(orderLogisticsDO);
|
||||||
|
|
||||||
|
lastLogisticsInfoBO.setLastLogisticsDetail(lastLogisticsDetail);
|
||||||
|
return CommonResult.success(lastLogisticsInfoBO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<OrderLogisticsInfoWithOrderBO> getOrderLogisticsInfo(Integer userId, Integer orderId) {
|
||||||
OrderDO orderDO = orderMapper.selectById(orderId);
|
OrderDO orderDO = orderMapper.selectById(orderId);
|
||||||
|
|
||||||
if (orderDO == null) {
|
if (orderDO == null) {
|
||||||
@ -75,18 +115,18 @@ public class OrderLogisticsServiceImpl implements OrderLogisticsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 转换 return 的数据
|
// 转换 return 的数据
|
||||||
List<OrderLogisticsInfoBO.Logistics> logistics
|
List<OrderLogisticsInfoWithOrderBO.Logistics> logistics
|
||||||
= OrderLogisticsConvert.INSTANCE.convertLogistics(orderLogisticsDOList);
|
= OrderLogisticsConvert.INSTANCE.convertLogistics(orderLogisticsDOList);
|
||||||
|
|
||||||
List<OrderLogisticsInfoBO.LogisticsDetail> logisticsDetails
|
List<OrderLogisticsInfoWithOrderBO.LogisticsDetail> logisticsDetails
|
||||||
= OrderLogisticsDetailConvert.INSTANCE.convertLogisticsDetail(orderLogisticsDetailDOList);
|
= OrderLogisticsConvert.INSTANCE.convertLogisticsDetail(orderLogisticsDetailDOList);
|
||||||
|
|
||||||
logisticsDetails.stream().map(o -> {
|
logisticsDetails.stream().map(o -> {
|
||||||
o.setLogisticsTimeText(DateUtil.format(o.getLogisticsTime(), "yyyy-MM-dd HH:mm"));
|
o.setLogisticsTimeText(DateUtil.format(o.getLogisticsTime(), "yyyy-MM-dd HH:mm"));
|
||||||
return o;
|
return o;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
Map<Integer, List<OrderLogisticsInfoBO.LogisticsDetail>> logisticsDetailMultimap
|
Map<Integer, List<OrderLogisticsInfoWithOrderBO.LogisticsDetail>> logisticsDetailMultimap
|
||||||
= logisticsDetails.stream().collect(
|
= logisticsDetails.stream().collect(
|
||||||
Collectors.toMap(
|
Collectors.toMap(
|
||||||
o -> o.getOrderLogisticsId(),
|
o -> o.getOrderLogisticsId(),
|
||||||
@ -106,7 +146,7 @@ public class OrderLogisticsServiceImpl implements OrderLogisticsService {
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
return CommonResult.success(
|
return CommonResult.success(
|
||||||
new OrderLogisticsInfoBO()
|
new OrderLogisticsInfoWithOrderBO()
|
||||||
.setOrderId(orderId)
|
.setOrderId(orderId)
|
||||||
.setOrderNo(orderDO.getOrderNo())
|
.setOrderNo(orderDO.getOrderNo())
|
||||||
.setLogistics(logistics)
|
.setLogistics(logistics)
|
||||||
|
@ -4,18 +4,22 @@ import cn.iocoder.common.framework.constant.DeletedStatusEnum;
|
|||||||
import cn.iocoder.common.framework.exception.ServiceException;
|
import cn.iocoder.common.framework.exception.ServiceException;
|
||||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
import cn.iocoder.common.framework.vo.CommonResult;
|
||||||
|
import cn.iocoder.mall.order.api.OrderLogisticsService;
|
||||||
import cn.iocoder.mall.order.api.OrderReturnService;
|
import cn.iocoder.mall.order.api.OrderReturnService;
|
||||||
|
import cn.iocoder.mall.order.api.bo.OrderLastLogisticsInfoBO;
|
||||||
import cn.iocoder.mall.order.api.bo.OrderReturnInfoBO;
|
import cn.iocoder.mall.order.api.bo.OrderReturnInfoBO;
|
||||||
import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum;
|
import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum;
|
||||||
import cn.iocoder.mall.order.api.constant.OrderReturnStatusEnum;
|
import cn.iocoder.mall.order.api.constant.OrderReturnStatusEnum;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderReturnApplyDTO;
|
import cn.iocoder.mall.order.api.dto.OrderReturnApplyDTO;
|
||||||
import cn.iocoder.mall.order.biz.convert.OrderReturnConvert;
|
import cn.iocoder.mall.order.biz.convert.OrderReturnConvert;
|
||||||
import cn.iocoder.mall.order.biz.dao.OrderItemMapper;
|
import cn.iocoder.mall.order.biz.dao.OrderItemMapper;
|
||||||
|
import cn.iocoder.mall.order.biz.dao.OrderLogisticsMapper;
|
||||||
import cn.iocoder.mall.order.biz.dao.OrderMapper;
|
import cn.iocoder.mall.order.biz.dao.OrderMapper;
|
||||||
import cn.iocoder.mall.order.biz.dao.OrderReturnMapper;
|
import cn.iocoder.mall.order.biz.dao.OrderReturnMapper;
|
||||||
import cn.iocoder.mall.order.biz.dataobject.OrderDO;
|
import cn.iocoder.mall.order.biz.dataobject.OrderDO;
|
||||||
import cn.iocoder.mall.order.biz.dataobject.OrderItemDO;
|
import cn.iocoder.mall.order.biz.dataobject.OrderItemDO;
|
||||||
import cn.iocoder.mall.order.biz.dataobject.OrderReturnDO;
|
import cn.iocoder.mall.order.biz.dataobject.OrderReturnDO;
|
||||||
|
import com.alibaba.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@ -41,6 +45,9 @@ public class OrderReturnServiceImpl implements OrderReturnService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OrderReturnMapper orderReturnMapper;
|
private OrderReturnMapper orderReturnMapper;
|
||||||
|
|
||||||
|
@Reference(validation = "true")
|
||||||
|
private OrderLogisticsService orderLogisticsService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommonResult orderReturnApply(OrderReturnApplyDTO orderReturnDTO) {
|
public CommonResult orderReturnApply(OrderReturnApplyDTO orderReturnDTO) {
|
||||||
OrderDO checkOrder = orderMapper.selectById(orderReturnDTO.getOrderId());
|
OrderDO checkOrder = orderMapper.selectById(orderReturnDTO.getOrderId());
|
||||||
@ -71,7 +78,7 @@ public class OrderReturnServiceImpl implements OrderReturnService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommonResult orderApplyInfo(Integer orderId) {
|
public CommonResult<OrderReturnInfoBO> orderApplyInfo(Integer orderId) {
|
||||||
|
|
||||||
// 检查订单是否退货
|
// 检查订单是否退货
|
||||||
OrderReturnDO orderReturnDO = orderReturnMapper.selectByOrderId(orderId);
|
OrderReturnDO orderReturnDO = orderReturnMapper.selectByOrderId(orderId);
|
||||||
@ -91,9 +98,19 @@ public class OrderReturnServiceImpl implements OrderReturnService {
|
|||||||
OrderReturnInfoBO.ReturnInfo returnInfo = OrderReturnConvert.INSTANCE.convert(orderReturnDO);
|
OrderReturnInfoBO.ReturnInfo returnInfo = OrderReturnConvert.INSTANCE.convert(orderReturnDO);
|
||||||
List<OrderReturnInfoBO.OrderItem> itemList = OrderReturnConvert.INSTANCE.convert(orderItemDOList);
|
List<OrderReturnInfoBO.OrderItem> itemList = OrderReturnConvert.INSTANCE.convert(orderItemDOList);
|
||||||
|
|
||||||
|
// 物流信息
|
||||||
|
CommonResult<OrderLastLogisticsInfoBO> lastLogisticsCommonResult = orderLogisticsService
|
||||||
|
.getLastLogisticsInfo(orderReturnDO.getOrderLogisticsId());
|
||||||
|
|
||||||
|
if (lastLogisticsCommonResult.isError()) {
|
||||||
|
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_LOGISTICS_INVOKING_FAIL.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
OrderLastLogisticsInfoBO lastLogisticsInfoBO = lastLogisticsCommonResult.getData();
|
||||||
OrderReturnInfoBO orderReturnInfoBO = new OrderReturnInfoBO()
|
OrderReturnInfoBO orderReturnInfoBO = new OrderReturnInfoBO()
|
||||||
.setOrderItems(itemList)
|
.setOrderItems(itemList)
|
||||||
.setReturnInfo(returnInfo);
|
.setReturnInfo(returnInfo)
|
||||||
|
.setLastLogisticsInfo(lastLogisticsInfoBO);
|
||||||
|
|
||||||
return CommonResult.success(orderReturnInfoBO);
|
return CommonResult.success(orderReturnInfoBO);
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
// 订单物流信息
|
// 订单物流信息
|
||||||
OrderLogisticsDetailDO orderLogisticsDetailDO = null;
|
OrderLogisticsDetailDO orderLogisticsDetailDO = null;
|
||||||
if (!CollectionUtils.isEmpty(orderLogisticsIds)) {
|
if (!CollectionUtils.isEmpty(orderLogisticsIds)) {
|
||||||
orderLogisticsDetailDO = orderLogisticsDetailMapper.selectLatest(orderLogisticsIds);
|
orderLogisticsDetailDO = orderLogisticsDetailMapper.selectLast(orderLogisticsIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查是否申请退货
|
// 检查是否申请退货
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
<!--
|
<!--
|
||||||
查询 - 最新的物流信息
|
查询 - 最新的物流信息
|
||||||
-->
|
-->
|
||||||
<select id="selectLatest" resultType="cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDetailDO">
|
<select id="selectLast" resultType="cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDetailDO">
|
||||||
SELECT
|
SELECT
|
||||||
<include refid="FIELDS"/>
|
<include refid="FIELDS"/>
|
||||||
FROM order_logistics_detail
|
FROM order_logistics_detail
|
||||||
@ -61,4 +61,17 @@
|
|||||||
ORDER BY create_time DESC
|
ORDER BY create_time DESC
|
||||||
LIMIT 0, 1
|
LIMIT 0, 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
查询 - 根据 last 根据物理id
|
||||||
|
-->
|
||||||
|
<select id="selectLastByLogisticsId"
|
||||||
|
resultType="cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDetailDO">
|
||||||
|
SELECT
|
||||||
|
<include refid="FIELDS"/>
|
||||||
|
FROM order_logistics_detail
|
||||||
|
WHERE order_logistics_id = #{orderLogisticsId}
|
||||||
|
ORDER BY create_time DESC
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -66,4 +66,15 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
查询 - 根据 ids
|
||||||
|
-->
|
||||||
|
<select id="selectById" resultType="cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDO">
|
||||||
|
SELECT
|
||||||
|
<include refid="FIELDS" />
|
||||||
|
FROM `order_logistics`
|
||||||
|
WHERE `id` = #{id}
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -8,6 +8,7 @@
|
|||||||
order_id,
|
order_id,
|
||||||
order_no,
|
order_no,
|
||||||
order_logistics_id,
|
order_logistics_id,
|
||||||
|
refund_price,
|
||||||
reason,
|
reason,
|
||||||
`describe`,
|
`describe`,
|
||||||
approval_time,
|
approval_time,
|
||||||
@ -26,13 +27,13 @@
|
|||||||
<insert id="insert" parameterType="OrderReturnDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
<insert id="insert" parameterType="OrderReturnDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||||
INSERT INTO `order_return` (
|
INSERT INTO `order_return` (
|
||||||
service_number, order_id, order_no, order_logistics_id,
|
service_number, order_id, order_no, order_logistics_id,
|
||||||
reason, `describe`,
|
refund_price, reason, `describe`,
|
||||||
approval_time, logistics_time, receiver_time, closing_time,
|
approval_time, logistics_time, receiver_time, closing_time,
|
||||||
service_type, status,
|
service_type, status,
|
||||||
create_time, update_time)
|
create_time, update_time)
|
||||||
VALUES (
|
VALUES (
|
||||||
#{serviceNumber}, #{orderId}, #{orderNo}, #{orderLogisticsId},
|
#{serviceNumber}, #{orderId}, #{orderNo}, #{orderLogisticsId},
|
||||||
#{reason}, #{describe},
|
${refundPrice}, #{reason}, #{describe},
|
||||||
#{approvalTime}, #{logisticsTime}, #{receiverTime}, #{closingTime},
|
#{approvalTime}, #{logisticsTime}, #{receiverTime}, #{closingTime},
|
||||||
#{serviceType}, #{status}, #{createTime}, #{updateTime})
|
#{serviceType}, #{status}, #{createTime}, #{updateTime})
|
||||||
</insert>
|
</insert>
|
||||||
@ -45,6 +46,9 @@
|
|||||||
<if test="orderLogisticsId != null">
|
<if test="orderLogisticsId != null">
|
||||||
, order_logistics_id = #{orderLogisticsId}
|
, order_logistics_id = #{orderLogisticsId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="refundPrice != null">
|
||||||
|
, refund_price = #{refundPrice}
|
||||||
|
</if>
|
||||||
<if test="reason != null">
|
<if test="reason != null">
|
||||||
, reason = #{reason}
|
, reason = #{reason}
|
||||||
</if>
|
</if>
|
||||||
|
Loading…
Reference in New Issue
Block a user