- 添加 退货订单列表

This commit is contained in:
sin 2019-05-06 23:25:00 +08:00
parent a454ef415f
commit 2890af6311
11 changed files with 370 additions and 2 deletions

View File

@ -0,0 +1,38 @@
package cn.iocoder.mall.order.application.controller.admins;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.order.api.OrderReturnService;
import cn.iocoder.mall.order.api.bo.OrderReturnListBO;
import cn.iocoder.mall.order.api.dto.OrderReturnQueryDTO;
import cn.iocoder.mall.order.application.convert.OrderReturnConvert;
import cn.iocoder.mall.order.application.po.admin.OrderReturnQueryPO;
import io.swagger.annotations.Api;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 订单退货
*
* @author Sin
* @time 2019-05-06 21:31
*/
@RestController
@RequestMapping("admins/order_return")
@Api("订单退货(admins api)")
public class AdminOrderReturnController {
@Autowired
@Reference(validation = "true")
private OrderReturnService orderReturnService;
@GetMapping("list")
public CommonResult<OrderReturnListBO> list(@Validated OrderReturnQueryPO queryPO) {
OrderReturnQueryDTO queryDTO = OrderReturnConvert.INSTANCE.convert(queryPO);
return orderReturnService.orderReturnList(queryDTO);
}
}

View File

@ -14,6 +14,7 @@ import cn.iocoder.mall.order.application.po.admin.OrderLogisticsPO;
import cn.iocoder.mall.order.application.po.admin.OrderPageQueryPO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -28,10 +29,10 @@ import java.util.List;
*/
@RestController
@RequestMapping("admins/order")
@Api(description = "订单API(admins)")
@Api(value = "订单API(admins)")
public class AdminsOrderController {
@Autowired
@Reference(validation = "true")
private OrderService orderService;
@GetMapping("page")

View File

@ -1,6 +1,8 @@
package cn.iocoder.mall.order.application.convert;
import cn.iocoder.mall.order.api.dto.OrderReturnApplyDTO;
import cn.iocoder.mall.order.api.dto.OrderReturnQueryDTO;
import cn.iocoder.mall.order.application.po.admin.OrderReturnQueryPO;
import cn.iocoder.mall.order.application.po.user.OrderReturnApplyPO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
@ -19,4 +21,7 @@ public interface OrderReturnConvert {
@Mappings({})
OrderReturnApplyDTO convert(OrderReturnApplyPO orderReturnApplyPO);
@Mappings({})
OrderReturnQueryDTO convert(OrderReturnQueryPO orderReturnQueryPO);
}

View File

@ -0,0 +1,51 @@
package cn.iocoder.mall.order.application.po.admin;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* 订单退货 查询 po
*
* @author Sin
* @time 2019-05-06 21:36
*/
@Data
@Accessors(chain = true)
public class OrderReturnQueryPO implements Serializable {
/**
*
* 订单id
*/
private Integer orderId;
/**
* 订单编号
*/
private Integer orderNo;
/**
* 创建时间 - 开始
*/
private Date startCreateTime;
/**
* 创建时间 - 结束
*/
private Date endCreateTime;
///
/// 分页信息
/**
* 分页 index
*/
@NotNull
private Integer index;
/**
* 分页大小
*/
@NotNull
private Integer pageSize;
}

View File

@ -2,7 +2,9 @@ package cn.iocoder.mall.order.api;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.order.api.bo.OrderReturnInfoBO;
import cn.iocoder.mall.order.api.bo.OrderReturnListBO;
import cn.iocoder.mall.order.api.dto.OrderReturnApplyDTO;
import cn.iocoder.mall.order.api.dto.OrderReturnQueryDTO;
/**
* 订单退货
@ -40,4 +42,12 @@ public interface OrderReturnService {
* @return
*/
CommonResult<OrderReturnInfoBO> orderApplyInfo(Integer orderId);
/**
* 订单退货 - 列表
*
* @param queryDTO
* @return
*/
CommonResult<OrderReturnListBO> orderReturnList(OrderReturnQueryDTO queryDTO);
}

View File

@ -0,0 +1,124 @@
package cn.iocoder.mall.order.api.bo;
import cn.iocoder.common.framework.dataobject.BaseDO;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 订单退货 list
*
* @author Sin
* @time 2019-05-06 21:54
*/
@Data
@Accessors(chain = true)
public class OrderReturnListBO implements Serializable {
/**
* 分页当前 index
*/
private Integer index;
/**
* pageSize
*/
private Integer pageSize;
/**
* totalCount
*/
private Integer totalCount;
/**
* data
*/
private List<OrderReturn> data;
@Data
@Accessors(chain = true)
public static class OrderReturn {
/**
* 编号自动增长
*/
private Integer id;
/**
* 服务号
*/
private String serviceNumber;
/**
* 订单编号
*/
private Integer orderId;
/**
* 订单号 保存一个冗余
*/
private String orderNo;
/**
* 物流id
*/
private Integer orderLogisticsId;
///
/// 退货原因
/**
* 退货金额
*/
private Integer refundPrice;
/**
* 退货原因(字典值)
*/
private Integer reason;
/**
* 问题描述
*/
private String describe;
///
/// 时间信息
/**
* 同意时间
*/
private Date approvalTime;
/**
* 物流时间填写物流单号时间
*/
private Date logisticsTime;
/**
* 收货时间
*/
private Date receiverTime;
/**
* 成交时间确认时间
*/
private Date closingTime;
/**
* 服务类型
*
* - 1退货退款
* - 2退款
*/
private Integer serviceType;
/**
* 状态
*
* - 1退货申请
* - 2申请成功
* - 3申请失败
* - 4退货中
* - 5退货成功
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}
}

View File

@ -0,0 +1,48 @@
package cn.iocoder.mall.order.api.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* 订单退货 查询 po
*
* @author Sin
* @time 2019-05-06 21:36
*/
@Data
@Accessors(chain = true)
public class OrderReturnQueryDTO implements Serializable {
/**
*
* 订单id
*/
private Integer orderId;
/**
* 订单编号
*/
private Integer orderNo;
/**
* 创建时间 - 开始
*/
private Date startCreateTime;
/**
* 创建时间 - 结束
*/
private Date endCreateTime;
///
/// 分页信息
/**
* 分页 index
*/
private Integer index;
/**
* 分页大小
*/
private Integer pageSize;
}

View File

@ -1,6 +1,7 @@
package cn.iocoder.mall.order.biz.convert;
import cn.iocoder.mall.order.api.bo.OrderReturnInfoBO;
import cn.iocoder.mall.order.api.bo.OrderReturnListBO;
import cn.iocoder.mall.order.api.dto.OrderReturnApplyDTO;
import cn.iocoder.mall.order.api.dto.OrderReturnCreateDTO;
import cn.iocoder.mall.order.biz.dataobject.OrderItemDO;
@ -33,4 +34,7 @@ public interface OrderReturnConvert {
@Mappings({})
List<OrderReturnInfoBO.OrderItem> convert(List<OrderItemDO> orderItemDOList);
@Mappings({})
List<OrderReturnListBO.OrderReturn> convertListBO(List<OrderReturnDO> orderReturnDOList);
}

View File

@ -1,9 +1,12 @@
package cn.iocoder.mall.order.biz.dao;
import cn.iocoder.mall.order.api.dto.OrderReturnQueryDTO;
import cn.iocoder.mall.order.biz.dataobject.OrderReturnDO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 订单退货 mapper
*
@ -38,4 +41,20 @@ public interface OrderReturnMapper {
OrderReturnDO selectByOrderId(
@Param("orderId") Integer orderId
);
/**
* 列表查询 - queryDTO
*
* @param queryDTO
* @return
*/
int selectListCount(OrderReturnQueryDTO queryDTO);
/**
* 列表查询 - queryDTO
*
* @param queryDTO
* @return
*/
List<OrderReturnDO> selectList(OrderReturnQueryDTO queryDTO);
}

View File

@ -7,9 +7,11 @@ import cn.iocoder.mall.order.api.OrderLogisticsService;
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.OrderReturnListBO;
import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum;
import cn.iocoder.mall.order.api.constant.OrderReturnStatusEnum;
import cn.iocoder.mall.order.api.dto.OrderReturnApplyDTO;
import cn.iocoder.mall.order.api.dto.OrderReturnQueryDTO;
import cn.iocoder.mall.order.biz.convert.OrderReturnConvert;
import cn.iocoder.mall.order.biz.dao.OrderItemMapper;
import cn.iocoder.mall.order.biz.dao.OrderMapper;
@ -22,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@ -112,4 +115,29 @@ public class OrderReturnServiceImpl implements OrderReturnService {
return CommonResult.success(orderReturnInfoBO);
}
@Override
public CommonResult<OrderReturnListBO> orderReturnList(OrderReturnQueryDTO queryDTO) {
int totalCount = orderReturnMapper.selectListCount(queryDTO);
if (totalCount <= 0) {
return CommonResult.success(
new OrderReturnListBO()
.setData(Collections.EMPTY_LIST)
.setIndex(queryDTO.getIndex())
.setPageSize(queryDTO.getPageSize())
.setTotalCount(0)
);
}
List<OrderReturnDO> orderReturnDOList = orderReturnMapper.selectList(queryDTO);
List<OrderReturnListBO.OrderReturn> orderReturnListBOList
= OrderReturnConvert.INSTANCE.convertListBO(orderReturnDOList);
return CommonResult.success(
new OrderReturnListBO()
.setData(orderReturnListBOList)
.setIndex(queryDTO.getIndex())
.setPageSize(queryDTO.getPageSize())
.setTotalCount(totalCount)
);
}
}

View File

@ -105,4 +105,44 @@
LIMIT 1
</select>
<!--
列表查询 - where
-->
<sql id="selectListWhere">
<if test="orderId != null">
AND order_id = #{orderId}
</if>
<if test="orderId != null">
AND order_no = #{orderNo}
</if>
<if test="startCreateTime != null and endCreateTime != null">
AND create_time &gt;= #{startCreateTime}
AND create_time &lt;= #{endCreateTime}
</if>
</sql>
<!--
列表查询 - count
-->
<select id="selectListCount" resultType="java.lang.Integer">
SELECT
COUNT(*)
FROM `order_return`
WHERE 1 = 1
<include refid="selectListWhere" />
</select>
<!--
列表查询 - queryDTO
-->
<select id="selectList" resultType="cn.iocoder.mall.order.biz.dataobject.OrderReturnDO">
SELECT
<include refid="FIELDS"/>
FROM `order_return`
WHERE 1 = 1
<include refid="selectListWhere" />
<bind name="limitIndex" value="pageSize * (index - 1)"/>
LIMIT #{limitIndex}, #{pageSize}
</select>
</mapper>