- 添加修改金额

- 添加备注
- 添加取消订单操作
This commit is contained in:
sin 2019-03-30 21:31:06 +08:00
parent bbccd623e4
commit 0256a4da17
44 changed files with 715 additions and 113 deletions

View File

@ -36,6 +36,22 @@ public class AdminsOrderController {
return orderService.getOrderPage(orderQueryDTO); return orderService.getOrderPage(orderQueryDTO);
} }
@PutMapping("update_remark")
@ApiOperation("更新-更新订单备注")
public CommonResult updateRemark(@RequestParam("orderId") Integer orderId,
@RequestParam("remark") String remark) {
return orderService.updateOrderRemake(orderId, remark);
}
@PutMapping("cancel_order")
@ApiOperation("取消订单")
public CommonResult cancelOrder(
@RequestParam("orderId") Integer orderId,
@RequestParam("reasons") Integer reasons,
@RequestParam(value = "otherReasons", required = false) String otherReasons) {
return orderService.cancelOrder(orderId, reasons, otherReasons);
}
@PutMapping("order_item/update_pay_amount") @PutMapping("order_item/update_pay_amount")
@ApiOperation("更新-订单item实付金额") @ApiOperation("更新-订单item实付金额")
public CommonResult updateOrderItemPayAmount(@RequestParam("orderId") Integer orderId, public CommonResult updateOrderItemPayAmount(@RequestParam("orderId") Integer orderId,

View File

@ -59,6 +59,8 @@ public class OrderPageQueryVO implements Serializable {
/** /**
* 删除状态 * 删除状态
*/ */
@ApiModelProperty("订单状态")
private Integer status;
@ApiModelProperty("删除状态") @ApiModelProperty("删除状态")
private Integer deleted; private Integer deleted;
@ApiModelProperty("分页pageNo") @ApiModelProperty("分页pageNo")
@ -78,6 +80,7 @@ public class OrderPageQueryVO implements Serializable {
", endCreateTime=" + endCreateTime + ", endCreateTime=" + endCreateTime +
", startClosingTime=" + startClosingTime + ", startClosingTime=" + startClosingTime +
", endClosingTime=" + endClosingTime + ", endClosingTime=" + endClosingTime +
", status=" + status +
", deleted=" + deleted + ", deleted=" + deleted +
", pageNo=" + pageNo + ", pageNo=" + pageNo +
", pageSize=" + pageSize + ", pageSize=" + pageSize +
@ -165,6 +168,15 @@ public class OrderPageQueryVO implements Serializable {
return this; return this;
} }
public Integer getStatus() {
return status;
}
public OrderPageQueryVO setStatus(Integer status) {
this.status = status;
return this;
}
public Integer getDeleted() { public Integer getDeleted() {
return deleted; return deleted;
} }

View File

@ -0,0 +1,21 @@
package cn.iocoder.mall.order.api;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.order.api.dto.OrderReturnCreateDTO;
/**
* 订单退货
*
* @author Sin
* @time 2019-03-30 15:33
*/
public interface OrderReturnService {
/**
* 订单退货 - 创建
*
* @param orderReturnCreate
* @return
*/
CommonResult createOrderReturn(OrderReturnCreateDTO orderReturnCreate);
}

View File

@ -39,7 +39,7 @@ public interface OrderService {
CommonResult updateOrderItem(OrderItemUpdateDTO orderItemUpdateDTO); CommonResult updateOrderItem(OrderItemUpdateDTO orderItemUpdateDTO);
/** /**
* 订单item - 更新 payAmount(实付金额) * 更新订单item - payAmount(实付金额)
* *
* @param orderId * @param orderId
* @param orderItemId * @param orderItemId
@ -49,7 +49,24 @@ public interface OrderService {
CommonResult updateOrderItemPayAmount(Integer orderId, Integer orderItemId, Integer payAmount); CommonResult updateOrderItemPayAmount(Integer orderId, Integer orderItemId, Integer payAmount);
/** /**
* 订单item - 删除 * 订单 - 取消订单
*
* @param orderId
* @return
*/
CommonResult cancelOrder(Integer orderId, Integer reasons, String otherReasons);
/**
* 更新订单 - 备注
*
* @param orderId
* @param remake
* @return
*/
CommonResult updateOrderRemake(Integer orderId, String remake);
/**
* 删除订单item
* *
* @param orderItemDeletedDTO * @param orderItemDeletedDTO
* @return * @return

View File

@ -5,13 +5,13 @@ import cn.iocoder.common.framework.constant.ModuleErrorCodeInterval;
/** /**
* 错误码区间 * 错误码区间
* *
* 当前模块化区间[1-000-001-000 ~ 1-000-002-000] * 当前模块化区间[1-008-000-000 ~ 1-008-000-000]
* *
* @author Sin * @author Sin
* @time 2019-03-23 11:35 * @time 2019-03-23 11:35
*/ */
public class ErrorCodeInterval extends ModuleErrorCodeInterval { public class ErrorCodeInterval extends ModuleErrorCodeInterval {
// OrderErrorCodeEnum 错误码区间 [1-000-001-000 ~ 1-000-001-100] // OrderErrorCodeEnum 错误码区间 [1-008-000-000 ~ 1-008-000-000]
} }

View File

@ -0,0 +1,54 @@
package cn.iocoder.mall.order.api.constant;
/**
* 订单取消原因
* order_cancel_reasons
* @author Sin
* @time 2019-03-30 15:08
*/
public enum OrderCancelReasonsEnum {
CANCEL_1(1, "无法联系上买家"),
CANCEL_2(2, "买家误拍或重拍了"),
CANCEL_3(3, "买家无诚意完成交易"),
CANCEL_4(4, "已通过银行线下汇款"),
CANCEL_5(5, "已通过同城见面交易"),
CANCEL_6(6, "已通过货到付款交易"),
CANCEL_7(7, "已通过网上银行直接汇款"),
CANCEL_8(8, "已经缺货无法交易"),
CANCEL_20(20, "其他"),
;
// 无法联系上买家
// 买家误拍或重拍了
// 买家无诚意完成交易
// 已通过银行线下汇款
// 已通过同城见面交易
// 已通过货到付款交易
// 已通过网上银行直接汇款
// 已经缺货无法交易
private final int code;
private final String message;
OrderCancelReasonsEnum(int code, String message) {
this.code = code;
this.message = message;
}
@Override
public String toString() {
return "OrderCancelEnum{" +
"code=" + code +
", message='" + message + '\'' +
'}';
}
public int getCode() {
return code;
}
public String getMessage() {
return message;
}
}

View File

@ -3,17 +3,22 @@ package cn.iocoder.mall.order.api.constant;
/** /**
* 订单错误码 * 订单错误码
* *
* 错误码区间 [1-000-001-000 ~ 1-000-002-000] * 错误码区间 [1-008-000-000 ~ 1-008-000-000]
* *
* @author Sin * @author Sin
* @time 2019-03-23 11:23 * @time 2019-03-23 11:23
*/ */
public enum OrderErrorCodeEnum { public enum OrderErrorCodeEnum {
ORDER_ITEM_ONLY_ONE(1000001000, "订单Item只有一个!"), // order
ORDER_GET_SKU_FAIL(1000001001, "获取商品失败!"), ORDER_NOT_EXISTENT(1008000000, "获取订单不存在!"),
ORDER_GET_SKU_NOT_EXISTENT(1000001002, "获取的商品不存在!"), ORDER_GET_SKU_FAIL(1008000001, "获取商品失败!"),
ORDER_PAY_AMOUNT_NOT_NEGATIVE(1000001002, "支付金额不能为负数!"), ORDER_GET_SKU_NOT_EXISTENT(1008000002, "获取的商品不存在!"),
ORDER_PAY_AMOUNT_NOT_NEGATIVE(1008000003, "支付金额不能为负数!"),
ORDER_STATUS_NOT_CANCEL(1008000004, "订单状态不能取消"),
// order item
ORDER_ITEM_ONLY_ONE(1008000004, "订单Item只有一个!"),
; ;
private final int code; private final int code;

View File

@ -0,0 +1,41 @@
package cn.iocoder.mall.order.api.constant;
/**
* 订单退货 status
*
* @author Sin
* @time 2019-03-30 15:56
*/
public enum OrderReturnStatusEnum {
/**
* 状态
*
* - 1退货申请
* - 2申请成功
* - 3申请失败
* - 4退货中
* - 5退货成功
*/
RETURN_APPLICATION(1, "退货申请"),
APPLICATION_SUCCESSFUL(1, "申请成功"),
APPLICATION_FAIL(1, "申请失败"),
;
private final int value;
private final String name;
OrderReturnStatusEnum(int value, String name) {
this.value = value;
this.name = name;
}
public int getValue() {
return value;
}
public String getName() {
return name;
}
}

View File

@ -0,0 +1,31 @@
package cn.iocoder.mall.order.api.constant;
/**
* 订单退货 类型
*
* @author Sin
* @time 2019-03-30 15:42
*/
public enum OrderReturnTypeEnum {
ORDER(1, "订单"),
ORDER_ITEM(2, "订单item"),
;
private final int value;
private final String name;
OrderReturnTypeEnum(int value, String name) {
this.value = value;
this.name = name;
}
public int getValue() {
return value;
}
public String getName() {
return name;
}
}

View File

@ -0,0 +1,93 @@
package cn.iocoder.mall.order.api.dto;
import java.io.Serializable;
import java.util.Date;
/**
* 订单退货 - 创建
*
* @author Sin
* @time 2019-03-30 15:34
*/
public class OrderReturnCreateDTO implements Serializable {
/**
* 订单编号
*/
private Integer orderId;
/**
* 订单 item 编号
*/
private Integer orderItemId;
/**
* 退货原因(字典值)
*/
private Integer orderReason;
/**
* 原因如果选择其他原因保存在这
*/
private String otherReasons;
/**
* 订单类型
*
* - 0 Order 订单 对整个订单退货
* - 1 OrderItem 订单 对订单某一个商品退货
*/
private Integer orderType;
@Override
public String toString() {
return "OrderReturnCreateDTO{" +
"orderId=" + orderId +
", orderItemId=" + orderItemId +
", orderReason=" + orderReason +
", otherReasons='" + otherReasons + '\'' +
", orderType=" + orderType +
'}';
}
public Integer getOrderId() {
return orderId;
}
public OrderReturnCreateDTO setOrderId(Integer orderId) {
this.orderId = orderId;
return this;
}
public Integer getOrderItemId() {
return orderItemId;
}
public OrderReturnCreateDTO setOrderItemId(Integer orderItemId) {
this.orderItemId = orderItemId;
return this;
}
public Integer getOrderReason() {
return orderReason;
}
public OrderReturnCreateDTO setOrderReason(Integer orderReason) {
this.orderReason = orderReason;
return this;
}
public String getOtherReasons() {
return otherReasons;
}
public OrderReturnCreateDTO setOtherReasons(String otherReasons) {
this.otherReasons = otherReasons;
return this;
}
public Integer getOrderType() {
return orderType;
}
public OrderReturnCreateDTO setOrderType(Integer orderType) {
this.orderType = orderType;
return this;
}
}

View File

@ -1,6 +1,6 @@
package cn.iocoder.mall.order; package cn.iocoder.mall.order.biz;
import cn.iocoder.mall.order.dataobject.OrderItemDO; import cn.iocoder.mall.order.biz.dataobject.OrderItemDO;
import java.util.List; import java.util.List;

View File

@ -1,6 +1,6 @@
package cn.iocoder.mall.order; package cn.iocoder.mall.order.biz;
import cn.iocoder.mall.order.dataobject.OrderItemDO; import cn.iocoder.mall.order.biz.dataobject.OrderItemDO;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -23,7 +23,7 @@ public class OrderCommonImpl implements OrderCommon {
} }
AtomicInteger totalAmount = new AtomicInteger(0); AtomicInteger totalAmount = new AtomicInteger(0);
items.forEach(orderItemDO -> { items.forEach(orderItemDO -> {
totalAmount.addAndGet(orderItemDO.getPrice() * orderItemDO.getQuantity()); totalAmount.addAndGet(orderItemDO.getPayAmount() * orderItemDO.getQuantity());
}); });
return totalAmount.get(); return totalAmount.get();
} }

View File

@ -1,11 +1,11 @@
package cn.iocoder.mall.order.config; package cn.iocoder.mall.order.biz.config;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration @Configuration
@MapperScan("cn.iocoder.mall.order.dao") // 扫描对应的 Mapper 接口 @MapperScan("cn.iocoder.mall.order.biz.dao") // 扫描对应的 Mapper 接口
@EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理为什么使用 proxyTargetClass 参数参见 https://blog.csdn.net/huang_550/article/details/76492600 @EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理为什么使用 proxyTargetClass 参数参见 https://blog.csdn.net/huang_550/article/details/76492600
public class DatabaseConfiguration { public class DatabaseConfiguration {

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.order.config; package cn.iocoder.mall.order.biz.config;
import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.order.constants; package cn.iocoder.mall.order.biz.constants;
/** /**
* 订单换货原因 * 订单换货原因

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.order.constants; package cn.iocoder.mall.order.biz.constants;
/** /**
* 订单退货原因 * 订单退货原因

View File

@ -4,4 +4,4 @@
* @author Sin * @author Sin
* @time 2019-03-20 21:16 * @time 2019-03-20 21:16
*/ */
package cn.iocoder.mall.order.constants; package cn.iocoder.mall.order.biz.constants;

View File

@ -1,7 +1,7 @@
package cn.iocoder.mall.order.convert; package cn.iocoder.mall.order.biz.convert;
import cn.iocoder.mall.order.api.bo.OrderBO; import cn.iocoder.mall.order.api.bo.OrderBO;
import cn.iocoder.mall.order.dataobject.OrderDO; import cn.iocoder.mall.order.biz.dataobject.OrderDO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mappings; import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;

View File

@ -1,9 +1,9 @@
package cn.iocoder.mall.order.convert; package cn.iocoder.mall.order.biz.convert;
import cn.iocoder.mall.order.api.dto.OrderCreateItemDTO; import cn.iocoder.mall.order.api.dto.OrderCreateItemDTO;
import cn.iocoder.mall.order.api.bo.OrderItemBO; import cn.iocoder.mall.order.api.bo.OrderItemBO;
import cn.iocoder.mall.order.api.dto.OrderItemUpdateDTO; import cn.iocoder.mall.order.api.dto.OrderItemUpdateDTO;
import cn.iocoder.mall.order.dataobject.OrderItemDO; import cn.iocoder.mall.order.biz.dataobject.OrderItemDO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mappings; import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;

View File

@ -1,9 +1,9 @@
package cn.iocoder.mall.order.convert; package cn.iocoder.mall.order.biz.convert;
import cn.iocoder.mall.order.api.bo.OrderLogisticsBO; import cn.iocoder.mall.order.api.bo.OrderLogisticsBO;
import cn.iocoder.mall.order.api.dto.OrderCreateDTO; import cn.iocoder.mall.order.api.dto.OrderCreateDTO;
import cn.iocoder.mall.order.api.dto.OrderLogisticsUpdateDTO; import cn.iocoder.mall.order.api.dto.OrderLogisticsUpdateDTO;
import cn.iocoder.mall.order.dataobject.OrderLogisticsDO; import cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mappings; import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;

View File

@ -0,0 +1,23 @@
package cn.iocoder.mall.order.biz.convert;
import cn.iocoder.mall.order.api.dto.OrderCreateDTO;
import cn.iocoder.mall.order.api.dto.OrderReturnCreateDTO;
import cn.iocoder.mall.order.biz.dataobject.OrderReturnDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
/**
* 订单 return
*
* @author Sin
* @time 2019-03-30 15:46
*/
@Mapper
public interface OrderReturnConvert {
OrderReturnConvert INSTANCE = Mappers.getMapper(OrderReturnConvert.class);
@Mappings({})
OrderReturnDO convert(OrderReturnCreateDTO orderReturnCreate);
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.mall.order.biz.dao;
import cn.iocoder.mall.order.biz.dataobject.OrderCancelDO;
import org.springframework.stereotype.Repository;
/**
* 订单取消 mapper
*
* @author Sin
* @time 2019-03-30 16:27
*/
@Repository
public interface OrderCancelMapper {
int insert(OrderCancelDO orderCancelDO);
}

View File

@ -1,6 +1,6 @@
package cn.iocoder.mall.order.dao; package cn.iocoder.mall.order.biz.dao;
import cn.iocoder.mall.order.dataobject.OrderItemDO; import cn.iocoder.mall.order.biz.dataobject.OrderItemDO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -31,6 +31,12 @@ public interface OrderItemMapper {
*/ */
void updateById(OrderItemDO orderItemDO); void updateById(OrderItemDO orderItemDO);
/**
* 更新 - 根据 orderId
* @param orderItemDO
*/
void updateByOrderId(OrderItemDO orderItemDO);
/** /**
* 更新 - 根据Ids * 更新 - 根据Ids
* *

View File

@ -1,6 +1,6 @@
package cn.iocoder.mall.order.dao; package cn.iocoder.mall.order.biz.dao;
import cn.iocoder.mall.order.dataobject.OrderLogisticsDO; import cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;

View File

@ -1,7 +1,7 @@
package cn.iocoder.mall.order.dao; package cn.iocoder.mall.order.biz.dao;
import cn.iocoder.mall.order.api.dto.OrderQueryDTO; import cn.iocoder.mall.order.api.dto.OrderQueryDTO;
import cn.iocoder.mall.order.dataobject.OrderDO; import cn.iocoder.mall.order.biz.dataobject.OrderDO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;

View File

@ -0,0 +1,13 @@
package cn.iocoder.mall.order.biz.dao;
import org.springframework.stereotype.Repository;
/**
* 订单退货 mapper
*
* @author Sin
* @time 2019-03-30 15:36
*/
@Repository
public interface OrderReturnMapper {
}

View File

@ -0,0 +1,95 @@
package cn.iocoder.mall.order.biz.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO;
import java.io.Serializable;
/**
* 订单关闭
*
* - 注意订单只有在用户为付款前取消
*
* - 取消订单这里是取消整个订单不能对订单 item 单独做取消
*
* @author Sin
* @time 2019-03-30 16:20
*/
public class OrderCancelDO extends BaseDO {
/**
* id
*/
private Integer id;
/**
* 订单id
*/
private Integer orderId;
/**
* 订单编号
*/
private String orderNo;
/**
* 关闭订单原因字典
*/
private Integer reason;
/**
* 原因如果选择其他原因保存在这
*/
private String otherReason;
@Override
public String toString() {
return "OrderCancelDO{" +
"id=" + id +
", orderId=" + orderId +
", orderNo='" + orderNo + '\'' +
", reason=" + reason +
", otherReason='" + otherReason + '\'' +
'}';
}
public Integer getId() {
return id;
}
public OrderCancelDO setId(Integer id) {
this.id = id;
return this;
}
public Integer getOrderId() {
return orderId;
}
public OrderCancelDO setOrderId(Integer orderId) {
this.orderId = orderId;
return this;
}
public String getOrderNo() {
return orderNo;
}
public OrderCancelDO setOrderNo(String orderNo) {
this.orderNo = orderNo;
return this;
}
public Integer getReason() {
return reason;
}
public OrderCancelDO setReason(Integer reason) {
this.reason = reason;
return this;
}
public String getOtherReason() {
return otherReason;
}
public OrderCancelDO setOtherReason(String otherReason) {
this.otherReason = otherReason;
return this;
}
}

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.order.dataobject; package cn.iocoder.mall.order.biz.dataobject;
import cn.iocoder.common.framework.dataobject.DeletableDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
@ -59,20 +59,20 @@ public class OrderDO extends DeletableDO {
/** /**
* 是否退货 * 是否退货
* *
* - 0没有 * - 1没有
* - 1换货 * - 2换货
* - 2退货 * - 3退货
* - 3换货 + 退货 * - 4换货 + 退货
*/ */
private Integer hasReturnExchange; private Integer hasReturnExchange;
/** /**
* 状态(如果有多个商品分开发货需要全部商品发完才会改变状态) * 状态(如果有多个商品分开发货需要全部商品发完才会改变状态)
* *
* - 0待付款 * - 1待付款
* - 1待发货 * - 2待发货
* - 2待收获 * - 3待收获
* - 3已完成 * - 4已完成
* - 4已关闭 * - 5已关闭
*/ */
private Integer status; private Integer status;
/** /**

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.order.dataobject; package cn.iocoder.mall.order.biz.dataobject;
import cn.iocoder.common.framework.dataobject.DeletableDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
@ -51,13 +51,13 @@ public class OrderExchangeDO extends DeletableDO {
/** /**
* 原因 (关联字典) * 原因 (关联字典)
* *
* {@link cn.iocoder.mall.order.constants.OrderExchangeReasonEnum} * {@link cn.iocoder.mall.order.biz.constants.OrderExchangeReasonEnum}
*/ */
private Integer orderReasonId; private Integer orderReasonId;
/** /**
* 原因如果选择其他原因保存在这 * 原因如果选择其他原因保存在这
* *
* {@link cn.iocoder.mall.order.constants.OrderExchangeReasonEnum#REASON_000} * {@link cn.iocoder.mall.order.biz.constants.OrderExchangeReasonEnum#REASON_000}
*/ */
private String reason; private String reason;

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.order.dataobject; package cn.iocoder.mall.order.biz.dataobject;
import cn.iocoder.common.framework.dataobject.DeletableDO; import cn.iocoder.common.framework.dataobject.DeletableDO;

View File

@ -1,7 +1,6 @@
package cn.iocoder.mall.order.dataobject; package cn.iocoder.mall.order.biz.dataobject;
import cn.iocoder.common.framework.dataobject.BaseDO; import cn.iocoder.common.framework.dataobject.BaseDO;
import cn.iocoder.common.framework.dataobject.DeletableDO;
/** /**
* 订单物流信息 * 订单物流信息

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.order.dataobject; package cn.iocoder.mall.order.biz.dataobject;
import cn.iocoder.common.framework.dataobject.DeletableDO; import cn.iocoder.common.framework.dataobject.DeletableDO;

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.order.dataobject; package cn.iocoder.mall.order.biz.dataobject;
import cn.iocoder.common.framework.dataobject.DeletableDO; import cn.iocoder.common.framework.dataobject.DeletableDO;
@ -31,7 +31,15 @@ public class OrderReturnDO extends DeletableDO {
/** /**
* 商品编号保存一个冗余如果一个订单下存在多个商品会有很大的作用 * 商品编号保存一个冗余如果一个订单下存在多个商品会有很大的作用
*/ */
private String skuId; private Integer skuId;
/**
* 商品名称
*/
private String skuName;
/**
* 商品图片
*/
private String skuImage;
/** /**
* 物流id * 物流id
*/ */
@ -43,15 +51,15 @@ public class OrderReturnDO extends DeletableDO {
/** /**
* 退货原因(字典值) * 退货原因(字典值)
* *
* {@link cn.iocoder.mall.order.constants.OrderReturnReasonEnum} * {@link cn.iocoder.mall.order.biz.constants.OrderReturnReasonEnum}
*/ */
private Integer orderReasonId; private Integer orderReason;
/** /**
* 原因如果选择其他原因保存在这 * 原因如果选择其他原因保存在这
* *
* {@link cn.iocoder.mall.order.constants.OrderReturnReasonEnum#REASON_000} * {@link cn.iocoder.mall.order.biz.constants.OrderReturnReasonEnum#REASON_000}
*/ */
private String reason; private String otherReasons;
/// ///
/// 时间信息 /// 时间信息
@ -90,11 +98,11 @@ public class OrderReturnDO extends DeletableDO {
/** /**
* 状态 * 状态
* *
* - 0退货申请 * - 1退货申请
* - 1申请成功 * - 2申请成功
* - 2申请失败 * - 3申请失败
* - 3退货中 * - 4退货中
* - 4退货成功 * - 5退货成功
*/ */
private Integer status; private Integer status;
@ -105,10 +113,12 @@ public class OrderReturnDO extends DeletableDO {
", orderId=" + orderId + ", orderId=" + orderId +
", orderNo='" + orderNo + '\'' + ", orderNo='" + orderNo + '\'' +
", orderItemId=" + orderItemId + ", orderItemId=" + orderItemId +
", skuId='" + skuId + '\'' + ", skuId=" + skuId +
", skuName='" + skuName + '\'' +
", skuImage='" + skuImage + '\'' +
", orderLogisticsId=" + orderLogisticsId + ", orderLogisticsId=" + orderLogisticsId +
", orderReasonId=" + orderReasonId + ", orderReason=" + orderReason +
", reason='" + reason + '\'' + ", otherReasons='" + otherReasons + '\'' +
", createTime=" + createTime + ", createTime=" + createTime +
", approvalTime=" + approvalTime + ", approvalTime=" + approvalTime +
", logisticsTime=" + logisticsTime + ", logisticsTime=" + logisticsTime +
@ -155,15 +165,33 @@ public class OrderReturnDO extends DeletableDO {
return this; return this;
} }
public String getSkuId() { public Integer getSkuId() {
return skuId; return skuId;
} }
public OrderReturnDO setSkuId(String skuId) { public OrderReturnDO setSkuId(Integer skuId) {
this.skuId = skuId; this.skuId = skuId;
return this; return this;
} }
public String getSkuName() {
return skuName;
}
public OrderReturnDO setSkuName(String skuName) {
this.skuName = skuName;
return this;
}
public String getSkuImage() {
return skuImage;
}
public OrderReturnDO setSkuImage(String skuImage) {
this.skuImage = skuImage;
return this;
}
public Integer getOrderLogisticsId() { public Integer getOrderLogisticsId() {
return orderLogisticsId; return orderLogisticsId;
} }
@ -173,21 +201,21 @@ public class OrderReturnDO extends DeletableDO {
return this; return this;
} }
public Integer getOrderReasonId() { public Integer getOrderReason() {
return orderReasonId; return orderReason;
} }
public OrderReturnDO setOrderReasonId(Integer orderReasonId) { public OrderReturnDO setOrderReason(Integer orderReason) {
this.orderReasonId = orderReasonId; this.orderReason = orderReason;
return this; return this;
} }
public String getReason() { public String getOtherReasons() {
return reason; return otherReasons;
} }
public OrderReturnDO setReason(String reason) { public OrderReturnDO setOtherReasons(String otherReasons) {
this.reason = reason; this.otherReasons = otherReasons;
return this; return this;
} }

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.order.mock; package cn.iocoder.mall.order.biz.mock;
import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.product.api.ProductSpuService; import cn.iocoder.mall.product.api.ProductSpuService;

View File

@ -2,4 +2,4 @@
* @author Sin * @author Sin
* @time 2019-03-16 13:49 * @time 2019-03-16 13:49
*/ */
package cn.iocoder.mall.order; package cn.iocoder.mall.order.biz;

View File

@ -0,0 +1,39 @@
package cn.iocoder.mall.order.biz.service;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.order.api.OrderReturnService;
import cn.iocoder.mall.order.api.constant.OrderReturnStatusEnum;
import cn.iocoder.mall.order.api.dto.OrderReturnCreateDTO;
import cn.iocoder.mall.order.biz.convert.OrderReturnConvert;
import cn.iocoder.mall.order.biz.dao.OrderReturnMapper;
import cn.iocoder.mall.order.biz.dataobject.OrderReturnDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* 订单退货 service
*
* @author Sin
* @time 2019-03-30 15:35
*/
@Service
public class OrderReturnServiceImpl implements OrderReturnService {
@Autowired
private OrderReturnMapper orderReturnMapper;
@Override
public CommonResult createOrderReturn(OrderReturnCreateDTO orderReturnCreate) {
OrderReturnDO orderReturnDO = OrderReturnConvert.INSTANCE.convert(orderReturnCreate);
orderReturnDO
.setCreateTime(new Date())
.setStatus(OrderReturnStatusEnum.RETURN_APPLICATION.getValue());
return null;
}
}

View File

@ -1,24 +1,26 @@
package cn.iocoder.mall.order.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.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.OrderCommon;
import cn.iocoder.mall.order.api.OrderService; import cn.iocoder.mall.order.api.OrderService;
import cn.iocoder.mall.order.api.bo.*; import cn.iocoder.mall.order.api.bo.*;
import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum; import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum;
import cn.iocoder.mall.order.api.constant.OrderHasReturnExchangeEnum; import cn.iocoder.mall.order.api.constant.OrderHasReturnExchangeEnum;
import cn.iocoder.mall.order.api.constant.OrderStatusEnum; import cn.iocoder.mall.order.api.constant.OrderStatusEnum;
import cn.iocoder.mall.order.api.dto.*; import cn.iocoder.mall.order.api.dto.*;
import cn.iocoder.mall.order.convert.OrderConvert; import cn.iocoder.mall.order.biz.OrderCommon;
import cn.iocoder.mall.order.convert.OrderItemConvert; import cn.iocoder.mall.order.biz.convert.OrderConvert;
import cn.iocoder.mall.order.convert.OrderLogisticsConvert; import cn.iocoder.mall.order.biz.convert.OrderItemConvert;
import cn.iocoder.mall.order.dao.OrderItemMapper; import cn.iocoder.mall.order.biz.convert.OrderLogisticsConvert;
import cn.iocoder.mall.order.dao.OrderLogisticsMapper; import cn.iocoder.mall.order.biz.dao.OrderCancelMapper;
import cn.iocoder.mall.order.dao.OrderMapper; import cn.iocoder.mall.order.biz.dao.OrderItemMapper;
import cn.iocoder.mall.order.dataobject.OrderDO; import cn.iocoder.mall.order.biz.dao.OrderLogisticsMapper;
import cn.iocoder.mall.order.dataobject.OrderItemDO; import cn.iocoder.mall.order.biz.dao.OrderMapper;
import cn.iocoder.mall.order.dataobject.OrderLogisticsDO; import cn.iocoder.mall.order.biz.dataobject.OrderCancelDO;
import cn.iocoder.mall.order.biz.dataobject.OrderDO;
import cn.iocoder.mall.order.biz.dataobject.OrderItemDO;
import cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDO;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -45,6 +47,8 @@ public class OrderServiceImpl implements OrderService {
@Autowired @Autowired
private OrderLogisticsMapper orderLogisticsMapper; private OrderLogisticsMapper orderLogisticsMapper;
@Autowired @Autowired
private OrderCancelMapper orderCancelMapper;
@Autowired
private OrderCommon orderCommon; private OrderCommon orderCommon;
@Override @Override
@ -52,7 +56,7 @@ public class OrderServiceImpl implements OrderService {
int totalCount = orderMapper.selectPageCount(orderQueryDTO); int totalCount = orderMapper.selectPageCount(orderQueryDTO);
if (totalCount == 0) { if (totalCount == 0) {
return CommonResult.success(new OrderPageBO().setTotal(0)); return CommonResult.success(new OrderPageBO().setOrders(Collections.EMPTY_LIST).setTotal(0));
} }
// 获取订单数据 // 获取订单数据
@ -212,10 +216,18 @@ public class OrderServiceImpl implements OrderService {
@Override @Override
@Transactional @Transactional
public CommonResult updateOrderItemPayAmount(Integer orderId, Integer orderItemId, Integer payAmount) { public CommonResult updateOrderItemPayAmount(Integer orderId, Integer orderItemId, Integer payAmount) {
OrderDO orderDO = orderMapper.selectById(orderId);
if (orderDO == null) {
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_NOT_EXISTENT.getCode());
}
if (payAmount < 0) { if (payAmount < 0) {
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_PAY_AMOUNT_NOT_NEGATIVE.getCode()); return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_PAY_AMOUNT_NOT_NEGATIVE.getCode());
} }
// 先更新金额
orderItemMapper.updateById(new OrderItemDO().setId(orderItemId).setPayAmount(payAmount)); orderItemMapper.updateById(new OrderItemDO().setId(orderItemId).setPayAmount(payAmount));
// 再重新计算订单金额
List<OrderItemDO> orderItemDOList = orderItemMapper.selectByOrderIdAndDeleted(orderId, DeletedStatusEnum.DELETED_NO.getValue()); List<OrderItemDO> orderItemDOList = orderItemMapper.selectByOrderIdAndDeleted(orderId, DeletedStatusEnum.DELETED_NO.getValue());
Integer orderPayAmount = orderCommon.calculatedAmount(orderItemDOList); Integer orderPayAmount = orderCommon.calculatedAmount(orderItemDOList);
orderMapper.updateById(new OrderDO().setId(orderId).setPayAmount(orderPayAmount)); orderMapper.updateById(new OrderDO().setId(orderId).setPayAmount(orderPayAmount));
@ -223,6 +235,51 @@ public class OrderServiceImpl implements OrderService {
} }
@Override @Override
@Transactional
public CommonResult cancelOrder(Integer orderId, Integer reason, String otherReason) {
// 关闭订单在用户还未付款的时候可操作
OrderDO orderDO = orderMapper.selectById(orderId);
if (orderDO == null) {
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_NOT_EXISTENT.getCode());
}
// 检查专题只有待付款状态才能操作
if (!orderDO.getStatus().equals(OrderStatusEnum.WAITING_PAYMENT.getValue())) {
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_STATUS_NOT_CANCEL.getCode());
}
OrderCancelDO orderCancelDO
= (OrderCancelDO) new OrderCancelDO()
.setOrderId(orderDO.getId())
.setOrderNo(orderDO.getOrderNo())
.setReason(reason)
.setOtherReason(otherReason)
.setCreateTime(new Date())
.setUpdateTime(null);
// 关闭订单修改状态 item
orderItemMapper.updateByOrderId(
new OrderItemDO()
.setOrderId(orderId)
.setStatus(OrderStatusEnum.CLOSED.getValue())
);
// 关闭订单修改状态 order
orderMapper.updateById(new OrderDO().setId(orderId).setStatus(OrderStatusEnum.CLOSED.getValue()));
// 保存取消订单原因
orderCancelMapper.insert(orderCancelDO);
return CommonResult.success(null);
}
@Override
public CommonResult updateOrderRemake(Integer orderId, String remake) {
// 此处不做订单校验直接设置备注即可
orderMapper.updateById(new OrderDO().setId(orderId).setRemark(remake));
return CommonResult.success(null);
}
@Override
@Transactional
public CommonResult deleteOrderItem(OrderItemDeletedDTO orderItemDeletedDTO) { public CommonResult deleteOrderItem(OrderItemDeletedDTO orderItemDeletedDTO) {
Integer orderId = orderItemDeletedDTO.getOrderId(); Integer orderId = orderItemDeletedDTO.getOrderId();
List<Integer> orderItemIds = orderItemDeletedDTO.getOrderItemIds(); List<Integer> orderItemIds = orderItemDeletedDTO.getOrderItemIds();

View File

@ -10,7 +10,7 @@ spring:
mybatis: mybatis:
config-location: classpath:mybatis-config.xml config-location: classpath:mybatis-config.xml
mapper-locations: classpath:mapper/*.xml mapper-locations: classpath:mapper/*.xml
type-aliases-package: cn.iocoder.mall.order.dataobject type-aliases-package: cn.iocoder.mall.order.biz.dataobject
# dubbo # dubbo
dubbo: dubbo:
@ -22,9 +22,10 @@ dubbo:
port: -1 port: -1
name: dubbo name: dubbo
scan: scan:
base-packages: cn.iocoder.mall.order.service base-packages: cn.iocoder.mall.order.biz.service
# logging # logging
logging: logging:
level: level:
cn.iocoder.mall.order.dao: debug # dao 开启 debug 模式 mybatis 输入 sql
cn.iocoder.mall.order.biz.dao: debug

View File

@ -0,0 +1,22 @@
<?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.OrderCancelMapper">
<sql id="FIELDS">
id, order_id, order_no, reason, other_reason,
create_time, update_time
</sql>
<!--
插入数据
-->
<insert id="insert" parameterType="OrderCancelDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO `order_cancel` (
order_id, order_no, reason, other_reason,
create_time, update_time
) VALUES (
#{orderId}, #{orderNo}, #{reason}, #{otherReason},
#{createTime}, #{updateTime}
)
</insert>
</mapper>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.mall.order.dao.OrderItemMapper"> <mapper namespace="cn.iocoder.mall.order.biz.dao.OrderItemMapper">
<sql id="FIELDS"> <sql id="FIELDS">
id, order_id, order_no, sku_id, sku_name, sku_image, quantity, price, pay_amount, id, order_id, order_no, sku_id, sku_name, sku_image, quantity, price, pay_amount,
@ -106,10 +106,19 @@
</foreach> </foreach>
</update> </update>
<!-- <!--
查询 - 根据 orderId 下的 item 更新 - 根据 orderId
--> -->
<select id="selectByOrderIdAndDeleted" resultType="cn.iocoder.mall.order.dataobject.OrderItemDO"> <update id="updateByOrderId">
UPDATE `order_item`
<include refid="updateFieldSql" />
WHERE order_id = #{orderId}
</update>
<!--
查询 - 根据 orderId 下的 item
-->
<select id="selectByOrderIdAndDeleted" resultType="cn.iocoder.mall.order.biz.dataobject.OrderItemDO">
SELECT * FROM `order_item` SELECT * FROM `order_item`
WHERE 1=1 WHERE 1=1
<if test="deleted"> <if test="deleted">
@ -123,7 +132,7 @@
<!-- <!--
查询 - 根据 orderIds 和 status 查询 - 根据 orderIds 和 status
--> -->
<select id="selectByOrderIdsAndDeleted" resultType="cn.iocoder.mall.order.dataobject.OrderItemDO"> <select id="selectByOrderIdsAndDeleted" resultType="cn.iocoder.mall.order.biz.dataobject.OrderItemDO">
SELECT SELECT
<include refid="FIELDS" /> <include refid="FIELDS" />
FROM `order_item` FROM `order_item`

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.mall.order.dao.OrderLogisticsMapper"> <mapper namespace="cn.iocoder.mall.order.biz.dao.OrderLogisticsMapper">
<sql id="FIELDS"> <sql id="FIELDS">
id, area_no, `name`, mobile, address, logistics_no, create_time, update_time id, area_no, `name`, mobile, address, logistics_no, create_time, update_time
@ -53,7 +53,7 @@
<!-- <!--
查询 - 根据 orderId 查询 - 根据 orderId
--> -->
<select id="selectByIds" resultType="cn.iocoder.mall.order.dataobject.OrderLogisticsDO"> <select id="selectByIds" resultType="cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDO">
SELECT SELECT
<include refid="FIELDS" /> <include refid="FIELDS" />
FROM `order_logistics` FROM `order_logistics`

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.mall.order.dao.OrderMapper"> <mapper namespace="cn.iocoder.mall.order.biz.dao.OrderMapper">
<sql id="FIELDS"> <sql id="FIELDS">
id, user_id, order_logistics_id, order_no, pay_amount, payment_time, id, user_id, order_logistics_id, order_no, pay_amount, payment_time,
@ -39,7 +39,7 @@
<if test="payAmount != null"> <if test="payAmount != null">
, pay_amount = #{payAmount} , pay_amount = #{payAmount}
</if> </if>
-- time
<if test="paymentTime != null"> <if test="paymentTime != null">
, payment_time = #{paymentTime} , payment_time = #{paymentTime}
</if> </if>
@ -55,7 +55,7 @@
<if test="hasReturnExchange != null"> <if test="hasReturnExchange != null">
, has_return_exchange = #{hasReturnExchange} , has_return_exchange = #{hasReturnExchange}
</if> </if>
-- other
<if test="status != null"> <if test="status != null">
, status = #{status} , status = #{status}
</if> </if>
@ -86,7 +86,7 @@
<!-- <!--
查询 - 根据id 查询 查询 - 根据id 查询
--> -->
<select id="selectById" resultType="cn.iocoder.mall.order.dataobject.OrderDO"> <select id="selectById" resultType="cn.iocoder.mall.order.biz.dataobject.OrderDO">
SELECT SELECT
<include refid="FIELDS" /> <include refid="FIELDS" />
FROM `order` FROM `order`
@ -94,26 +94,30 @@
</select> </select>
<!-- <!--
查询条件 查询条件 注意:条件顺序,避免不能使用索引
--> -->
<sql id="selectWhere"> <sql id="selectWhere">
<if test="id != null"> <if test="status != null">
AND `id` = #{id} AND `status` = #{status}
</if> </if>
<if test="userId != null"> <if test="userId != null">
AND `user_id` = #{userId} AND `user_id` = #{userId}
</if> </if>
<if test="orderLogisticsId != null"> <if test="id != null">
AND `order_logistics_id` = #{orderLogisticsId} AND `id` = #{id}
</if> </if>
<if test="orderNo != null"> <if test="orderNo != null">
AND `order_no` = #{orderNo} AND `order_no` = #{orderNo}
</if> </if>
<if test="orderLogisticsId != null">
AND `order_logistics_id` = #{orderLogisticsId}
</if>
<if test="hasReturnExchange != null"> <if test="hasReturnExchange != null">
AND `has_return_exchange` = #{hasReturnExchange} AND `has_return_exchange` = #{hasReturnExchange}
</if> </if>
<if test="status != null"> <if test="startCreateTime != null and endCreateTime != null">
AND `status` = #{status} AND `create_time` &gt;= #{startCreateTime}
AND `create_time` &lt;= #{endCreateTime}
</if> </if>
</sql> </sql>
@ -131,7 +135,7 @@
<!-- <!--
查询 - 后台分页page 查询 - 后台分页page
--> -->
<select id="selectPage" resultType="cn.iocoder.mall.order.dataobject.OrderDO"> <select id="selectPage" resultType="cn.iocoder.mall.order.biz.dataobject.OrderDO">
SELECT SELECT
<include refid="FIELDS" /> <include refid="FIELDS" />
FROM `order` FROM `order`

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.order.service; package cn.iocoder.mall.order.biz.service;
import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.order.OrderApplicationTest; import cn.iocoder.mall.order.OrderApplicationTest;
@ -6,8 +6,8 @@ import cn.iocoder.mall.order.api.OrderService;
import cn.iocoder.mall.order.api.bo.OrderCreateBO; import cn.iocoder.mall.order.api.bo.OrderCreateBO;
import cn.iocoder.mall.order.api.dto.OrderCreateDTO; import cn.iocoder.mall.order.api.dto.OrderCreateDTO;
import cn.iocoder.mall.order.api.dto.OrderCreateItemDTO; import cn.iocoder.mall.order.api.dto.OrderCreateItemDTO;
import cn.iocoder.mall.order.dao.OrderMapper; import cn.iocoder.mall.order.biz.dao.OrderMapper;
import cn.iocoder.mall.order.dataobject.OrderDO; import cn.iocoder.mall.order.biz.dataobject.OrderDO;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;