parent
cddffabeba
commit
718554bcfa
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.mall.order.application.controller.users;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.admin.api.DataDictService;
|
||||
import cn.iocoder.mall.admin.api.bo.DataDictBO;
|
||||
import cn.iocoder.mall.order.api.OrderReturnService;
|
||||
import cn.iocoder.mall.order.api.constant.DictKeyConstants;
|
||||
import cn.iocoder.mall.order.api.dto.OrderReturnApplyDTO;
|
||||
import cn.iocoder.mall.order.application.convert.OrderReturnConvert;
|
||||
import cn.iocoder.mall.order.application.po.user.OrderReturnApplyPO;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单退款/售后流程
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-25 22:04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("users/order_return")
|
||||
public class OrderReturnController {
|
||||
|
||||
@Reference(validation = "true")
|
||||
private OrderReturnService orderReturnService;
|
||||
@Reference(validation = "true")
|
||||
private DataDictService dataDictService;
|
||||
|
||||
@GetMapping("reason")
|
||||
@ApiOperation("原因")
|
||||
public CommonResult<List<DataDictBO>> orderReturnReason() {
|
||||
return dataDictService.getDataDict(DictKeyConstants.ORDER_RETURN_REASON);
|
||||
}
|
||||
|
||||
@PostMapping("apply")
|
||||
@ApiOperation("订单售后")
|
||||
public CommonResult orderReturnApply(@RequestBody OrderReturnApplyPO orderReturnApplyPO) {
|
||||
OrderReturnApplyDTO applyDTO = OrderReturnConvert.INSTANCE.convert(orderReturnApplyPO);
|
||||
return orderReturnService.orderReturnApply(applyDTO);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.mall.order.application.convert;
|
||||
|
||||
import cn.iocoder.mall.order.api.dto.OrderReturnApplyDTO;
|
||||
import cn.iocoder.mall.order.application.po.user.OrderReturnApplyPO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 订单退货
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-25 21:54
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderReturnConvert {
|
||||
|
||||
OrderReturnConvert INSTANCE = Mappers.getMapper(OrderReturnConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
OrderReturnApplyDTO convert(OrderReturnApplyPO orderReturnApplyPO);
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.mall.order.api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Sin
|
||||
* @time 2019-04-25 21:06
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OrderReturnApplyDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private Integer orderId;
|
||||
/**
|
||||
* 退货原因(字典值)
|
||||
*/
|
||||
private Integer reason;
|
||||
/**
|
||||
* 问题描述
|
||||
*/
|
||||
private String describe;
|
||||
/**
|
||||
* 退款类型
|
||||
*
|
||||
* - 1、退货退款
|
||||
* - 2、退款
|
||||
*/
|
||||
private Integer returnType;
|
||||
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.mall.order.biz.dao.OrderReturnMapper">
|
||||
|
||||
<sql id="FIELDS">
|
||||
id,
|
||||
order_id,
|
||||
order_no,
|
||||
order_logistics_id,
|
||||
reason,
|
||||
`describe`,
|
||||
approval_time,
|
||||
logistics_time,
|
||||
receiver_time,
|
||||
closing_time,
|
||||
return_type,
|
||||
status,
|
||||
create_time,
|
||||
update_time
|
||||
</sql>
|
||||
|
||||
<!--
|
||||
插入数据
|
||||
-->
|
||||
<insert id="insert" parameterType="OrderReturnDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
INSERT INTO `order_return` (
|
||||
order_id, order_no, order_logistics_id,
|
||||
reason, `describe`,
|
||||
approval_time, logistics_time, receiver_time, closing_time,
|
||||
return_type, status,
|
||||
create_time, update_time)
|
||||
VALUES (
|
||||
#{orderId}, #{orderNo}, #{orderLogisticsId},
|
||||
#{reason}, #{describe},
|
||||
#{approvalTime}, #{logisticsTime}, #{receiverTime}, #{closingTime},
|
||||
#{returnType}, #{status}, #{createTime}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
<!--
|
||||
更新 - 可更新的字段
|
||||
-->
|
||||
<sql id="updateFieldSql">
|
||||
<set>
|
||||
<if test="orderLogisticsId != null">
|
||||
, order_logistics_id = #{orderLogisticsId}
|
||||
</if>
|
||||
<if test="reason != null">
|
||||
, reason = #{reason}
|
||||
</if>
|
||||
<if test="describe != null">
|
||||
, `describe` = #{describe}
|
||||
</if>
|
||||
<if test="approvalTime != null">
|
||||
, approval_time = #{approvalTime}
|
||||
</if>
|
||||
<if test="logisticsTime != null">
|
||||
, logistics_time = #{logisticsTime}
|
||||
</if>
|
||||
<if test="receiverTime != null">
|
||||
, receiver_time = #{receiverTime}
|
||||
</if>
|
||||
<if test="deliveryTime != null">
|
||||
, delivery_time = #{deliveryTime}
|
||||
</if>
|
||||
<if test="closingTime != null">
|
||||
, closing_time = #{closingTime}
|
||||
</if>
|
||||
<if test="returnType != null">
|
||||
, return_type = #{returnType}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
, status = #{status}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
, create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
, update_time = #{updateTime}
|
||||
</if>
|
||||
</set>
|
||||
</sql>
|
||||
|
||||
<!--
|
||||
更新 - 根据 id 更新
|
||||
-->
|
||||
<update id="updateByOrderId" parameterType="OrderReturnDO">
|
||||
UPDATE `order_return`
|
||||
<include refid="updateFieldSql"/>
|
||||
WHERE order_id = #{orderId}
|
||||
</update>
|
||||
|
||||
<!--
|
||||
查询 - 根据id 查询
|
||||
-->
|
||||
<select id="selectByOrderId" resultType="cn.iocoder.mall.order.biz.dataobject.OrderReturnDO">
|
||||
SELECT
|
||||
<include refid="FIELDS"/>
|
||||
FROM `order_return`
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in new issue