- 添加 退货订单列表

pull/1/head
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>