init:初始化订单列表查询
This commit is contained in:
parent
0fe9c39bb3
commit
398395dd4e
Binary file not shown.
|
@ -28,4 +28,5 @@ public interface ErrorCodeConstants {
|
|||
ErrorCode HAO_KA_PRODUCT_NOT_EXISTS = new ErrorCode(1_801_001_005, "产品/渠道不存在");
|
||||
|
||||
ErrorCode ON_SALE_PRODUCT_NOT_EXISTS = new ErrorCode(1_801_001_021, "在售产品不存在");
|
||||
ErrorCode ORDERS_NOT_EXISTS = new ErrorCode(1_805_001_001, "订单不存在");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.orders;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.orders.vo.*;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.orders.OrdersDO;
|
||||
import cn.iocoder.yudao.module.haoka.service.orders.OrdersService;
|
||||
|
||||
@Tag(name = "管理后台 - 订单")
|
||||
@RestController
|
||||
@RequestMapping("/haoka/orders")
|
||||
@Validated
|
||||
public class OrdersController {
|
||||
|
||||
@Resource
|
||||
private OrdersService ordersService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建订单")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:orders:create')")
|
||||
public CommonResult<Long> createOrders(@Valid @RequestBody OrdersSaveReqVO createReqVO) {
|
||||
return success(ordersService.createOrders(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新订单")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:orders:update')")
|
||||
public CommonResult<Boolean> updateOrders(@Valid @RequestBody OrdersSaveReqVO updateReqVO) {
|
||||
ordersService.updateOrders(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除订单")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('haoka:orders:delete')")
|
||||
public CommonResult<Boolean> deleteOrders(@RequestParam("id") Long id) {
|
||||
ordersService.deleteOrders(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得订单")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:orders:query')")
|
||||
public CommonResult<OrdersRespVO> getOrders(@RequestParam("id") Long id) {
|
||||
OrdersDO orders = ordersService.getOrders(id);
|
||||
return success(BeanUtils.toBean(orders, OrdersRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得订单分页")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:orders:query')")
|
||||
public CommonResult<PageResult<OrdersRespVO>> getOrdersPage(@Valid OrdersPageReqVO pageReqVO) {
|
||||
PageResult<OrdersDO> pageResult = ordersService.getOrdersPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, OrdersRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出订单 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:orders:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportOrdersExcel(@Valid OrdersPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<OrdersDO> list = ordersService.getOrdersPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "订单.xls", "数据", OrdersRespVO.class,
|
||||
BeanUtils.toBean(list, OrdersRespVO.class));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.orders.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 订单分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class OrdersPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "供应商-商品名称", example = "芋艿")
|
||||
private String supplierProductName;
|
||||
|
||||
@Schema(description = "供应商-商品编码SKU")
|
||||
private String supplierProductSku;
|
||||
|
||||
@Schema(description = "外部订单编号", example = "1396")
|
||||
private String sourceId;
|
||||
|
||||
@Schema(description = "产品SKU")
|
||||
private String productSku;
|
||||
|
||||
@Schema(description = "外部SKU")
|
||||
private String sourceSku;
|
||||
|
||||
@Schema(description = "证件号码")
|
||||
private String idCardNum;
|
||||
|
||||
@Schema(description = "收件人电话")
|
||||
private String addressMobile;
|
||||
|
||||
@Schema(description = "物流单号")
|
||||
private String trackingNumber;
|
||||
|
||||
@Schema(description = "订单状态码", example = "1")
|
||||
private Long status;
|
||||
|
||||
@Schema(description = "标志")
|
||||
private Long flag;
|
||||
|
||||
@Schema(description = "订单来源")
|
||||
private String source;
|
||||
|
||||
@Schema(description = "用户下单时间")
|
||||
private LocalDateTime orderedAt;
|
||||
|
||||
@Schema(description = "生产时间")
|
||||
private LocalDateTime producedAt;
|
||||
|
||||
@Schema(description = "发货时间")
|
||||
private LocalDateTime deliveredAt;
|
||||
|
||||
@Schema(description = "激活时间")
|
||||
private LocalDateTime activatedAt;
|
||||
|
||||
@Schema(description = "充值时间")
|
||||
private LocalDateTime rechargedAt;
|
||||
|
||||
@Schema(description = "状态变更时间")
|
||||
private LocalDateTime statusUpdatedAt;
|
||||
|
||||
@Schema(description = "退款状态", example = "1")
|
||||
private String refundStatus;
|
||||
|
||||
@Schema(description = "激活状态", example = "1")
|
||||
private String activeStatus;
|
||||
|
||||
@Schema(description = "ICCID", example = "2781")
|
||||
private String iccid;
|
||||
|
||||
@Schema(description = "真实外部订单编号", example = "25683")
|
||||
private String realSourceId;
|
||||
|
||||
@Schema(description = "分销商名称", example = "王五")
|
||||
private String merchantName;
|
||||
|
||||
@Schema(description = "上游状态", example = "2")
|
||||
private String upStatus;
|
||||
|
||||
@Schema(description = "上游订单号", example = "21235")
|
||||
private String upstreamOrderId;
|
||||
|
||||
@Schema(description = "订单状态名称", example = "王五")
|
||||
private String statusName;
|
||||
|
||||
}
|
|
@ -0,0 +1,251 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.orders.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 订单 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class OrdersRespVO {
|
||||
|
||||
@Schema(description = "订单ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12955")
|
||||
@ExcelProperty("订单ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "生产商ID", example = "15873")
|
||||
@ExcelProperty("生产商ID")
|
||||
private Long producerId;
|
||||
|
||||
@Schema(description = "产品ID", example = "14115")
|
||||
@ExcelProperty("产品ID")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "供应商-商品名称", example = "芋艿")
|
||||
@ExcelProperty("供应商-商品名称")
|
||||
private String supplierProductName;
|
||||
|
||||
@Schema(description = "供应商-商品编码SKU")
|
||||
@ExcelProperty("供应商-商品编码SKU")
|
||||
private String supplierProductSku;
|
||||
|
||||
@Schema(description = "外部订单编号", example = "1396")
|
||||
@ExcelProperty("外部订单编号")
|
||||
private String sourceId;
|
||||
|
||||
@Schema(description = "分享ID", example = "26263")
|
||||
@ExcelProperty("分享ID")
|
||||
private Long shareId;
|
||||
|
||||
@Schema(description = "用户ID", example = "31769")
|
||||
@ExcelProperty("用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "产品SKU")
|
||||
@ExcelProperty("产品SKU")
|
||||
private String productSku;
|
||||
|
||||
@Schema(description = "外部SKU")
|
||||
@ExcelProperty("外部SKU")
|
||||
private String sourceSku;
|
||||
|
||||
@Schema(description = "计划手机号")
|
||||
@ExcelProperty("计划手机号")
|
||||
private String planMobile;
|
||||
|
||||
@Schema(description = "生产手机号")
|
||||
@ExcelProperty("生产手机号")
|
||||
private String planMobileProduced;
|
||||
|
||||
@Schema(description = "证件姓名", example = "李四")
|
||||
@ExcelProperty("证件姓名")
|
||||
private String idCardName;
|
||||
|
||||
@Schema(description = "证件号码")
|
||||
@ExcelProperty("证件号码")
|
||||
private String idCardNum;
|
||||
|
||||
@Schema(description = "地址省编码")
|
||||
@ExcelProperty("地址省编码")
|
||||
private String addressProvinceCode;
|
||||
|
||||
@Schema(description = "地址市编码")
|
||||
@ExcelProperty("地址市编码")
|
||||
private String addressCityCode;
|
||||
|
||||
@Schema(description = "地址区编码")
|
||||
@ExcelProperty("地址区编码")
|
||||
private String addressDistrictCode;
|
||||
|
||||
@Schema(description = "地址省")
|
||||
@ExcelProperty("地址省")
|
||||
private String addressProvince;
|
||||
|
||||
@Schema(description = "地址市")
|
||||
@ExcelProperty("地址市")
|
||||
private String addressCity;
|
||||
|
||||
@Schema(description = "地址区")
|
||||
@ExcelProperty("地址区")
|
||||
private String addressDistrict;
|
||||
|
||||
@Schema(description = "详细地址")
|
||||
@ExcelProperty("详细地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "收件人电话")
|
||||
@ExcelProperty("收件人电话")
|
||||
private String addressMobile;
|
||||
|
||||
@Schema(description = "收件人姓名", example = "李四")
|
||||
@ExcelProperty("收件人姓名")
|
||||
private String addressName;
|
||||
|
||||
@Schema(description = "物流公司ID", example = "29667")
|
||||
@ExcelProperty("物流公司ID")
|
||||
private Long trackingCompanyId;
|
||||
|
||||
@Schema(description = "物流单号")
|
||||
@ExcelProperty("物流单号")
|
||||
private String trackingNumber;
|
||||
|
||||
@Schema(description = "买家备注", example = "你说的对")
|
||||
@ExcelProperty("买家备注")
|
||||
private String buyerMemo;
|
||||
|
||||
@Schema(description = "卖家备注", example = "随便")
|
||||
@ExcelProperty("卖家备注")
|
||||
private String sellerMemo;
|
||||
|
||||
@Schema(description = "生产备注", example = "你猜")
|
||||
@ExcelProperty("生产备注")
|
||||
private String producerMemo;
|
||||
|
||||
@Schema(description = "订单状态码", example = "1")
|
||||
@ExcelProperty("订单状态码")
|
||||
private Long status;
|
||||
|
||||
@Schema(description = "标志")
|
||||
@ExcelProperty("标志")
|
||||
private Long flag;
|
||||
|
||||
@Schema(description = "预警区域")
|
||||
@ExcelProperty("预警区域")
|
||||
private String warnArea;
|
||||
|
||||
@Schema(description = "原因", example = "不对")
|
||||
@ExcelProperty("原因")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "订单来源")
|
||||
@ExcelProperty("订单来源")
|
||||
private String source;
|
||||
|
||||
@Schema(description = "用户下单时间")
|
||||
@ExcelProperty("用户下单时间")
|
||||
private LocalDateTime orderedAt;
|
||||
|
||||
@Schema(description = "生产时间")
|
||||
@ExcelProperty("生产时间")
|
||||
private LocalDateTime producedAt;
|
||||
|
||||
@Schema(description = "发货时间")
|
||||
@ExcelProperty("发货时间")
|
||||
private LocalDateTime deliveredAt;
|
||||
|
||||
@Schema(description = "激活时间")
|
||||
@ExcelProperty("激活时间")
|
||||
private LocalDateTime activatedAt;
|
||||
|
||||
@Schema(description = "充值时间")
|
||||
@ExcelProperty("充值时间")
|
||||
private LocalDateTime rechargedAt;
|
||||
|
||||
@Schema(description = "卖家备注", example = "你猜")
|
||||
@ExcelProperty("卖家备注")
|
||||
private String memo;
|
||||
|
||||
@Schema(description = "数量")
|
||||
@ExcelProperty("数量")
|
||||
private String amount;
|
||||
|
||||
@Schema(description = "状态变更时间")
|
||||
@ExcelProperty("状态变更时间")
|
||||
private LocalDateTime statusUpdatedAt;
|
||||
|
||||
@Schema(description = "退款状态", example = "1")
|
||||
@ExcelProperty("退款状态")
|
||||
private String refundStatus;
|
||||
|
||||
@Schema(description = "激活状态", example = "1")
|
||||
@ExcelProperty("激活状态")
|
||||
private String activeStatus;
|
||||
|
||||
@Schema(description = "ICCID", example = "2781")
|
||||
@ExcelProperty("ICCID")
|
||||
private String iccid;
|
||||
|
||||
@Schema(description = "真实外部订单编号", example = "25683")
|
||||
@ExcelProperty("真实外部订单编号")
|
||||
private String realSourceId;
|
||||
|
||||
@Schema(description = "图片大小")
|
||||
@ExcelProperty("图片大小")
|
||||
private Long picSize;
|
||||
|
||||
@Schema(description = "归属地省")
|
||||
@ExcelProperty("归属地省")
|
||||
private String regionP;
|
||||
|
||||
@Schema(description = "归属地市")
|
||||
@ExcelProperty("归属地市")
|
||||
private String regionC;
|
||||
|
||||
@Schema(description = "分销商名称", example = "王五")
|
||||
@ExcelProperty("分销商名称")
|
||||
private String merchantName;
|
||||
|
||||
@Schema(description = "上游状态", example = "2")
|
||||
@ExcelProperty("上游状态")
|
||||
private String upStatus;
|
||||
|
||||
@Schema(description = "上游订单号", example = "21235")
|
||||
@ExcelProperty("上游订单号")
|
||||
private String upstreamOrderId;
|
||||
|
||||
@Schema(description = "镇/乡")
|
||||
@ExcelProperty("镇/乡")
|
||||
private String town;
|
||||
|
||||
@Schema(description = "物流公司名称")
|
||||
@ExcelProperty("物流公司名称")
|
||||
private String trackingCompany;
|
||||
|
||||
@Schema(description = "订单状态名称", example = "王五")
|
||||
@ExcelProperty("订单状态名称")
|
||||
private String statusName;
|
||||
|
||||
@Schema(description = "加密收货电话")
|
||||
@ExcelProperty("加密收货电话")
|
||||
private String encryptAddressMobile;
|
||||
|
||||
@Schema(description = "加密收货人姓名", example = "赵六")
|
||||
@ExcelProperty("加密收货人姓名")
|
||||
private String encryptAddressName;
|
||||
|
||||
@Schema(description = "加密证件姓名", example = "李四")
|
||||
@ExcelProperty("加密证件姓名")
|
||||
private String encryptIdCardName;
|
||||
|
||||
@Schema(description = "加密证件号码")
|
||||
@ExcelProperty("加密证件号码")
|
||||
private String encryptIdCardNum;
|
||||
|
||||
@Schema(description = "加密详细地址")
|
||||
@ExcelProperty("加密详细地址")
|
||||
private String encryptAddress;
|
||||
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.orders.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 订单新增/修改 Request VO")
|
||||
@Data
|
||||
public class OrdersSaveReqVO {
|
||||
|
||||
@Schema(description = "订单ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12955")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "生产商ID", example = "15873")
|
||||
private Long producerId;
|
||||
|
||||
@Schema(description = "产品ID", example = "14115")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "供应商-商品名称", example = "芋艿")
|
||||
private String supplierProductName;
|
||||
|
||||
@Schema(description = "供应商-商品编码SKU")
|
||||
private String supplierProductSku;
|
||||
|
||||
@Schema(description = "外部订单编号", example = "1396")
|
||||
private String sourceId;
|
||||
|
||||
@Schema(description = "分享ID", example = "26263")
|
||||
private Long shareId;
|
||||
|
||||
@Schema(description = "用户ID", example = "31769")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "产品SKU")
|
||||
private String productSku;
|
||||
|
||||
@Schema(description = "外部SKU")
|
||||
private String sourceSku;
|
||||
|
||||
@Schema(description = "计划手机号")
|
||||
private String planMobile;
|
||||
|
||||
@Schema(description = "生产手机号")
|
||||
private String planMobileProduced;
|
||||
|
||||
@Schema(description = "证件姓名", example = "李四")
|
||||
private String idCardName;
|
||||
|
||||
@Schema(description = "证件号码")
|
||||
private String idCardNum;
|
||||
|
||||
@Schema(description = "地址省编码")
|
||||
private String addressProvinceCode;
|
||||
|
||||
@Schema(description = "地址市编码")
|
||||
private String addressCityCode;
|
||||
|
||||
@Schema(description = "地址区编码")
|
||||
private String addressDistrictCode;
|
||||
|
||||
@Schema(description = "地址省")
|
||||
private String addressProvince;
|
||||
|
||||
@Schema(description = "地址市")
|
||||
private String addressCity;
|
||||
|
||||
@Schema(description = "地址区")
|
||||
private String addressDistrict;
|
||||
|
||||
@Schema(description = "详细地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "收件人电话")
|
||||
private String addressMobile;
|
||||
|
||||
@Schema(description = "收件人姓名", example = "李四")
|
||||
private String addressName;
|
||||
|
||||
@Schema(description = "物流公司ID", example = "29667")
|
||||
private Long trackingCompanyId;
|
||||
|
||||
@Schema(description = "物流单号")
|
||||
private String trackingNumber;
|
||||
|
||||
@Schema(description = "买家备注", example = "你说的对")
|
||||
private String buyerMemo;
|
||||
|
||||
@Schema(description = "卖家备注", example = "随便")
|
||||
private String sellerMemo;
|
||||
|
||||
@Schema(description = "生产备注", example = "你猜")
|
||||
private String producerMemo;
|
||||
|
||||
@Schema(description = "订单状态码", example = "1")
|
||||
private Long status;
|
||||
|
||||
@Schema(description = "标志")
|
||||
private Long flag;
|
||||
|
||||
@Schema(description = "预警区域")
|
||||
private String warnArea;
|
||||
|
||||
@Schema(description = "原因", example = "不对")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "订单来源")
|
||||
private String source;
|
||||
|
||||
@Schema(description = "用户下单时间")
|
||||
private LocalDateTime orderedAt;
|
||||
|
||||
@Schema(description = "生产时间")
|
||||
private LocalDateTime producedAt;
|
||||
|
||||
@Schema(description = "发货时间")
|
||||
private LocalDateTime deliveredAt;
|
||||
|
||||
@Schema(description = "激活时间")
|
||||
private LocalDateTime activatedAt;
|
||||
|
||||
@Schema(description = "充值时间")
|
||||
private LocalDateTime rechargedAt;
|
||||
|
||||
@Schema(description = "卖家备注", example = "你猜")
|
||||
private String memo;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private String amount;
|
||||
|
||||
@Schema(description = "状态变更时间")
|
||||
private LocalDateTime statusUpdatedAt;
|
||||
|
||||
@Schema(description = "退款状态", example = "1")
|
||||
private String refundStatus;
|
||||
|
||||
@Schema(description = "激活状态", example = "1")
|
||||
private String activeStatus;
|
||||
|
||||
@Schema(description = "ICCID", example = "2781")
|
||||
private String iccid;
|
||||
|
||||
@Schema(description = "真实外部订单编号", example = "25683")
|
||||
private String realSourceId;
|
||||
|
||||
@Schema(description = "图片大小")
|
||||
private Long picSize;
|
||||
|
||||
@Schema(description = "归属地省")
|
||||
private String regionP;
|
||||
|
||||
@Schema(description = "归属地市")
|
||||
private String regionC;
|
||||
|
||||
@Schema(description = "分销商名称", example = "王五")
|
||||
private String merchantName;
|
||||
|
||||
@Schema(description = "上游状态", example = "2")
|
||||
private String upStatus;
|
||||
|
||||
@Schema(description = "上游订单号", example = "21235")
|
||||
private String upstreamOrderId;
|
||||
|
||||
@Schema(description = "镇/乡")
|
||||
private String town;
|
||||
|
||||
@Schema(description = "物流公司名称")
|
||||
private String trackingCompany;
|
||||
|
||||
@Schema(description = "订单状态名称", example = "王五")
|
||||
private String statusName;
|
||||
|
||||
@Schema(description = "加密收货电话")
|
||||
private String encryptAddressMobile;
|
||||
|
||||
@Schema(description = "加密收货人姓名", example = "赵六")
|
||||
private String encryptAddressName;
|
||||
|
||||
@Schema(description = "加密证件姓名", example = "李四")
|
||||
private String encryptIdCardName;
|
||||
|
||||
@Schema(description = "加密证件号码")
|
||||
private String encryptIdCardNum;
|
||||
|
||||
@Schema(description = "加密详细地址")
|
||||
private String encryptAddress;
|
||||
|
||||
}
|
|
@ -0,0 +1,267 @@
|
|||
package cn.iocoder.yudao.module.haoka.dal.dataobject.orders;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 订单 DO
|
||||
*
|
||||
* @author xiongxiong
|
||||
*/
|
||||
@TableName("haoka_orders")
|
||||
@KeySequence("haoka_orders_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrdersDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 生产商ID
|
||||
*/
|
||||
private Long producerId;
|
||||
/**
|
||||
* 产品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 供应商-商品名称
|
||||
*/
|
||||
private String supplierProductName;
|
||||
/**
|
||||
* 供应商-商品编码SKU
|
||||
*/
|
||||
private String supplierProductSku;
|
||||
/**
|
||||
* 外部订单编号
|
||||
*/
|
||||
private String sourceId;
|
||||
/**
|
||||
* 分享ID
|
||||
*/
|
||||
private Long shareId;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 产品SKU
|
||||
*/
|
||||
private String productSku;
|
||||
/**
|
||||
* 外部SKU
|
||||
*/
|
||||
private String sourceSku;
|
||||
/**
|
||||
* 计划手机号
|
||||
*/
|
||||
private String planMobile;
|
||||
/**
|
||||
* 生产手机号
|
||||
*/
|
||||
private String planMobileProduced;
|
||||
/**
|
||||
* 证件姓名
|
||||
*/
|
||||
private String idCardName;
|
||||
/**
|
||||
* 证件号码
|
||||
*/
|
||||
private String idCardNum;
|
||||
/**
|
||||
* 地址省编码
|
||||
*/
|
||||
private String addressProvinceCode;
|
||||
/**
|
||||
* 地址市编码
|
||||
*/
|
||||
private String addressCityCode;
|
||||
/**
|
||||
* 地址区编码
|
||||
*/
|
||||
private String addressDistrictCode;
|
||||
/**
|
||||
* 地址省
|
||||
*/
|
||||
private String addressProvince;
|
||||
/**
|
||||
* 地址市
|
||||
*/
|
||||
private String addressCity;
|
||||
/**
|
||||
* 地址区
|
||||
*/
|
||||
private String addressDistrict;
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 收件人电话
|
||||
*/
|
||||
private String addressMobile;
|
||||
/**
|
||||
* 收件人姓名
|
||||
*/
|
||||
private String addressName;
|
||||
/**
|
||||
* 物流公司ID
|
||||
*/
|
||||
private Long trackingCompanyId;
|
||||
/**
|
||||
* 物流单号
|
||||
*/
|
||||
private String trackingNumber;
|
||||
/**
|
||||
* 买家备注
|
||||
*/
|
||||
private String buyerMemo;
|
||||
/**
|
||||
* 卖家备注
|
||||
*/
|
||||
private String sellerMemo;
|
||||
/**
|
||||
* 生产备注
|
||||
*/
|
||||
private String producerMemo;
|
||||
/**
|
||||
* 订单状态码
|
||||
*/
|
||||
private Long status;
|
||||
/**
|
||||
* 标志
|
||||
*/
|
||||
private Long flag;
|
||||
/**
|
||||
* 预警区域
|
||||
*/
|
||||
private String warnArea;
|
||||
/**
|
||||
* 原因
|
||||
*/
|
||||
private String reason;
|
||||
/**
|
||||
* 订单来源
|
||||
*/
|
||||
private String source;
|
||||
/**
|
||||
* 用户下单时间
|
||||
*/
|
||||
private LocalDateTime orderedAt;
|
||||
/**
|
||||
* 生产时间
|
||||
*/
|
||||
private LocalDateTime producedAt;
|
||||
/**
|
||||
* 发货时间
|
||||
*/
|
||||
private LocalDateTime deliveredAt;
|
||||
/**
|
||||
* 激活时间
|
||||
*/
|
||||
private LocalDateTime activatedAt;
|
||||
/**
|
||||
* 充值时间
|
||||
*/
|
||||
private LocalDateTime rechargedAt;
|
||||
/**
|
||||
* 卖家备注
|
||||
*/
|
||||
private String memo;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private String amount;
|
||||
/**
|
||||
* 状态变更时间
|
||||
*/
|
||||
private LocalDateTime statusUpdatedAt;
|
||||
/**
|
||||
* 退款状态
|
||||
*/
|
||||
private String refundStatus;
|
||||
/**
|
||||
* 激活状态
|
||||
*/
|
||||
private String activeStatus;
|
||||
/**
|
||||
* ICCID
|
||||
*/
|
||||
private String iccid;
|
||||
/**
|
||||
* 真实外部订单编号
|
||||
*/
|
||||
private String realSourceId;
|
||||
/**
|
||||
* 图片大小
|
||||
*/
|
||||
private Long picSize;
|
||||
/**
|
||||
* 归属地省
|
||||
*/
|
||||
private String regionP;
|
||||
/**
|
||||
* 归属地市
|
||||
*/
|
||||
private String regionC;
|
||||
/**
|
||||
* 分销商名称
|
||||
*/
|
||||
private String merchantName;
|
||||
/**
|
||||
* 上游状态
|
||||
*/
|
||||
private String upStatus;
|
||||
/**
|
||||
* 上游订单号
|
||||
*/
|
||||
private String upstreamOrderId;
|
||||
/**
|
||||
* 镇/乡
|
||||
*/
|
||||
private String town;
|
||||
/**
|
||||
* 物流公司名称
|
||||
*/
|
||||
private String trackingCompany;
|
||||
/**
|
||||
* 订单状态名称
|
||||
*/
|
||||
private String statusName;
|
||||
/**
|
||||
* 加密收货电话
|
||||
*/
|
||||
private String encryptAddressMobile;
|
||||
/**
|
||||
* 加密收货人姓名
|
||||
*/
|
||||
private String encryptAddressName;
|
||||
/**
|
||||
* 加密证件姓名
|
||||
*/
|
||||
private String encryptIdCardName;
|
||||
/**
|
||||
* 加密证件号码
|
||||
*/
|
||||
private String encryptIdCardNum;
|
||||
/**
|
||||
* 加密详细地址
|
||||
*/
|
||||
private String encryptAddress;
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package cn.iocoder.yudao.module.haoka.dal.mysql.orders;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.orders.OrdersDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.orders.vo.*;
|
||||
|
||||
/**
|
||||
* 订单 Mapper
|
||||
*
|
||||
* @author xiongxiong
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrdersMapper extends BaseMapperX<OrdersDO> {
|
||||
|
||||
default PageResult<OrdersDO> selectPage(OrdersPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<OrdersDO>()
|
||||
.likeIfPresent(OrdersDO::getSupplierProductName, reqVO.getSupplierProductName())
|
||||
.eqIfPresent(OrdersDO::getSupplierProductSku, reqVO.getSupplierProductSku())
|
||||
.eqIfPresent(OrdersDO::getSourceId, reqVO.getSourceId())
|
||||
.eqIfPresent(OrdersDO::getProductSku, reqVO.getProductSku())
|
||||
.eqIfPresent(OrdersDO::getSourceSku, reqVO.getSourceSku())
|
||||
.eqIfPresent(OrdersDO::getIdCardNum, reqVO.getIdCardNum())
|
||||
.eqIfPresent(OrdersDO::getAddressMobile, reqVO.getAddressMobile())
|
||||
.eqIfPresent(OrdersDO::getTrackingNumber, reqVO.getTrackingNumber())
|
||||
.eqIfPresent(OrdersDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(OrdersDO::getFlag, reqVO.getFlag())
|
||||
.eqIfPresent(OrdersDO::getSource, reqVO.getSource())
|
||||
.eqIfPresent(OrdersDO::getOrderedAt, reqVO.getOrderedAt())
|
||||
.eqIfPresent(OrdersDO::getProducedAt, reqVO.getProducedAt())
|
||||
.eqIfPresent(OrdersDO::getDeliveredAt, reqVO.getDeliveredAt())
|
||||
.eqIfPresent(OrdersDO::getActivatedAt, reqVO.getActivatedAt())
|
||||
.eqIfPresent(OrdersDO::getRechargedAt, reqVO.getRechargedAt())
|
||||
.eqIfPresent(OrdersDO::getStatusUpdatedAt, reqVO.getStatusUpdatedAt())
|
||||
.eqIfPresent(OrdersDO::getRefundStatus, reqVO.getRefundStatus())
|
||||
.eqIfPresent(OrdersDO::getActiveStatus, reqVO.getActiveStatus())
|
||||
.eqIfPresent(OrdersDO::getIccid, reqVO.getIccid())
|
||||
.eqIfPresent(OrdersDO::getRealSourceId, reqVO.getRealSourceId())
|
||||
.likeIfPresent(OrdersDO::getMerchantName, reqVO.getMerchantName())
|
||||
.eqIfPresent(OrdersDO::getUpStatus, reqVO.getUpStatus())
|
||||
.eqIfPresent(OrdersDO::getUpstreamOrderId, reqVO.getUpstreamOrderId())
|
||||
.likeIfPresent(OrdersDO::getStatusName, reqVO.getStatusName())
|
||||
.orderByDesc(OrdersDO::getId));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.orders;
|
||||
|
||||
import java.util.*;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.orders.vo.*;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.orders.OrdersDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 订单 Service 接口
|
||||
*
|
||||
* @author xiongxiong
|
||||
*/
|
||||
public interface OrdersService {
|
||||
|
||||
/**
|
||||
* 创建订单
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createOrders(@Valid OrdersSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新订单
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateOrders(@Valid OrdersSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除订单
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteOrders(Long id);
|
||||
|
||||
/**
|
||||
* 获得订单
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 订单
|
||||
*/
|
||||
OrdersDO getOrders(Long id);
|
||||
|
||||
/**
|
||||
* 获得订单分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 订单分页
|
||||
*/
|
||||
PageResult<OrdersDO> getOrdersPage(OrdersPageReqVO pageReqVO);
|
||||
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.orders;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.orders.vo.*;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.orders.OrdersDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.haoka.dal.mysql.orders.OrdersMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.haoka.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 订单 Service 实现类
|
||||
*
|
||||
* @author xiongxiong
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class OrdersServiceImpl implements OrdersService {
|
||||
|
||||
@Resource
|
||||
private OrdersMapper ordersMapper;
|
||||
|
||||
@Override
|
||||
public Long createOrders(OrdersSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
OrdersDO orders = BeanUtils.toBean(createReqVO, OrdersDO.class);
|
||||
ordersMapper.insert(orders);
|
||||
// 返回
|
||||
return orders.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOrders(OrdersSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateOrdersExists(updateReqVO.getId());
|
||||
// 更新
|
||||
OrdersDO updateObj = BeanUtils.toBean(updateReqVO, OrdersDO.class);
|
||||
ordersMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOrders(Long id) {
|
||||
// 校验存在
|
||||
validateOrdersExists(id);
|
||||
// 删除
|
||||
ordersMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateOrdersExists(Long id) {
|
||||
if (ordersMapper.selectById(id) == null) {
|
||||
throw exception(ORDERS_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrdersDO getOrders(Long id) {
|
||||
return ordersMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OrdersDO> getOrdersPage(OrdersPageReqVO pageReqVO) {
|
||||
return ordersMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?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.yudao.module.haoka.dal.mysql.orders.OrdersMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,226 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.orders;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.orders.vo.*;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.orders.OrdersDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.mysql.orders.OrdersMapper;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static cn.iocoder.yudao.module.haoka.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link OrdersServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author xiongxiong
|
||||
*/
|
||||
@Import(OrdersServiceImpl.class)
|
||||
public class OrdersServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private OrdersServiceImpl ordersService;
|
||||
|
||||
@Resource
|
||||
private OrdersMapper ordersMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateOrders_success() {
|
||||
// 准备参数
|
||||
OrdersSaveReqVO createReqVO = randomPojo(OrdersSaveReqVO.class).setId(null);
|
||||
|
||||
// 调用
|
||||
Long ordersId = ordersService.createOrders(createReqVO);
|
||||
// 断言
|
||||
assertNotNull(ordersId);
|
||||
// 校验记录的属性是否正确
|
||||
OrdersDO orders = ordersMapper.selectById(ordersId);
|
||||
assertPojoEquals(createReqVO, orders, "id");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateOrders_success() {
|
||||
// mock 数据
|
||||
OrdersDO dbOrders = randomPojo(OrdersDO.class);
|
||||
ordersMapper.insert(dbOrders);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
OrdersSaveReqVO updateReqVO = randomPojo(OrdersSaveReqVO.class, o -> {
|
||||
o.setId(dbOrders.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
ordersService.updateOrders(updateReqVO);
|
||||
// 校验是否更新正确
|
||||
OrdersDO orders = ordersMapper.selectById(updateReqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(updateReqVO, orders);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateOrders_notExists() {
|
||||
// 准备参数
|
||||
OrdersSaveReqVO updateReqVO = randomPojo(OrdersSaveReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> ordersService.updateOrders(updateReqVO), ORDERS_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteOrders_success() {
|
||||
// mock 数据
|
||||
OrdersDO dbOrders = randomPojo(OrdersDO.class);
|
||||
ordersMapper.insert(dbOrders);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbOrders.getId();
|
||||
|
||||
// 调用
|
||||
ordersService.deleteOrders(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(ordersMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteOrders_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> ordersService.deleteOrders(id), ORDERS_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetOrdersPage() {
|
||||
// mock 数据
|
||||
OrdersDO dbOrders = randomPojo(OrdersDO.class, o -> { // 等会查询到
|
||||
o.setSupplierProductName(null);
|
||||
o.setSupplierProductSku(null);
|
||||
o.setSourceId(null);
|
||||
o.setProductSku(null);
|
||||
o.setSourceSku(null);
|
||||
o.setIdCardNum(null);
|
||||
o.setAddressMobile(null);
|
||||
o.setTrackingNumber(null);
|
||||
o.setStatus(null);
|
||||
o.setFlag(null);
|
||||
o.setSource(null);
|
||||
o.setOrderedAt(null);
|
||||
o.setProducedAt(null);
|
||||
o.setDeliveredAt(null);
|
||||
o.setActivatedAt(null);
|
||||
o.setRechargedAt(null);
|
||||
o.setStatusUpdatedAt(null);
|
||||
o.setRefundStatus(null);
|
||||
o.setActiveStatus(null);
|
||||
o.setIccid(null);
|
||||
o.setRealSourceId(null);
|
||||
o.setMerchantName(null);
|
||||
o.setUpStatus(null);
|
||||
o.setUpstreamOrderId(null);
|
||||
o.setStatusName(null);
|
||||
});
|
||||
ordersMapper.insert(dbOrders);
|
||||
// 测试 supplierProductName 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setSupplierProductName(null)));
|
||||
// 测试 supplierProductSku 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setSupplierProductSku(null)));
|
||||
// 测试 sourceId 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setSourceId(null)));
|
||||
// 测试 productSku 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setProductSku(null)));
|
||||
// 测试 sourceSku 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setSourceSku(null)));
|
||||
// 测试 idCardNum 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setIdCardNum(null)));
|
||||
// 测试 addressMobile 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setAddressMobile(null)));
|
||||
// 测试 trackingNumber 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setTrackingNumber(null)));
|
||||
// 测试 status 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setStatus(null)));
|
||||
// 测试 flag 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setFlag(null)));
|
||||
// 测试 source 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setSource(null)));
|
||||
// 测试 orderedAt 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setOrderedAt(null)));
|
||||
// 测试 producedAt 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setProducedAt(null)));
|
||||
// 测试 deliveredAt 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setDeliveredAt(null)));
|
||||
// 测试 activatedAt 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setActivatedAt(null)));
|
||||
// 测试 rechargedAt 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setRechargedAt(null)));
|
||||
// 测试 statusUpdatedAt 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setStatusUpdatedAt(null)));
|
||||
// 测试 refundStatus 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setRefundStatus(null)));
|
||||
// 测试 activeStatus 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setActiveStatus(null)));
|
||||
// 测试 iccid 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setIccid(null)));
|
||||
// 测试 realSourceId 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setRealSourceId(null)));
|
||||
// 测试 merchantName 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setMerchantName(null)));
|
||||
// 测试 upStatus 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setUpStatus(null)));
|
||||
// 测试 upstreamOrderId 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setUpstreamOrderId(null)));
|
||||
// 测试 statusName 不匹配
|
||||
ordersMapper.insert(cloneIgnoreId(dbOrders, o -> o.setStatusName(null)));
|
||||
// 准备参数
|
||||
OrdersPageReqVO reqVO = new OrdersPageReqVO();
|
||||
reqVO.setSupplierProductName(null);
|
||||
reqVO.setSupplierProductSku(null);
|
||||
reqVO.setSourceId(null);
|
||||
reqVO.setProductSku(null);
|
||||
reqVO.setSourceSku(null);
|
||||
reqVO.setIdCardNum(null);
|
||||
reqVO.setAddressMobile(null);
|
||||
reqVO.setTrackingNumber(null);
|
||||
reqVO.setStatus(null);
|
||||
reqVO.setFlag(null);
|
||||
reqVO.setSource(null);
|
||||
reqVO.setOrderedAt(null);
|
||||
reqVO.setProducedAt(null);
|
||||
reqVO.setDeliveredAt(null);
|
||||
reqVO.setActivatedAt(null);
|
||||
reqVO.setRechargedAt(null);
|
||||
reqVO.setStatusUpdatedAt(null);
|
||||
reqVO.setRefundStatus(null);
|
||||
reqVO.setActiveStatus(null);
|
||||
reqVO.setIccid(null);
|
||||
reqVO.setRealSourceId(null);
|
||||
reqVO.setMerchantName(null);
|
||||
reqVO.setUpStatus(null);
|
||||
reqVO.setUpstreamOrderId(null);
|
||||
reqVO.setStatusName(null);
|
||||
|
||||
// 调用
|
||||
PageResult<OrdersDO> pageResult = ordersService.getOrdersPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbOrders, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
-- 将该建表 SQL 语句,添加到 yudao-module-haoka-biz 模块的 test/resources/sql/create_tables.sql 文件里
|
||||
CREATE TABLE IF NOT EXISTS "haoka_orders" (
|
||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||
"producer_id" bigint,
|
||||
"product_id" bigint,
|
||||
"supplier_product_name" varchar,
|
||||
"supplier_product_sku" varchar,
|
||||
"source_id" varchar,
|
||||
"share_id" bigint,
|
||||
"user_id" bigint,
|
||||
"product_sku" varchar,
|
||||
"source_sku" varchar,
|
||||
"plan_mobile" varchar,
|
||||
"plan_mobile_produced" varchar,
|
||||
"id_card_name" varchar,
|
||||
"id_card_num" varchar,
|
||||
"address_province_code" varchar,
|
||||
"address_city_code" varchar,
|
||||
"address_district_code" varchar,
|
||||
"address_province" varchar,
|
||||
"address_city" varchar,
|
||||
"address_district" varchar,
|
||||
"address" varchar,
|
||||
"address_mobile" varchar,
|
||||
"address_name" varchar,
|
||||
"tracking_company_id" bigint,
|
||||
"tracking_number" varchar,
|
||||
"buyer_memo" varchar,
|
||||
"seller_memo" varchar,
|
||||
"producer_memo" varchar,
|
||||
"status" bigint,
|
||||
"flag" bigint,
|
||||
"warn_area" varchar,
|
||||
"reason" varchar,
|
||||
"source" varchar,
|
||||
"ordered_at" varchar,
|
||||
"produced_at" varchar,
|
||||
"delivered_at" varchar,
|
||||
"activated_at" varchar,
|
||||
"recharged_at" varchar,
|
||||
"memo" varchar,
|
||||
"amount" varchar,
|
||||
"status_updated_at" varchar,
|
||||
"refund_status" varchar,
|
||||
"active_status" varchar,
|
||||
"iccid" varchar,
|
||||
"real_source_id" varchar,
|
||||
"pic_size" bigint,
|
||||
"region_p" varchar,
|
||||
"region_c" varchar,
|
||||
"merchant_name" varchar,
|
||||
"up_status" varchar,
|
||||
"upstream_order_id" varchar,
|
||||
"town" varchar,
|
||||
"tracking_company" varchar,
|
||||
"status_name" varchar,
|
||||
"encrypt_address_mobile" varchar,
|
||||
"encrypt_address_name" varchar,
|
||||
"encrypt_id_card_name" varchar,
|
||||
"encrypt_id_card_num" varchar,
|
||||
"encrypt_address" varchar,
|
||||
PRIMARY KEY ("id")
|
||||
) COMMENT '订单表';
|
||||
|
||||
-- 将该删表 SQL 语句,添加到 yudao-module-haoka-biz 模块的 test/resources/sql/clean.sql 文件里
|
||||
DELETE FROM "haoka_orders";
|
|
@ -0,0 +1,55 @@
|
|||
-- 菜单 SQL
|
||||
INSERT INTO system_menu(
|
||||
name, permission, type, sort, parent_id,
|
||||
path, icon, component, status, component_name
|
||||
)
|
||||
VALUES (
|
||||
'订单管理', '', 2, 0, 2912,
|
||||
'orders', '', 'haoka/orders/index', 0, 'Orders'
|
||||
);
|
||||
|
||||
-- 按钮父菜单ID
|
||||
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
|
||||
SELECT @parentId := LAST_INSERT_ID();
|
||||
|
||||
-- 按钮 SQL
|
||||
INSERT INTO system_menu(
|
||||
name, permission, type, sort, parent_id,
|
||||
path, icon, component, status
|
||||
)
|
||||
VALUES (
|
||||
'订单查询', 'haoka:orders:query', 3, 1, @parentId,
|
||||
'', '', '', 0
|
||||
);
|
||||
INSERT INTO system_menu(
|
||||
name, permission, type, sort, parent_id,
|
||||
path, icon, component, status
|
||||
)
|
||||
VALUES (
|
||||
'订单创建', 'haoka:orders:create', 3, 2, @parentId,
|
||||
'', '', '', 0
|
||||
);
|
||||
INSERT INTO system_menu(
|
||||
name, permission, type, sort, parent_id,
|
||||
path, icon, component, status
|
||||
)
|
||||
VALUES (
|
||||
'订单更新', 'haoka:orders:update', 3, 3, @parentId,
|
||||
'', '', '', 0
|
||||
);
|
||||
INSERT INTO system_menu(
|
||||
name, permission, type, sort, parent_id,
|
||||
path, icon, component, status
|
||||
)
|
||||
VALUES (
|
||||
'订单删除', 'haoka:orders:delete', 3, 4, @parentId,
|
||||
'', '', '', 0
|
||||
);
|
||||
INSERT INTO system_menu(
|
||||
name, permission, type, sort, parent_id,
|
||||
path, icon, component, status
|
||||
)
|
||||
VALUES (
|
||||
'订单导出', 'haoka:orders:export', 3, 5, @parentId,
|
||||
'', '', '', 0
|
||||
);
|
Loading…
Reference in New Issue