完成支付、电子面单、模板消息队列等功能
This commit is contained in:
BIN
yshop-module-express/yshop-module-express-biz/.DS_Store
vendored
Normal file
BIN
yshop-module-express/yshop-module-express-biz/.DS_Store
vendored
Normal file
Binary file not shown.
72
yshop-module-express/yshop-module-express-biz/pom.xml
Normal file
72
yshop-module-express/yshop-module-express-biz/pom.xml
Normal file
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>yshop-module-express</artifactId>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>yshop-module-express-biz</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
快递 模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-module-express-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-biz-operatelog</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-biz-tenant</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- 消息队列相关 -->
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-mq</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Test 测试相关 -->
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
BIN
yshop-module-express/yshop-module-express-biz/src/.DS_Store
vendored
Normal file
BIN
yshop-module-express/yshop-module-express-biz/src/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
yshop-module-express/yshop-module-express-biz/src/main/.DS_Store
vendored
Normal file
BIN
yshop-module-express/yshop-module-express-biz/src/main/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
yshop-module-express/yshop-module-express-biz/src/main/java/.DS_Store
vendored
Normal file
BIN
yshop-module-express/yshop-module-express-biz/src/main/java/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
yshop-module-express/yshop-module-express-biz/src/main/java/co/.DS_Store
vendored
Normal file
BIN
yshop-module-express/yshop-module-express-biz/src/main/java/co/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
yshop-module-express/yshop-module-express-biz/src/main/java/co/yixiang/.DS_Store
vendored
Normal file
BIN
yshop-module-express/yshop-module-express-biz/src/main/java/co/yixiang/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
yshop-module-express/yshop-module-express-biz/src/main/java/co/yixiang/yshop/.DS_Store
vendored
Normal file
BIN
yshop-module-express/yshop-module-express-biz/src/main/java/co/yixiang/yshop/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
yshop-module-express/yshop-module-express-biz/src/main/java/co/yixiang/yshop/module/.DS_Store
vendored
Normal file
BIN
yshop-module-express/yshop-module-express-biz/src/main/java/co/yixiang/yshop/module/.DS_Store
vendored
Normal file
Binary file not shown.
@ -0,0 +1,101 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.electronicsorder;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.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 javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import co.yixiang.yshop.module.express.controller.admin.electronicsorder.vo.*;
|
||||
import co.yixiang.yshop.module.express.dal.dataobject.electronicsorder.ElectronicsOrderDO;
|
||||
import co.yixiang.yshop.module.express.convert.electronicsorder.ElectronicsOrderConvert;
|
||||
import co.yixiang.yshop.module.express.service.electronicsorder.ElectronicsOrderService;
|
||||
|
||||
@Tag(name = "管理后台 - 电子面单")
|
||||
@RestController
|
||||
@RequestMapping("/express/electronics-order")
|
||||
@Validated
|
||||
public class ElectronicsOrderController {
|
||||
|
||||
@Resource
|
||||
private ElectronicsOrderService electronicsOrderService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建电子面单")
|
||||
@PreAuthorize("@ss.hasPermission('express:electronics-order:create')")
|
||||
public CommonResult<Long> createElectronicsOrder(@Valid @RequestBody ElectronicsOrderCreateReqVO createReqVO) {
|
||||
return success(electronicsOrderService.createElectronicsOrder(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新电子面单")
|
||||
@PreAuthorize("@ss.hasPermission('express:electronics-order:update')")
|
||||
public CommonResult<Boolean> updateElectronicsOrder(@Valid @RequestBody ElectronicsOrderUpdateReqVO updateReqVO) {
|
||||
electronicsOrderService.updateElectronicsOrder(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除电子面单")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('express:electronics-order:delete')")
|
||||
public CommonResult<Boolean> deleteElectronicsOrder(@RequestParam("id") Long id) {
|
||||
electronicsOrderService.deleteElectronicsOrder(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得电子面单")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('express:electronics-order:query')")
|
||||
public CommonResult<ElectronicsOrderRespVO> getElectronicsOrder(@RequestParam("id") Long id) {
|
||||
ElectronicsOrderDO electronicsOrder = electronicsOrderService.getElectronicsOrder(id);
|
||||
return success(ElectronicsOrderConvert.INSTANCE.convert(electronicsOrder));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得电子面单列表")
|
||||
@PreAuthorize("@ss.hasPermission('express:electronics-order:query')")
|
||||
public CommonResult<List<ElectronicsOrderRespVO>> getElectronicsOrderList() {
|
||||
List<ElectronicsOrderDO> list = electronicsOrderService.getElectronicsOrderList();
|
||||
return success(ElectronicsOrderConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得电子面单分页")
|
||||
@PreAuthorize("@ss.hasPermission('express:electronics-order:query')")
|
||||
public CommonResult<PageResult<ElectronicsOrderRespVO>> getElectronicsOrderPage(@Valid ElectronicsOrderPageReqVO pageVO) {
|
||||
PageResult<ElectronicsOrderDO> pageResult = electronicsOrderService.getElectronicsOrderPage(pageVO);
|
||||
return success(ElectronicsOrderConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出电子面单 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('express:electronics-order:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportElectronicsOrderExcel(@Valid ElectronicsOrderExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<ElectronicsOrderDO> list = electronicsOrderService.getElectronicsOrderList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<ElectronicsOrderExcelVO> datas = ElectronicsOrderConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "电子面单.xls", "数据", ElectronicsOrderExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.electronicsorder.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 电子面单 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class ElectronicsOrderBaseVO {
|
||||
|
||||
@Schema(description = "快递公司id", example = "13715")
|
||||
private Integer shipperId;
|
||||
|
||||
@Schema(description = "运费支付方式:1=现付,2=到付,3=月结,4=第三方付(仅SF支持)", example = "2")
|
||||
private Integer paytype;
|
||||
|
||||
@Schema(description = "线下网点客户号", example = "张三")
|
||||
private String customerName;
|
||||
|
||||
@Schema(description = "线下网点密码")
|
||||
private String customerPwd;
|
||||
|
||||
@Schema(description = "网点名称")
|
||||
private String sendSite;
|
||||
|
||||
@Schema(description = "网点快递员")
|
||||
private String sendStaff;
|
||||
|
||||
@Schema(description = "月结编号")
|
||||
private String monthCode;
|
||||
|
||||
@Schema(description = "是否通知揽件:0=通知揽件,1=不通知揽件")
|
||||
private Integer isNotice;
|
||||
|
||||
@Schema(description = "是否返回电子面单模板:0=不返回,1=返回")
|
||||
private Integer isReturnTemp;
|
||||
|
||||
@Schema(description = "是否需要短信提醒:0=否,1=是")
|
||||
private Integer isSendMessage;
|
||||
|
||||
@Schema(description = "模板尺寸")
|
||||
private String templateSize;
|
||||
|
||||
@Schema(description = "签回单操作要求(如:签名、盖章、身份证复印件等)")
|
||||
private String operateRequire;
|
||||
|
||||
@Schema(description = "快递单号(仅宅急送可用)")
|
||||
private String logisticCode;
|
||||
|
||||
@Schema(description = "上门揽件开始时间")
|
||||
private Integer startDate;
|
||||
|
||||
@Schema(description = "上门揽件结束时间")
|
||||
private Integer endDate;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "快递类型:1=标准快件", example = "1")
|
||||
private Integer expType;
|
||||
|
||||
@Schema(description = "是否要签回单:0=否,1=是")
|
||||
private Integer isReturnSignBill;
|
||||
|
||||
@Schema(description = "发件人公司")
|
||||
private String company;
|
||||
|
||||
@Schema(description = "发件人省", example = "李四")
|
||||
private String provinceName;
|
||||
|
||||
@Schema(description = "发件人市", example = "张三")
|
||||
private String cityName;
|
||||
|
||||
@Schema(description = "发件人区", example = "张三")
|
||||
private String expAreaName;
|
||||
|
||||
@Schema(description = "发件人详细地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "发件人姓名", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "发件人电话")
|
||||
private String tel;
|
||||
|
||||
@Schema(description = "发件人手机号码")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "发件地邮编")
|
||||
private String postCode;
|
||||
|
||||
@Schema(description = "自定义名称")
|
||||
private String title;
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.electronicsorder.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 电子面单创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ElectronicsOrderCreateReqVO extends ElectronicsOrderBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.electronicsorder.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 电子面单 Excel VO
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Data
|
||||
public class ElectronicsOrderExcelVO {
|
||||
|
||||
@ExcelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("快递公司id")
|
||||
private Integer shipperId;
|
||||
|
||||
@ExcelProperty("运费支付方式:1=现付,2=到付,3=月结,4=第三方付(仅SF支持)")
|
||||
private Integer paytype;
|
||||
|
||||
@ExcelProperty("线下网点客户号")
|
||||
private String customerName;
|
||||
|
||||
@ExcelProperty("线下网点密码")
|
||||
private String customerPwd;
|
||||
|
||||
@ExcelProperty("网点名称")
|
||||
private String sendSite;
|
||||
|
||||
@ExcelProperty("网点快递员")
|
||||
private String sendStaff;
|
||||
|
||||
@ExcelProperty("月结编号")
|
||||
private String monthCode;
|
||||
|
||||
@ExcelProperty("是否通知揽件:0=通知揽件,1=不通知揽件")
|
||||
private Integer isNotice;
|
||||
|
||||
@ExcelProperty("是否返回电子面单模板:0=不返回,1=返回")
|
||||
private Integer isReturnTemp;
|
||||
|
||||
@ExcelProperty("是否需要短信提醒:0=否,1=是")
|
||||
private Integer isSendMessage;
|
||||
|
||||
@ExcelProperty("模板尺寸")
|
||||
private String templateSize;
|
||||
|
||||
@ExcelProperty("签回单操作要求(如:签名、盖章、身份证复印件等)")
|
||||
private String operateRequire;
|
||||
|
||||
@ExcelProperty("快递单号(仅宅急送可用)")
|
||||
private String logisticCode;
|
||||
|
||||
@ExcelProperty("上门揽件开始时间")
|
||||
private Integer startDate;
|
||||
|
||||
@ExcelProperty("上门揽件结束时间")
|
||||
private Integer endDate;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("快递类型:1=标准快件")
|
||||
private Integer expType;
|
||||
|
||||
@ExcelProperty("是否要签回单:0=否,1=是")
|
||||
private Integer isReturnSignBill;
|
||||
|
||||
@ExcelProperty("发件人公司")
|
||||
private String company;
|
||||
|
||||
@ExcelProperty("发件人省")
|
||||
private String provinceName;
|
||||
|
||||
@ExcelProperty("发件人市")
|
||||
private String cityName;
|
||||
|
||||
@ExcelProperty("发件人区")
|
||||
private String expAreaName;
|
||||
|
||||
@ExcelProperty("发件人详细地址")
|
||||
private String address;
|
||||
|
||||
@ExcelProperty("发件人姓名")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("发件人电话")
|
||||
private String tel;
|
||||
|
||||
@ExcelProperty("发件人手机号码")
|
||||
private String mobile;
|
||||
|
||||
@ExcelProperty("发件地邮编")
|
||||
private String postCode;
|
||||
|
||||
@ExcelProperty("自定义名称")
|
||||
private String title;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.electronicsorder.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 电子面单 Excel 导出 Request VO,参数和 ElectronicsOrderPageReqVO 是一致的")
|
||||
@Data
|
||||
public class ElectronicsOrderExportReqVO {
|
||||
|
||||
@Schema(description = "快递公司id", example = "13715")
|
||||
private Integer shipperId;
|
||||
|
||||
@Schema(description = "运费支付方式:1=现付,2=到付,3=月结,4=第三方付(仅SF支持)", example = "2")
|
||||
private Integer paytype;
|
||||
|
||||
@Schema(description = "线下网点客户号", example = "张三")
|
||||
private String customerName;
|
||||
|
||||
@Schema(description = "线下网点密码")
|
||||
private String customerPwd;
|
||||
|
||||
@Schema(description = "网点名称")
|
||||
private String sendSite;
|
||||
|
||||
@Schema(description = "网点快递员")
|
||||
private String sendStaff;
|
||||
|
||||
@Schema(description = "月结编号")
|
||||
private String monthCode;
|
||||
|
||||
@Schema(description = "是否通知揽件:0=通知揽件,1=不通知揽件")
|
||||
private Integer isNotice;
|
||||
|
||||
@Schema(description = "是否返回电子面单模板:0=不返回,1=返回")
|
||||
private Integer isReturnTemp;
|
||||
|
||||
@Schema(description = "是否需要短信提醒:0=否,1=是")
|
||||
private Integer isSendMessage;
|
||||
|
||||
@Schema(description = "模板尺寸")
|
||||
private String templateSize;
|
||||
|
||||
@Schema(description = "签回单操作要求(如:签名、盖章、身份证复印件等)")
|
||||
private String operateRequire;
|
||||
|
||||
@Schema(description = "快递单号(仅宅急送可用)")
|
||||
private String logisticCode;
|
||||
|
||||
@Schema(description = "上门揽件开始时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Integer[] startDate;
|
||||
|
||||
@Schema(description = "上门揽件结束时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Integer[] endDate;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "快递类型:1=标准快件", example = "1")
|
||||
private Integer expType;
|
||||
|
||||
@Schema(description = "是否要签回单:0=否,1=是")
|
||||
private Integer isReturnSignBill;
|
||||
|
||||
@Schema(description = "发件人公司")
|
||||
private String company;
|
||||
|
||||
@Schema(description = "发件人省", example = "李四")
|
||||
private String provinceName;
|
||||
|
||||
@Schema(description = "发件人市", example = "张三")
|
||||
private String cityName;
|
||||
|
||||
@Schema(description = "发件人区", example = "张三")
|
||||
private String expAreaName;
|
||||
|
||||
@Schema(description = "发件人详细地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "发件人姓名", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "发件人电话")
|
||||
private String tel;
|
||||
|
||||
@Schema(description = "发件人手机号码")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "发件地邮编")
|
||||
private String postCode;
|
||||
|
||||
@Schema(description = "自定义名称")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.electronicsorder.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static co.yixiang.yshop.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 ElectronicsOrderPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "快递公司id", example = "13715")
|
||||
private Integer shipperId;
|
||||
|
||||
@Schema(description = "运费支付方式:1=现付,2=到付,3=月结,4=第三方付(仅SF支持)", example = "2")
|
||||
private Integer paytype;
|
||||
|
||||
@Schema(description = "线下网点客户号", example = "张三")
|
||||
private String customerName;
|
||||
|
||||
@Schema(description = "线下网点密码")
|
||||
private String customerPwd;
|
||||
|
||||
@Schema(description = "网点名称")
|
||||
private String sendSite;
|
||||
|
||||
@Schema(description = "网点快递员")
|
||||
private String sendStaff;
|
||||
|
||||
@Schema(description = "月结编号")
|
||||
private String monthCode;
|
||||
|
||||
@Schema(description = "是否通知揽件:0=通知揽件,1=不通知揽件")
|
||||
private Integer isNotice;
|
||||
|
||||
@Schema(description = "是否返回电子面单模板:0=不返回,1=返回")
|
||||
private Integer isReturnTemp;
|
||||
|
||||
@Schema(description = "是否需要短信提醒:0=否,1=是")
|
||||
private Integer isSendMessage;
|
||||
|
||||
@Schema(description = "模板尺寸")
|
||||
private String templateSize;
|
||||
|
||||
@Schema(description = "签回单操作要求(如:签名、盖章、身份证复印件等)")
|
||||
private String operateRequire;
|
||||
|
||||
@Schema(description = "快递单号(仅宅急送可用)")
|
||||
private String logisticCode;
|
||||
|
||||
@Schema(description = "上门揽件开始时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Integer[] startDate;
|
||||
|
||||
@Schema(description = "上门揽件结束时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Integer[] endDate;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "快递类型:1=标准快件", example = "1")
|
||||
private Integer expType;
|
||||
|
||||
@Schema(description = "是否要签回单:0=否,1=是")
|
||||
private Integer isReturnSignBill;
|
||||
|
||||
@Schema(description = "发件人公司")
|
||||
private String company;
|
||||
|
||||
@Schema(description = "发件人省", example = "李四")
|
||||
private String provinceName;
|
||||
|
||||
@Schema(description = "发件人市", example = "张三")
|
||||
private String cityName;
|
||||
|
||||
@Schema(description = "发件人区", example = "张三")
|
||||
private String expAreaName;
|
||||
|
||||
@Schema(description = "发件人详细地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "发件人姓名", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "发件人电话")
|
||||
private String tel;
|
||||
|
||||
@Schema(description = "发件人手机号码")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "发件地邮编")
|
||||
private String postCode;
|
||||
|
||||
@Schema(description = "自定义名称")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.electronicsorder.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 电子面单 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ElectronicsOrderRespVO extends ElectronicsOrderBaseVO {
|
||||
|
||||
@Schema(description = "主键id", required = true, example = "4751")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.electronicsorder.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 电子面单更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ElectronicsOrderUpdateReqVO extends ElectronicsOrderBaseVO {
|
||||
|
||||
@Schema(description = "主键id", required = true, example = "4751")
|
||||
@NotNull(message = "主键id不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.express;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.*;
|
||||
import co.yixiang.yshop.module.express.convert.express.ExpressConvert;
|
||||
import co.yixiang.yshop.module.express.dal.dataobject.express.ExpressDO;
|
||||
import co.yixiang.yshop.module.express.dal.redis.express.ExpressRedisDAO;
|
||||
import co.yixiang.yshop.module.express.kdniao.model.dto.KdniaoApiBaseDTO;
|
||||
import co.yixiang.yshop.module.express.kdniao.model.dto.KdniaoApiDTO;
|
||||
import co.yixiang.yshop.module.express.kdniao.model.vo.KdniaoApiVO;
|
||||
import co.yixiang.yshop.module.express.kdniao.util.KdniaoUtil;
|
||||
import co.yixiang.yshop.module.express.service.express.ExpressService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 快递公司")
|
||||
@RestController
|
||||
@RequestMapping("/order/express")
|
||||
@Validated
|
||||
public class ExpressController {
|
||||
|
||||
@Resource
|
||||
private ExpressService expressService;
|
||||
@Resource
|
||||
private ExpressRedisDAO expressRedisDAO;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建快递公司")
|
||||
@PreAuthorize("@ss.hasPermission('order:express:create')")
|
||||
public CommonResult<Integer> createExpress(@Valid @RequestBody ExpressCreateReqVO createReqVO) {
|
||||
return success(expressService.createExpress(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新快递公司")
|
||||
@PreAuthorize("@ss.hasPermission('order:express:update')")
|
||||
public CommonResult<Boolean> updateExpress(@Valid @RequestBody ExpressUpdateReqVO updateReqVO) {
|
||||
expressService.updateExpress(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除快递公司")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('order:express:delete')")
|
||||
public CommonResult<Boolean> deleteExpress(@RequestParam("id") Integer id) {
|
||||
expressService.deleteExpress(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得快递公司")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('order:express:query')")
|
||||
public CommonResult<ExpressRespVO> getExpress(@RequestParam("id") Integer id) {
|
||||
ExpressDO express = expressService.getExpress(id);
|
||||
return success(ExpressConvert.INSTANCE.convert(express));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得快递公司列表")
|
||||
@PreAuthorize("@ss.hasPermission('order:express:query')")
|
||||
public CommonResult<List<ExpressRespVO>> getExpressList() {
|
||||
List<ExpressDO> list = expressService.getExpressList();
|
||||
return success(ExpressConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得快递公司分页")
|
||||
@PreAuthorize("@ss.hasPermission('order:express:query')")
|
||||
public CommonResult<PageResult<ExpressRespVO>> getExpressPage(@Valid ExpressPageReqVO pageVO) {
|
||||
PageResult<ExpressDO> pageResult = expressService.getExpressPage(pageVO);
|
||||
return success(ExpressConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出快递公司 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('order:express:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportExpressExcel(@Valid ExpressExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<ExpressDO> list = expressService.getExpressList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<ExpressExcelVO> datas = ExpressConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "快递公司.xls", "数据", ExpressExcelVO.class, datas);
|
||||
}
|
||||
|
||||
@GetMapping("/set")
|
||||
@Operation(summary = "获得快递鸟配置")
|
||||
public CommonResult<KdniaoApiBaseDTO> getExpressSet() {
|
||||
return success(expressRedisDAO.get());
|
||||
}
|
||||
|
||||
@PostMapping("/set")
|
||||
@Operation(summary = "获得快递鸟配置")
|
||||
public CommonResult<Boolean> postExpressSet(@RequestBody KdniaoApiBaseDTO kdniaoApiBaseDTO) {
|
||||
expressRedisDAO.set(kdniaoApiBaseDTO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/getLogistic")
|
||||
@Parameters({
|
||||
@Parameter(name = "shipperCode", description = "快递公司编码", required = true),
|
||||
@Parameter(name = "logisticCode", description = "快递单号", required = true),
|
||||
})
|
||||
@Operation(summary = "查询物流")
|
||||
public CommonResult<KdniaoApiVO> getLogistic(@RequestParam(value = "shipperCode") String shipperCode,
|
||||
@RequestParam("logisticCode") String logisticCode) {
|
||||
KdniaoApiBaseDTO kdniaoApiBaseDTO = expressRedisDAO.get();
|
||||
KdniaoApiDTO params = new KdniaoApiDTO();
|
||||
params.setLogisticCode(logisticCode);
|
||||
params.setShipperCode(shipperCode);
|
||||
params.setApiKey(kdniaoApiBaseDTO.getApiKey());
|
||||
params.setEBusinessID(kdniaoApiBaseDTO.getEBusinessID());
|
||||
//此处注意 这个地方分收费与免费当 目前用当免费免费当只支持圆通 申通 百世 如果是收费当 改里面RequestType参数 函数里有说明
|
||||
return success(KdniaoUtil.getLogisticInfo(params));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.express.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 快递公司 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class ExpressBaseVO {
|
||||
|
||||
@Schema(description = "快递公司简称", required = true)
|
||||
@NotNull(message = "快递公司简称不能为空")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "快递公司全称", required = true, example = "yshop")
|
||||
@NotNull(message = "快递公司全称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "排序", required = true)
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.express.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 快递公司创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ExpressCreateReqVO extends ExpressBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.express.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 快递公司 Excel VO
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Data
|
||||
public class ExpressExcelVO {
|
||||
|
||||
@ExcelProperty("快递公司id")
|
||||
private Integer id;
|
||||
|
||||
@ExcelProperty("快递公司简称")
|
||||
private String code;
|
||||
|
||||
@ExcelProperty("快递公司全称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
@ExcelProperty("添加时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.express.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 快递公司 Excel 导出 Request VO,参数和 ExpressPageReqVO 是一致的")
|
||||
@Data
|
||||
public class ExpressExportReqVO {
|
||||
|
||||
@Schema(description = "快递公司简称")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "快递公司全称", example = "yshop")
|
||||
private String name;
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.express.vo;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 快递公司分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ExpressPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "快递公司简称")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "快递公司全称", example = "yshop")
|
||||
private String name;
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.express.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 快递公司 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ExpressRespVO extends ExpressBaseVO {
|
||||
|
||||
@Schema(description = "快递公司id", required = true, example = "27172")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "添加时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package co.yixiang.yshop.module.express.controller.admin.express.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 快递公司更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ExpressUpdateReqVO extends ExpressBaseVO {
|
||||
|
||||
@Schema(description = "快递公司id", required = true, example = "27172")
|
||||
@NotNull(message = "快递公司id不能为空")
|
||||
private Integer id;
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package co.yixiang.yshop.module.express.convert.electronicsorder;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import co.yixiang.yshop.module.express.controller.admin.electronicsorder.vo.*;
|
||||
import co.yixiang.yshop.module.express.dal.dataobject.electronicsorder.ElectronicsOrderDO;
|
||||
|
||||
/**
|
||||
* 电子面单 Convert
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Mapper
|
||||
public interface ElectronicsOrderConvert {
|
||||
|
||||
ElectronicsOrderConvert INSTANCE = Mappers.getMapper(ElectronicsOrderConvert.class);
|
||||
|
||||
ElectronicsOrderDO convert(ElectronicsOrderCreateReqVO bean);
|
||||
|
||||
ElectronicsOrderDO convert(ElectronicsOrderUpdateReqVO bean);
|
||||
|
||||
ElectronicsOrderRespVO convert(ElectronicsOrderDO bean);
|
||||
|
||||
List<ElectronicsOrderRespVO> convertList(List<ElectronicsOrderDO> list);
|
||||
|
||||
PageResult<ElectronicsOrderRespVO> convertPage(PageResult<ElectronicsOrderDO> page);
|
||||
|
||||
List<ElectronicsOrderExcelVO> convertList02(List<ElectronicsOrderDO> list);
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package co.yixiang.yshop.module.express.convert.express;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressCreateReqVO;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressExcelVO;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressRespVO;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressUpdateReqVO;
|
||||
import co.yixiang.yshop.module.express.dal.dataobject.express.ExpressDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 快递公司 Convert
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExpressConvert {
|
||||
|
||||
ExpressConvert INSTANCE = Mappers.getMapper(ExpressConvert.class);
|
||||
|
||||
ExpressDO convert(ExpressCreateReqVO bean);
|
||||
|
||||
ExpressDO convert(ExpressUpdateReqVO bean);
|
||||
|
||||
ExpressRespVO convert(ExpressDO bean);
|
||||
|
||||
List<ExpressRespVO> convertList(List<ExpressDO> list);
|
||||
|
||||
PageResult<ExpressRespVO> convertPage(PageResult<ExpressDO> page);
|
||||
|
||||
List<ExpressExcelVO> convertList02(List<ExpressDO> list);
|
||||
|
||||
}
|
@ -0,0 +1,143 @@
|
||||
package co.yixiang.yshop.module.express.dal.dataobject.electronicsorder;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import co.yixiang.yshop.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 电子面单 DO
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@TableName("yshop_electronics_order")
|
||||
@KeySequence("yshop_electronics_order_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ElectronicsOrderDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 快递公司id
|
||||
*/
|
||||
private Integer shipperId;
|
||||
/**
|
||||
* 运费支付方式:1=现付,2=到付,3=月结,4=第三方付(仅SF支持)
|
||||
*/
|
||||
private Integer paytype;
|
||||
/**
|
||||
* 线下网点客户号
|
||||
*/
|
||||
private String customerName;
|
||||
/**
|
||||
* 线下网点密码
|
||||
*/
|
||||
private String customerPwd;
|
||||
/**
|
||||
* 网点名称
|
||||
*/
|
||||
private String sendSite;
|
||||
/**
|
||||
* 网点快递员
|
||||
*/
|
||||
private String sendStaff;
|
||||
/**
|
||||
* 月结编号
|
||||
*/
|
||||
private String monthCode;
|
||||
/**
|
||||
* 是否通知揽件:0=通知揽件,1=不通知揽件
|
||||
*/
|
||||
private Integer isNotice;
|
||||
/**
|
||||
* 是否返回电子面单模板:0=不返回,1=返回
|
||||
*/
|
||||
private Integer isReturnTemp;
|
||||
/**
|
||||
* 是否需要短信提醒:0=否,1=是
|
||||
*/
|
||||
private Integer isSendMessage;
|
||||
/**
|
||||
* 模板尺寸
|
||||
*/
|
||||
private String templateSize;
|
||||
/**
|
||||
* 签回单操作要求(如:签名、盖章、身份证复印件等)
|
||||
*/
|
||||
private String operateRequire;
|
||||
/**
|
||||
* 快递单号(仅宅急送可用)
|
||||
*/
|
||||
private String logisticCode;
|
||||
/**
|
||||
* 上门揽件开始时间
|
||||
*/
|
||||
private Integer startDate;
|
||||
/**
|
||||
* 上门揽件结束时间
|
||||
*/
|
||||
private Integer endDate;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 快递类型:1=标准快件
|
||||
*/
|
||||
private Integer expType;
|
||||
/**
|
||||
* 是否要签回单:0=否,1=是
|
||||
*/
|
||||
private Integer isReturnSignBill;
|
||||
/**
|
||||
* 发件人公司
|
||||
*/
|
||||
private String company;
|
||||
/**
|
||||
* 发件人省
|
||||
*/
|
||||
private String provinceName;
|
||||
/**
|
||||
* 发件人市
|
||||
*/
|
||||
private String cityName;
|
||||
/**
|
||||
* 发件人区
|
||||
*/
|
||||
private String expAreaName;
|
||||
/**
|
||||
* 发件人详细地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 发件人姓名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 发件人电话
|
||||
*/
|
||||
private String tel;
|
||||
/**
|
||||
* 发件人手机号码
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 发件地邮编
|
||||
*/
|
||||
private String postCode;
|
||||
/**
|
||||
* 自定义名称
|
||||
*/
|
||||
private String title;
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package co.yixiang.yshop.module.express.dal.dataobject.express;
|
||||
|
||||
import co.yixiang.yshop.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 快递公司 DO
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@TableName("yshop_express")
|
||||
@KeySequence("yshop_express_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ExpressDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 快递公司id
|
||||
*/
|
||||
@TableId
|
||||
private Integer id;
|
||||
/**
|
||||
* 快递公司简称
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 快递公司全称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package co.yixiang.yshop.module.express.dal.mysql.electronicsorder;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import co.yixiang.yshop.module.express.dal.dataobject.electronicsorder.ElectronicsOrderDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import co.yixiang.yshop.module.express.controller.admin.electronicsorder.vo.*;
|
||||
|
||||
/**
|
||||
* 电子面单 Mapper
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Mapper
|
||||
public interface ElectronicsOrderMapper extends BaseMapperX<ElectronicsOrderDO> {
|
||||
|
||||
default PageResult<ElectronicsOrderDO> selectPage(ElectronicsOrderPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ElectronicsOrderDO>()
|
||||
.eqIfPresent(ElectronicsOrderDO::getShipperId, reqVO.getShipperId())
|
||||
.eqIfPresent(ElectronicsOrderDO::getPaytype, reqVO.getPaytype())
|
||||
.likeIfPresent(ElectronicsOrderDO::getCustomerName, reqVO.getCustomerName())
|
||||
.eqIfPresent(ElectronicsOrderDO::getCustomerPwd, reqVO.getCustomerPwd())
|
||||
.eqIfPresent(ElectronicsOrderDO::getSendSite, reqVO.getSendSite())
|
||||
.eqIfPresent(ElectronicsOrderDO::getSendStaff, reqVO.getSendStaff())
|
||||
.eqIfPresent(ElectronicsOrderDO::getMonthCode, reqVO.getMonthCode())
|
||||
.eqIfPresent(ElectronicsOrderDO::getIsNotice, reqVO.getIsNotice())
|
||||
.eqIfPresent(ElectronicsOrderDO::getIsReturnTemp, reqVO.getIsReturnTemp())
|
||||
.eqIfPresent(ElectronicsOrderDO::getIsSendMessage, reqVO.getIsSendMessage())
|
||||
.eqIfPresent(ElectronicsOrderDO::getTemplateSize, reqVO.getTemplateSize())
|
||||
.eqIfPresent(ElectronicsOrderDO::getOperateRequire, reqVO.getOperateRequire())
|
||||
.eqIfPresent(ElectronicsOrderDO::getLogisticCode, reqVO.getLogisticCode())
|
||||
.betweenIfPresent(ElectronicsOrderDO::getStartDate, reqVO.getStartDate())
|
||||
.betweenIfPresent(ElectronicsOrderDO::getEndDate, reqVO.getEndDate())
|
||||
.eqIfPresent(ElectronicsOrderDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(ElectronicsOrderDO::getExpType, reqVO.getExpType())
|
||||
.eqIfPresent(ElectronicsOrderDO::getIsReturnSignBill, reqVO.getIsReturnSignBill())
|
||||
.eqIfPresent(ElectronicsOrderDO::getCompany, reqVO.getCompany())
|
||||
.likeIfPresent(ElectronicsOrderDO::getProvinceName, reqVO.getProvinceName())
|
||||
.likeIfPresent(ElectronicsOrderDO::getCityName, reqVO.getCityName())
|
||||
.likeIfPresent(ElectronicsOrderDO::getExpAreaName, reqVO.getExpAreaName())
|
||||
.eqIfPresent(ElectronicsOrderDO::getAddress, reqVO.getAddress())
|
||||
.likeIfPresent(ElectronicsOrderDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ElectronicsOrderDO::getTel, reqVO.getTel())
|
||||
.eqIfPresent(ElectronicsOrderDO::getMobile, reqVO.getMobile())
|
||||
.eqIfPresent(ElectronicsOrderDO::getPostCode, reqVO.getPostCode())
|
||||
.eqIfPresent(ElectronicsOrderDO::getTitle, reqVO.getTitle())
|
||||
.betweenIfPresent(ElectronicsOrderDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ElectronicsOrderDO::getId));
|
||||
}
|
||||
|
||||
default List<ElectronicsOrderDO> selectList(ElectronicsOrderExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<ElectronicsOrderDO>()
|
||||
.eqIfPresent(ElectronicsOrderDO::getShipperId, reqVO.getShipperId())
|
||||
.eqIfPresent(ElectronicsOrderDO::getPaytype, reqVO.getPaytype())
|
||||
.likeIfPresent(ElectronicsOrderDO::getCustomerName, reqVO.getCustomerName())
|
||||
.eqIfPresent(ElectronicsOrderDO::getCustomerPwd, reqVO.getCustomerPwd())
|
||||
.eqIfPresent(ElectronicsOrderDO::getSendSite, reqVO.getSendSite())
|
||||
.eqIfPresent(ElectronicsOrderDO::getSendStaff, reqVO.getSendStaff())
|
||||
.eqIfPresent(ElectronicsOrderDO::getMonthCode, reqVO.getMonthCode())
|
||||
.eqIfPresent(ElectronicsOrderDO::getIsNotice, reqVO.getIsNotice())
|
||||
.eqIfPresent(ElectronicsOrderDO::getIsReturnTemp, reqVO.getIsReturnTemp())
|
||||
.eqIfPresent(ElectronicsOrderDO::getIsSendMessage, reqVO.getIsSendMessage())
|
||||
.eqIfPresent(ElectronicsOrderDO::getTemplateSize, reqVO.getTemplateSize())
|
||||
.eqIfPresent(ElectronicsOrderDO::getOperateRequire, reqVO.getOperateRequire())
|
||||
.eqIfPresent(ElectronicsOrderDO::getLogisticCode, reqVO.getLogisticCode())
|
||||
.betweenIfPresent(ElectronicsOrderDO::getStartDate, reqVO.getStartDate())
|
||||
.betweenIfPresent(ElectronicsOrderDO::getEndDate, reqVO.getEndDate())
|
||||
.eqIfPresent(ElectronicsOrderDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(ElectronicsOrderDO::getExpType, reqVO.getExpType())
|
||||
.eqIfPresent(ElectronicsOrderDO::getIsReturnSignBill, reqVO.getIsReturnSignBill())
|
||||
.eqIfPresent(ElectronicsOrderDO::getCompany, reqVO.getCompany())
|
||||
.likeIfPresent(ElectronicsOrderDO::getProvinceName, reqVO.getProvinceName())
|
||||
.likeIfPresent(ElectronicsOrderDO::getCityName, reqVO.getCityName())
|
||||
.likeIfPresent(ElectronicsOrderDO::getExpAreaName, reqVO.getExpAreaName())
|
||||
.eqIfPresent(ElectronicsOrderDO::getAddress, reqVO.getAddress())
|
||||
.likeIfPresent(ElectronicsOrderDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ElectronicsOrderDO::getTel, reqVO.getTel())
|
||||
.eqIfPresent(ElectronicsOrderDO::getMobile, reqVO.getMobile())
|
||||
.eqIfPresent(ElectronicsOrderDO::getPostCode, reqVO.getPostCode())
|
||||
.eqIfPresent(ElectronicsOrderDO::getTitle, reqVO.getTitle())
|
||||
.betweenIfPresent(ElectronicsOrderDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ElectronicsOrderDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package co.yixiang.yshop.module.express.dal.mysql.express;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressExportReqVO;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressPageReqVO;
|
||||
import co.yixiang.yshop.module.express.dal.dataobject.express.ExpressDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 快递公司 Mapper
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExpressMapper extends BaseMapperX<ExpressDO> {
|
||||
|
||||
default PageResult<ExpressDO> selectPage(ExpressPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ExpressDO>()
|
||||
.eqIfPresent(ExpressDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(ExpressDO::getName, reqVO.getName())
|
||||
.orderByDesc(ExpressDO::getId));
|
||||
}
|
||||
|
||||
default List<ExpressDO> selectList(ExpressExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<ExpressDO>()
|
||||
.eqIfPresent(ExpressDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(ExpressDO::getName, reqVO.getName())
|
||||
.orderByDesc(ExpressDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package co.yixiang.yshop.module.express.dal.redis;
|
||||
|
||||
import co.yixiang.yshop.framework.redis.core.RedisKeyDefine;
|
||||
import co.yixiang.yshop.module.express.kdniao.model.dto.KdniaoApiBaseDTO;
|
||||
|
||||
import static co.yixiang.yshop.framework.redis.core.RedisKeyDefine.KeyTypeEnum.STRING;
|
||||
|
||||
/**
|
||||
* System Redis Key 枚举类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
public interface RedisKeyConstants {
|
||||
|
||||
|
||||
RedisKeyDefine YSHOP_EXPRESS_CACHE_KEY = new RedisKeyDefine("快递鸟配置",
|
||||
"yshop_express_cache:", //
|
||||
STRING, KdniaoApiBaseDTO.class, RedisKeyDefine.TimeoutTypeEnum.FOREVER);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package co.yixiang.yshop.module.express.dal.redis.express;
|
||||
|
||||
import co.yixiang.yshop.framework.common.util.json.JsonUtils;
|
||||
import co.yixiang.yshop.module.express.kdniao.model.dto.KdniaoApiBaseDTO;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static co.yixiang.yshop.module.express.dal.redis.RedisKeyConstants.YSHOP_EXPRESS_CACHE_KEY;
|
||||
|
||||
|
||||
/**
|
||||
* {@link KdniaoApiBaseDTO} 的 RedisDAO
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Repository
|
||||
public class ExpressRedisDAO {
|
||||
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
|
||||
public KdniaoApiBaseDTO get() {
|
||||
String redisKey = YSHOP_EXPRESS_CACHE_KEY.getKeyTemplate();
|
||||
return JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(redisKey), KdniaoApiBaseDTO.class);
|
||||
}
|
||||
|
||||
public void set(KdniaoApiBaseDTO apiBaseDTO) {
|
||||
String redisKey = YSHOP_EXPRESS_CACHE_KEY.getKeyTemplate();
|
||||
stringRedisTemplate.opsForValue().set(redisKey, JsonUtils.toJsonString(apiBaseDTO));
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
String redisKey =YSHOP_EXPRESS_CACHE_KEY.getKeyTemplate();
|
||||
stringRedisTemplate.delete(redisKey);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static String formatKey() {
|
||||
return String.format(YSHOP_EXPRESS_CACHE_KEY.getKeyTemplate());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package co.yixiang.yshop.module.express.service.electronicsorder;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import co.yixiang.yshop.module.express.controller.admin.electronicsorder.vo.*;
|
||||
import co.yixiang.yshop.module.express.dal.dataobject.electronicsorder.ElectronicsOrderDO;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 电子面单 Service 接口
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
public interface ElectronicsOrderService {
|
||||
|
||||
/**
|
||||
* 创建电子面单
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createElectronicsOrder(@Valid ElectronicsOrderCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新电子面单
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateElectronicsOrder(@Valid ElectronicsOrderUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除电子面单
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteElectronicsOrder(Long id);
|
||||
|
||||
/**
|
||||
* 获得电子面单
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 电子面单
|
||||
*/
|
||||
ElectronicsOrderDO getElectronicsOrder(Long id);
|
||||
|
||||
/**
|
||||
* 获得电子面单列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 电子面单列表
|
||||
*/
|
||||
List<ElectronicsOrderDO> getElectronicsOrderList();
|
||||
|
||||
/**
|
||||
* 获得电子面单分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 电子面单分页
|
||||
*/
|
||||
PageResult<ElectronicsOrderDO> getElectronicsOrderPage(ElectronicsOrderPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得电子面单列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 电子面单列表
|
||||
*/
|
||||
List<ElectronicsOrderDO> getElectronicsOrderList(ElectronicsOrderExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package co.yixiang.yshop.module.express.service.electronicsorder;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import co.yixiang.yshop.module.express.controller.admin.electronicsorder.vo.*;
|
||||
import co.yixiang.yshop.module.express.dal.dataobject.electronicsorder.ElectronicsOrderDO;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
import co.yixiang.yshop.module.express.convert.electronicsorder.ElectronicsOrderConvert;
|
||||
import co.yixiang.yshop.module.express.dal.mysql.electronicsorder.ElectronicsOrderMapper;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static co.yixiang.yshop.module.express.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 电子面单 Service 实现类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ElectronicsOrderServiceImpl implements ElectronicsOrderService {
|
||||
|
||||
@Resource
|
||||
private ElectronicsOrderMapper electronicsOrderMapper;
|
||||
|
||||
@Override
|
||||
public Long createElectronicsOrder(ElectronicsOrderCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
ElectronicsOrderDO electronicsOrder = ElectronicsOrderConvert.INSTANCE.convert(createReqVO);
|
||||
electronicsOrderMapper.insert(electronicsOrder);
|
||||
// 返回
|
||||
return electronicsOrder.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateElectronicsOrder(ElectronicsOrderUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateElectronicsOrderExists(updateReqVO.getId());
|
||||
// 更新
|
||||
ElectronicsOrderDO updateObj = ElectronicsOrderConvert.INSTANCE.convert(updateReqVO);
|
||||
electronicsOrderMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteElectronicsOrder(Long id) {
|
||||
// 校验存在
|
||||
validateElectronicsOrderExists(id);
|
||||
// 删除
|
||||
electronicsOrderMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateElectronicsOrderExists(Long id) {
|
||||
if (electronicsOrderMapper.selectById(id) == null) {
|
||||
throw exception(ELECTRONICS_ORDER_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ElectronicsOrderDO getElectronicsOrder(Long id) {
|
||||
return electronicsOrderMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ElectronicsOrderDO> getElectronicsOrderList() {
|
||||
return electronicsOrderMapper.selectList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ElectronicsOrderDO> getElectronicsOrderPage(ElectronicsOrderPageReqVO pageReqVO) {
|
||||
return electronicsOrderMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ElectronicsOrderDO> getElectronicsOrderList(ElectronicsOrderExportReqVO exportReqVO) {
|
||||
return electronicsOrderMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package co.yixiang.yshop.module.express.service.express;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressCreateReqVO;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressExportReqVO;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressPageReqVO;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressUpdateReqVO;
|
||||
import co.yixiang.yshop.module.express.dal.dataobject.express.ExpressDO;
|
||||
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 快递公司 Service 接口
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
public interface ExpressService {
|
||||
|
||||
/**
|
||||
* 创建快递公司
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createExpress(@Valid ExpressCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新快递公司
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateExpress(@Valid ExpressUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除快递公司
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteExpress(Integer id);
|
||||
|
||||
/**
|
||||
* 获得快递公司
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 快递公司
|
||||
*/
|
||||
ExpressDO getExpress(Integer id);
|
||||
|
||||
/**
|
||||
* 获得快递公司列表
|
||||
*
|
||||
* @return 快递公司列表
|
||||
*/
|
||||
List<ExpressDO> getExpressList();
|
||||
|
||||
/**
|
||||
* 获得快递公司分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 快递公司分页
|
||||
*/
|
||||
PageResult<ExpressDO> getExpressPage(ExpressPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得快递公司列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 快递公司列表
|
||||
*/
|
||||
List<ExpressDO> getExpressList(ExpressExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package co.yixiang.yshop.module.express.service.express;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressCreateReqVO;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressExportReqVO;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressPageReqVO;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressUpdateReqVO;
|
||||
import co.yixiang.yshop.module.express.convert.express.ExpressConvert;
|
||||
import co.yixiang.yshop.module.express.dal.dataobject.express.ExpressDO;
|
||||
import co.yixiang.yshop.module.express.dal.mysql.express.ExpressMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static co.yixiang.yshop.module.express.enums.ErrorCodeConstants.EXPRESS_NOT_EXISTS;
|
||||
|
||||
|
||||
/**
|
||||
* 快递公司 Service 实现类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ExpressServiceImpl implements ExpressService {
|
||||
|
||||
@Resource
|
||||
private ExpressMapper expressMapper;
|
||||
|
||||
@Override
|
||||
public Integer createExpress(ExpressCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
ExpressDO express = ExpressConvert.INSTANCE.convert(createReqVO);
|
||||
expressMapper.insert(express);
|
||||
// 返回
|
||||
return express.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExpress(ExpressUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateExpressExists(updateReqVO.getId());
|
||||
// 更新
|
||||
ExpressDO updateObj = ExpressConvert.INSTANCE.convert(updateReqVO);
|
||||
expressMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteExpress(Integer id) {
|
||||
// 校验存在
|
||||
validateExpressExists(id);
|
||||
// 删除
|
||||
expressMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateExpressExists(Integer id) {
|
||||
if (expressMapper.selectById(id) == null) {
|
||||
throw exception(EXPRESS_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressDO getExpress(Integer id) {
|
||||
return expressMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExpressDO> getExpressList() {
|
||||
return expressMapper.selectList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ExpressDO> getExpressPage(ExpressPageReqVO pageReqVO) {
|
||||
return expressMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExpressDO> getExpressList(ExpressExportReqVO exportReqVO) {
|
||||
return expressMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
BIN
yshop-module-express/yshop-module-express-biz/src/main/resources/.DS_Store
vendored
Normal file
BIN
yshop-module-express/yshop-module-express-biz/src/main/resources/.DS_Store
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user