微信付款码
This commit is contained in:
@ -172,5 +172,9 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode MONEY_NOT_EXISTS = new ErrorCode(1_004_030_00, "金额不存在");
|
ErrorCode MONEY_NOT_EXISTS = new ErrorCode(1_004_030_00, "金额不存在");
|
||||||
|
|
||||||
ErrorCode HOLIDAY_NOT_EXISTS = new ErrorCode(1_004_031_00, "假期不存在");
|
ErrorCode HOLIDAY_NOT_EXISTS = new ErrorCode(1_004_031_00, "假期不存在");
|
||||||
|
|
||||||
|
ErrorCode WX_STORE_ORDER_NOT_EXISTS = new ErrorCode(1_004_032_00, "微信付款码订单不存在");
|
||||||
|
ErrorCode WX_STORE_ORDER_DETAIL_NOT_EXISTS = new ErrorCode(1_004_032_01, "微信付款码订单详情不存在");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,11 @@
|
|||||||
<artifactId>yudao-module-system-api</artifactId>
|
<artifactId>yudao-module-system-api</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-pay-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
<artifactId>yudao-module-infra-api</artifactId>
|
<artifactId>yudao-module-infra-api</artifactId>
|
||||||
|
@ -0,0 +1,95 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.controller.admin.wxstoreorder;
|
||||||
|
|
||||||
|
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 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.operatelog.core.annotations.OperateLog;
|
||||||
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.wxstoreorder.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.wxstoreorder.WxStoreOrderDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.wxstoreorder.WxStoreOrderService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 微信付款码订单")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/wx-store-order")
|
||||||
|
@Validated
|
||||||
|
public class WxStoreOrderController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WxStoreOrderService wxStoreOrderService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建微信付款码订单")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:wx-store-order:create')")
|
||||||
|
public CommonResult<Long> createWxStoreOrder(@Valid @RequestBody WxStoreOrderSaveReqVO createReqVO) {
|
||||||
|
return success(wxStoreOrderService.createWxStoreOrder(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新微信付款码订单")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:wx-store-order:update')")
|
||||||
|
public CommonResult<Boolean> updateWxStoreOrder(@Valid @RequestBody WxStoreOrderSaveReqVO updateReqVO) {
|
||||||
|
wxStoreOrderService.updateWxStoreOrder(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除微信付款码订单")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:wx-store-order:delete')")
|
||||||
|
public CommonResult<Boolean> deleteWxStoreOrder(@RequestParam("id") Long id) {
|
||||||
|
wxStoreOrderService.deleteWxStoreOrder(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得微信付款码订单")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:wx-store-order:query')")
|
||||||
|
public CommonResult<WxStoreOrderRespVO> getWxStoreOrder(@RequestParam("id") Long id) {
|
||||||
|
WxStoreOrderDO wxStoreOrder = wxStoreOrderService.getWxStoreOrder(id);
|
||||||
|
return success(BeanUtils.toBean(wxStoreOrder, WxStoreOrderRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得微信付款码订单分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:wx-store-order:query')")
|
||||||
|
public CommonResult<PageResult<WxStoreOrderRespVO>> getWxStoreOrderPage(@Valid WxStoreOrderPageReqVO pageReqVO) {
|
||||||
|
PageResult<WxStoreOrderDO> pageResult = wxStoreOrderService.getWxStoreOrderPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, WxStoreOrderRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出微信付款码订单 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:wx-store-order:export')")
|
||||||
|
@OperateLog(type = EXPORT)
|
||||||
|
public void exportWxStoreOrderExcel(@Valid WxStoreOrderPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<WxStoreOrderDO> list = wxStoreOrderService.getWxStoreOrderPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "微信付款码订单.xls", "数据", WxStoreOrderRespVO.class,
|
||||||
|
BeanUtils.toBean(list, WxStoreOrderRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.controller.admin.wxstoreorder.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 WxStoreOrderPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "总价钱", example = "3825")
|
||||||
|
private Double totalPrice;
|
||||||
|
|
||||||
|
@Schema(description = "门店ID", example = "19619")
|
||||||
|
private Long carteenId;
|
||||||
|
|
||||||
|
@Schema(description = "付款码")
|
||||||
|
private String authCode;
|
||||||
|
|
||||||
|
@Schema(description = "商户订单号")
|
||||||
|
private String outTradeNo;
|
||||||
|
|
||||||
|
@Schema(description = "状态", example = "1")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.controller.admin.wxstoreorder.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
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 WxStoreOrderRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "26597")
|
||||||
|
@ExcelProperty("编号")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "总价钱", example = "3825")
|
||||||
|
@ExcelProperty("总价钱")
|
||||||
|
private Double totalPrice;
|
||||||
|
|
||||||
|
@Schema(description = "门店ID", example = "19619")
|
||||||
|
@ExcelProperty("门店ID")
|
||||||
|
private Long carteenId;
|
||||||
|
|
||||||
|
@Schema(description = "付款码")
|
||||||
|
@ExcelProperty("付款码")
|
||||||
|
private String authCode;
|
||||||
|
|
||||||
|
@Schema(description = "商户订单号")
|
||||||
|
@ExcelProperty("商户订单号")
|
||||||
|
private String outTradeNo;
|
||||||
|
|
||||||
|
@Schema(description = "状态", example = "1")
|
||||||
|
@ExcelProperty("状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.controller.admin.wxstoreorder.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 微信付款码订单新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class WxStoreOrderSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "26597")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "总价钱", example = "3825")
|
||||||
|
private Double totalPrice;
|
||||||
|
|
||||||
|
@Schema(description = "门店ID", example = "19619")
|
||||||
|
private Long carteenId;
|
||||||
|
|
||||||
|
@Schema(description = "付款码")
|
||||||
|
private String authCode;
|
||||||
|
|
||||||
|
@Schema(description = "商户订单号")
|
||||||
|
private String outTradeNo;
|
||||||
|
|
||||||
|
@Schema(description = "状态", example = "1")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,95 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.controller.admin.wxstoreorderdetail;
|
||||||
|
|
||||||
|
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 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.operatelog.core.annotations.OperateLog;
|
||||||
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.wxstoreorderdetail.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.wxstoreorderdetail.WxStoreOrderDetailDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.wxstoreorderdetail.WxStoreOrderDetailService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 微信付款码订单详情")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/wx-store-order-detail")
|
||||||
|
@Validated
|
||||||
|
public class WxStoreOrderDetailController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WxStoreOrderDetailService wxStoreOrderDetailService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建微信付款码订单详情")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:wx-store-order-detail:create')")
|
||||||
|
public CommonResult<Long> createWxStoreOrderDetail(@Valid @RequestBody WxStoreOrderDetailSaveReqVO createReqVO) {
|
||||||
|
return success(wxStoreOrderDetailService.createWxStoreOrderDetail(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新微信付款码订单详情")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:wx-store-order-detail:update')")
|
||||||
|
public CommonResult<Boolean> updateWxStoreOrderDetail(@Valid @RequestBody WxStoreOrderDetailSaveReqVO updateReqVO) {
|
||||||
|
wxStoreOrderDetailService.updateWxStoreOrderDetail(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除微信付款码订单详情")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:wx-store-order-detail:delete')")
|
||||||
|
public CommonResult<Boolean> deleteWxStoreOrderDetail(@RequestParam("id") Long id) {
|
||||||
|
wxStoreOrderDetailService.deleteWxStoreOrderDetail(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得微信付款码订单详情")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:wx-store-order-detail:query')")
|
||||||
|
public CommonResult<WxStoreOrderDetailRespVO> getWxStoreOrderDetail(@RequestParam("id") Long id) {
|
||||||
|
WxStoreOrderDetailDO wxStoreOrderDetail = wxStoreOrderDetailService.getWxStoreOrderDetail(id);
|
||||||
|
return success(BeanUtils.toBean(wxStoreOrderDetail, WxStoreOrderDetailRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得微信付款码订单详情分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:wx-store-order-detail:query')")
|
||||||
|
public CommonResult<PageResult<WxStoreOrderDetailRespVO>> getWxStoreOrderDetailPage(@Valid WxStoreOrderDetailPageReqVO pageReqVO) {
|
||||||
|
PageResult<WxStoreOrderDetailDO> pageResult = wxStoreOrderDetailService.getWxStoreOrderDetailPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, WxStoreOrderDetailRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出微信付款码订单详情 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:wx-store-order-detail:export')")
|
||||||
|
@OperateLog(type = EXPORT)
|
||||||
|
public void exportWxStoreOrderDetailExcel(@Valid WxStoreOrderDetailPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<WxStoreOrderDetailDO> list = wxStoreOrderDetailService.getWxStoreOrderDetailPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "微信付款码订单详情.xls", "数据", WxStoreOrderDetailRespVO.class,
|
||||||
|
BeanUtils.toBean(list, WxStoreOrderDetailRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.controller.admin.wxstoreorderdetail.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 WxStoreOrderDetailPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "订单ID", example = "22341")
|
||||||
|
private Integer wxOrderId;
|
||||||
|
|
||||||
|
@Schema(description = "商品ID", example = "17969")
|
||||||
|
private Integer goodsId;
|
||||||
|
|
||||||
|
@Schema(description = "商品名", example = "张三")
|
||||||
|
private String goodsName;
|
||||||
|
|
||||||
|
@Schema(description = "单价", example = "18762")
|
||||||
|
private Double customPrice;
|
||||||
|
|
||||||
|
@Schema(description = "数量")
|
||||||
|
private Integer number;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.controller.admin.wxstoreorderdetail.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
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 WxStoreOrderDetailRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7753")
|
||||||
|
@ExcelProperty("编号")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "订单ID", example = "22341")
|
||||||
|
@ExcelProperty("订单ID")
|
||||||
|
private Integer wxOrderId;
|
||||||
|
|
||||||
|
@Schema(description = "商品ID", example = "17969")
|
||||||
|
@ExcelProperty("商品ID")
|
||||||
|
private Integer goodsId;
|
||||||
|
|
||||||
|
@Schema(description = "商品名", example = "张三")
|
||||||
|
@ExcelProperty("商品名")
|
||||||
|
private String goodsName;
|
||||||
|
|
||||||
|
@Schema(description = "单价", example = "18762")
|
||||||
|
@ExcelProperty("单价")
|
||||||
|
private Double customPrice;
|
||||||
|
|
||||||
|
@Schema(description = "数量")
|
||||||
|
@ExcelProperty("数量")
|
||||||
|
private Integer number;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.controller.admin.wxstoreorderdetail.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 微信付款码订单详情新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class WxStoreOrderDetailSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7753")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "订单ID", example = "22341")
|
||||||
|
private Integer wxOrderId;
|
||||||
|
|
||||||
|
@Schema(description = "商品ID", example = "17969")
|
||||||
|
private Integer goodsId;
|
||||||
|
|
||||||
|
@Schema(description = "商品名", example = "张三")
|
||||||
|
private String goodsName;
|
||||||
|
|
||||||
|
@Schema(description = "单价", example = "18762")
|
||||||
|
private Double customPrice;
|
||||||
|
|
||||||
|
@Schema(description = "数量")
|
||||||
|
private Integer number;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.controller.app.wxstoreorder;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.wxstoreorder.vo.WxStoreOrderPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.wxstoreorder.vo.WxStoreOrderRespVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.wxstoreorder.vo.WxStoreOrderSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.app.wxstoreorder.vo.WxStoreOrderVO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.wxstoreorder.WxStoreOrderDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.wxstoreorder.WxStoreOrderService;
|
||||||
|
import cn.iocoder.yudao.module.system.api.carteen.CarteenApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.carteen.dto.CarteenRespDto;
|
||||||
|
import cn.iocoder.yudao.module.system.api.cashregisterinfo.CashregisterinfoApi;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
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.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
|
||||||
|
@Tag(name = "APP - 微信付款码订单")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/wx-store-order")
|
||||||
|
@Validated
|
||||||
|
public class AppWxStoreOrderController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WxStoreOrderService wxStoreOrderService;
|
||||||
|
@Resource
|
||||||
|
private CashregisterinfoApi cashregisterinfoApi;
|
||||||
|
@Resource
|
||||||
|
private CarteenApi carteenApi;
|
||||||
|
|
||||||
|
@PostMapping("/wxPay")
|
||||||
|
public CommonResult<Boolean> wxPay(@RequestBody WxStoreOrderVO vo, HttpServletRequest request) {
|
||||||
|
String equipment = request.getHeader("Authorization");
|
||||||
|
Long storeId = cashregisterinfoApi.getStoreId(equipment);
|
||||||
|
CarteenRespDto carteen = carteenApi.getCarteenById(storeId);
|
||||||
|
vo.setCarteenId(carteen.getId());
|
||||||
|
vo.setCarteenName(carteen.getStoresName());
|
||||||
|
Boolean b = wxStoreOrderService.wxPay(vo);
|
||||||
|
return success(b,b?"支付成功":"支付失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.controller.app.wxstoreorder.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 微信付款码订单详情新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class WxStoreOrderDetailVO {
|
||||||
|
|
||||||
|
@Schema(description = "订单ID", example = "22341")
|
||||||
|
private Integer wxOrderId;
|
||||||
|
|
||||||
|
@Schema(description = "商品ID", example = "17969")
|
||||||
|
private Integer goodsId;
|
||||||
|
|
||||||
|
@Schema(description = "商品名", example = "张三")
|
||||||
|
private String goodsName;
|
||||||
|
|
||||||
|
@Schema(description = "单价", example = "18762")
|
||||||
|
private Double customPrice;
|
||||||
|
|
||||||
|
@Schema(description = "数量")
|
||||||
|
private Integer number;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.controller.app.wxstoreorder.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 微信付款码订单新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class WxStoreOrderVO {
|
||||||
|
|
||||||
|
@Schema(description = "总价钱", example = "3825")
|
||||||
|
private Double totalPrice;
|
||||||
|
|
||||||
|
@Schema(description = "门店ID", example = "19619")
|
||||||
|
private Long carteenId;
|
||||||
|
|
||||||
|
@Schema(description = "门店名", example = "19619")
|
||||||
|
private String carteenName;
|
||||||
|
|
||||||
|
@Schema(description = "付款码")
|
||||||
|
private String authCode;
|
||||||
|
|
||||||
|
@Schema(description = "商户订单号")
|
||||||
|
private String outTradeNo;
|
||||||
|
|
||||||
|
@Schema(description = "状态", example = "1")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Schema(description = "商品详情", example = "1")
|
||||||
|
private List<WxStoreOrderDetailVO> goodsList;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.dal.dataobject.wxstoreorder;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信付款码订单 DO
|
||||||
|
*
|
||||||
|
* @author 我是秦俊旗
|
||||||
|
*/
|
||||||
|
@TableName("member_wx_store_order")
|
||||||
|
@KeySequence("member_wx_store_order_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class WxStoreOrderDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 总价钱
|
||||||
|
*/
|
||||||
|
private Double totalPrice;
|
||||||
|
/**
|
||||||
|
* 门店ID
|
||||||
|
*/
|
||||||
|
private Long carteenId;
|
||||||
|
/**
|
||||||
|
* 付款码
|
||||||
|
*/
|
||||||
|
private String authCode;
|
||||||
|
/**
|
||||||
|
* 商户订单号
|
||||||
|
*/
|
||||||
|
private String outTradeNo;
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.dal.dataobject.wxstoreorderdetail;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信付款码订单详情 DO
|
||||||
|
*
|
||||||
|
* @author 我是秦俊旗
|
||||||
|
*/
|
||||||
|
@TableName("member_wx_store_order_detail")
|
||||||
|
@KeySequence("member_wx_store_order_detail_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class WxStoreOrderDetailDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 订单ID
|
||||||
|
*/
|
||||||
|
private Long wxOrderId;
|
||||||
|
/**
|
||||||
|
* 商品ID
|
||||||
|
*/
|
||||||
|
private Integer goodsId;
|
||||||
|
/**
|
||||||
|
* 商品名
|
||||||
|
*/
|
||||||
|
private String goodsName;
|
||||||
|
/**
|
||||||
|
* 单价
|
||||||
|
*/
|
||||||
|
private Double customPrice;
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private Integer number;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.dal.mysql.wxstoreorder;
|
||||||
|
|
||||||
|
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.member.dal.dataobject.wxstoreorder.WxStoreOrderDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.wxstoreorder.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信付款码订单 Mapper
|
||||||
|
*
|
||||||
|
* @author 我是秦俊旗
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface WxStoreOrderMapper extends BaseMapperX<WxStoreOrderDO> {
|
||||||
|
|
||||||
|
default PageResult<WxStoreOrderDO> selectPage(WxStoreOrderPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<WxStoreOrderDO>()
|
||||||
|
.eqIfPresent(WxStoreOrderDO::getTotalPrice, reqVO.getTotalPrice())
|
||||||
|
.eqIfPresent(WxStoreOrderDO::getCarteenId, reqVO.getCarteenId())
|
||||||
|
.eqIfPresent(WxStoreOrderDO::getAuthCode, reqVO.getAuthCode())
|
||||||
|
.eqIfPresent(WxStoreOrderDO::getOutTradeNo, reqVO.getOutTradeNo())
|
||||||
|
.eqIfPresent(WxStoreOrderDO::getStatus, reqVO.getStatus())
|
||||||
|
.betweenIfPresent(WxStoreOrderDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(WxStoreOrderDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.dal.mysql.wxstoreorderdetail;
|
||||||
|
|
||||||
|
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.member.dal.dataobject.wxstoreorderdetail.WxStoreOrderDetailDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.wxstoreorderdetail.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信付款码订单详情 Mapper
|
||||||
|
*
|
||||||
|
* @author 我是秦俊旗
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface WxStoreOrderDetailMapper extends BaseMapperX<WxStoreOrderDetailDO> {
|
||||||
|
|
||||||
|
default PageResult<WxStoreOrderDetailDO> selectPage(WxStoreOrderDetailPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<WxStoreOrderDetailDO>()
|
||||||
|
.eqIfPresent(WxStoreOrderDetailDO::getWxOrderId, reqVO.getWxOrderId())
|
||||||
|
.eqIfPresent(WxStoreOrderDetailDO::getGoodsId, reqVO.getGoodsId())
|
||||||
|
.likeIfPresent(WxStoreOrderDetailDO::getGoodsName, reqVO.getGoodsName())
|
||||||
|
.eqIfPresent(WxStoreOrderDetailDO::getCustomPrice, reqVO.getCustomPrice())
|
||||||
|
.eqIfPresent(WxStoreOrderDetailDO::getNumber, reqVO.getNumber())
|
||||||
|
.betweenIfPresent(WxStoreOrderDetailDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(WxStoreOrderDetailDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.service.wxstoreorder;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.wxstoreorder.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.app.wxstoreorder.vo.WxStoreOrderVO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.wxstoreorder.WxStoreOrderDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信付款码订单 Service 接口
|
||||||
|
*
|
||||||
|
* @author 我是秦俊旗
|
||||||
|
*/
|
||||||
|
public interface WxStoreOrderService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建微信付款码订单
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createWxStoreOrder(@Valid WxStoreOrderSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新微信付款码订单
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateWxStoreOrder(@Valid WxStoreOrderSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信付款码订单
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteWxStoreOrder(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得微信付款码订单
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 微信付款码订单
|
||||||
|
*/
|
||||||
|
WxStoreOrderDO getWxStoreOrder(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得微信付款码订单分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 微信付款码订单分页
|
||||||
|
*/
|
||||||
|
PageResult<WxStoreOrderDO> getWxStoreOrderPage(WxStoreOrderPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
Boolean wxPay(WxStoreOrderVO vo);
|
||||||
|
}
|
@ -0,0 +1,138 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.service.wxstoreorder;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.app.wxstoreorder.vo.WxStoreOrderDetailVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.app.wxstoreorder.vo.WxStoreOrderVO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.wxstoreorderdetail.WxStoreOrderDetailDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.mysql.wxstoreorderdetail.WxStoreOrderDetailMapper;
|
||||||
|
import cn.iocoder.yudao.module.pay.api.order.PayOrderApi;
|
||||||
|
import cn.iocoder.yudao.module.pay.api.order.dto.PayCodesUnifiedDto;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.wxstoreorder.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.wxstoreorder.WxStoreOrderDO;
|
||||||
|
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.member.dal.mysql.wxstoreorder.WxStoreOrderMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信付款码订单 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 我是秦俊旗
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class WxStoreOrderServiceImpl implements WxStoreOrderService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WxStoreOrderMapper wxStoreOrderMapper;
|
||||||
|
@Resource
|
||||||
|
private PayOrderApi orderApi;
|
||||||
|
@Resource
|
||||||
|
private WxStoreOrderDetailMapper wxStoreOrderDetailMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createWxStoreOrder(WxStoreOrderSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
WxStoreOrderDO wxStoreOrder = BeanUtils.toBean(createReqVO, WxStoreOrderDO.class);
|
||||||
|
wxStoreOrderMapper.insert(wxStoreOrder);
|
||||||
|
// 返回
|
||||||
|
return wxStoreOrder.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateWxStoreOrder(WxStoreOrderSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateWxStoreOrderExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
WxStoreOrderDO updateObj = BeanUtils.toBean(updateReqVO, WxStoreOrderDO.class);
|
||||||
|
wxStoreOrderMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteWxStoreOrder(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateWxStoreOrderExists(id);
|
||||||
|
// 删除
|
||||||
|
wxStoreOrderMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateWxStoreOrderExists(Long id) {
|
||||||
|
if (wxStoreOrderMapper.selectById(id) == null) {
|
||||||
|
throw exception(WX_STORE_ORDER_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxStoreOrderDO getWxStoreOrder(Long id) {
|
||||||
|
return wxStoreOrderMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<WxStoreOrderDO> getWxStoreOrderPage(WxStoreOrderPageReqVO pageReqVO) {
|
||||||
|
return wxStoreOrderMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean wxPay(WxStoreOrderVO vo) {
|
||||||
|
String outTradeNo = IdUtil.getSnowflakeNextIdStr();
|
||||||
|
|
||||||
|
double totalPrice = 0.0;
|
||||||
|
for(WxStoreOrderDetailVO detailVO : vo.getGoodsList()) {
|
||||||
|
totalPrice+=detailVO.getCustomPrice()*detailVO.getNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
PayCodesUnifiedDto payCodesUnifiedDto = new PayCodesUnifiedDto();
|
||||||
|
payCodesUnifiedDto.setAuthCode(vo.getAuthCode());
|
||||||
|
payCodesUnifiedDto.setBody(null);
|
||||||
|
payCodesUnifiedDto.setSubject(vo.getCarteenName()+"-超市");
|
||||||
|
payCodesUnifiedDto.setPrice((int)(totalPrice*100));
|
||||||
|
payCodesUnifiedDto.setOutTradeNo(outTradeNo);
|
||||||
|
// 获取本地机器的 InetAddress 对象
|
||||||
|
InetAddress inetAddress = null;
|
||||||
|
try {
|
||||||
|
inetAddress = InetAddress.getLocalHost();
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取本地机器的 IP 地址
|
||||||
|
String ipAddress = inetAddress.getHostAddress();
|
||||||
|
payCodesUnifiedDto.setUserIp(ipAddress);
|
||||||
|
boolean b = orderApi.codePay(payCodesUnifiedDto);
|
||||||
|
if(b){
|
||||||
|
WxStoreOrderDO wxStoreOrderDO = new WxStoreOrderDO();
|
||||||
|
wxStoreOrderDO.setOutTradeNo(outTradeNo);
|
||||||
|
wxStoreOrderDO.setTotalPrice(vo.getTotalPrice());
|
||||||
|
wxStoreOrderDO.setAuthCode(vo.getAuthCode());
|
||||||
|
wxStoreOrderDO.setCarteenId(vo.getCarteenId());
|
||||||
|
wxStoreOrderDO.setStatus("SUCCESS");
|
||||||
|
wxStoreOrderMapper.insert(wxStoreOrderDO);
|
||||||
|
ArrayList<WxStoreOrderDetailDO> wxStoreOrderDetailDOS = new ArrayList<>();
|
||||||
|
for (WxStoreOrderDetailVO detailVO : vo.getGoodsList()) {
|
||||||
|
WxStoreOrderDetailDO detailDO= new WxStoreOrderDetailDO();
|
||||||
|
BeanUtil.copyProperties(detailVO,detailDO);
|
||||||
|
detailDO.setWxOrderId(wxStoreOrderDO.getId());
|
||||||
|
wxStoreOrderDetailDOS.add(detailDO);
|
||||||
|
}
|
||||||
|
if(CollectionUtil.isNotEmpty(wxStoreOrderDetailDOS)){
|
||||||
|
wxStoreOrderDetailMapper.insertBatch(wxStoreOrderDetailDOS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.service.wxstoreorderdetail;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.wxstoreorderdetail.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.wxstoreorderdetail.WxStoreOrderDetailDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信付款码订单详情 Service 接口
|
||||||
|
*
|
||||||
|
* @author 我是秦俊旗
|
||||||
|
*/
|
||||||
|
public interface WxStoreOrderDetailService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建微信付款码订单详情
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createWxStoreOrderDetail(@Valid WxStoreOrderDetailSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新微信付款码订单详情
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateWxStoreOrderDetail(@Valid WxStoreOrderDetailSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信付款码订单详情
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteWxStoreOrderDetail(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得微信付款码订单详情
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 微信付款码订单详情
|
||||||
|
*/
|
||||||
|
WxStoreOrderDetailDO getWxStoreOrderDetail(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得微信付款码订单详情分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 微信付款码订单详情分页
|
||||||
|
*/
|
||||||
|
PageResult<WxStoreOrderDetailDO> getWxStoreOrderDetailPage(WxStoreOrderDetailPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.service.wxstoreorderdetail;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.wxstoreorderdetail.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.wxstoreorderdetail.WxStoreOrderDetailDO;
|
||||||
|
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.member.dal.mysql.wxstoreorderdetail.WxStoreOrderDetailMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信付款码订单详情 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 我是秦俊旗
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class WxStoreOrderDetailServiceImpl implements WxStoreOrderDetailService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WxStoreOrderDetailMapper wxStoreOrderDetailMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createWxStoreOrderDetail(WxStoreOrderDetailSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
WxStoreOrderDetailDO wxStoreOrderDetail = BeanUtils.toBean(createReqVO, WxStoreOrderDetailDO.class);
|
||||||
|
wxStoreOrderDetailMapper.insert(wxStoreOrderDetail);
|
||||||
|
// 返回
|
||||||
|
return wxStoreOrderDetail.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateWxStoreOrderDetail(WxStoreOrderDetailSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateWxStoreOrderDetailExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
WxStoreOrderDetailDO updateObj = BeanUtils.toBean(updateReqVO, WxStoreOrderDetailDO.class);
|
||||||
|
wxStoreOrderDetailMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteWxStoreOrderDetail(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateWxStoreOrderDetailExists(id);
|
||||||
|
// 删除
|
||||||
|
wxStoreOrderDetailMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateWxStoreOrderDetailExists(Long id) {
|
||||||
|
if (wxStoreOrderDetailMapper.selectById(id) == null) {
|
||||||
|
throw exception(WX_STORE_ORDER_DETAIL_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxStoreOrderDetailDO getWxStoreOrderDetail(Long id) {
|
||||||
|
return wxStoreOrderDetailMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<WxStoreOrderDetailDO> getWxStoreOrderDetailPage(WxStoreOrderDetailPageReqVO pageReqVO) {
|
||||||
|
return wxStoreOrderDetailMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.pay.api.order;
|
package cn.iocoder.yudao.module.pay.api.order;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.pay.api.order.dto.PayCodesUnifiedDto;
|
||||||
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO;
|
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO;
|
||||||
|
|
||||||
@ -37,4 +38,9 @@ public interface PayOrderApi {
|
|||||||
*/
|
*/
|
||||||
void updatePayOrderPrice(Long id, Integer payPrice);
|
void updatePayOrderPrice(Long id, Integer payPrice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付款码支付
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
boolean codePay(PayCodesUnifiedDto dto);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package cn.iocoder.yudao.module.pay.api.order.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PayCodesUnifiedDto {
|
||||||
|
|
||||||
|
|
||||||
|
private String subject;
|
||||||
|
private String body;
|
||||||
|
|
||||||
|
private String outTradeNo;
|
||||||
|
|
||||||
|
private Integer price;
|
||||||
|
|
||||||
|
private String userIp;
|
||||||
|
|
||||||
|
private String authCode;
|
||||||
|
}
|
@ -1,13 +1,27 @@
|
|||||||
package cn.iocoder.yudao.module.pay.api.order;
|
package cn.iocoder.yudao.module.pay.api.order;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.PayClient;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideRespDto;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayCodeUnifiedDto;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum;
|
||||||
|
import cn.iocoder.yudao.module.pay.api.order.dto.PayCodesUnifiedDto;
|
||||||
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO;
|
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO;
|
||||||
import cn.iocoder.yudao.module.pay.convert.order.PayOrderConvert;
|
import cn.iocoder.yudao.module.pay.convert.order.PayOrderConvert;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
||||||
|
import cn.iocoder.yudao.module.pay.service.channel.PayChannelService;
|
||||||
import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
|
import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
|
||||||
|
import com.github.binarywang.wxpay.bean.request.WxPayMicropayRequest;
|
||||||
|
import com.github.binarywang.wxpay.bean.result.WxPayMicropayResult;
|
||||||
|
import jdk.internal.org.objectweb.asm.Handle;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付单 API 实现类
|
* 支付单 API 实现类
|
||||||
@ -20,6 +34,9 @@ public class PayOrderApiImpl implements PayOrderApi {
|
|||||||
@Resource
|
@Resource
|
||||||
private PayOrderService payOrderService;
|
private PayOrderService payOrderService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PayChannelService channelService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createOrder(PayOrderCreateReqDTO reqDTO) {
|
public Long createOrder(PayOrderCreateReqDTO reqDTO) {
|
||||||
return payOrderService.createOrder(reqDTO);
|
return payOrderService.createOrder(reqDTO);
|
||||||
@ -36,4 +53,31 @@ public class PayOrderApiImpl implements PayOrderApi {
|
|||||||
payOrderService.updatePayOrderPrice(id, payPrice);
|
payOrderService.updatePayOrderPrice(id, payPrice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean codePay(PayCodesUnifiedDto dto) {
|
||||||
|
|
||||||
|
PayCodeUnifiedDto payCodeUnifiedDto = new PayCodeUnifiedDto();
|
||||||
|
BeanUtil.copyProperties(dto, payCodeUnifiedDto);
|
||||||
|
PayClient payClient = channelService.getPayClient(42L);
|
||||||
|
payClient.unifiedCode(payCodeUnifiedDto);
|
||||||
|
|
||||||
|
PayOrderUnifiedReqDTO payOrderUnifiedReqDTO = new PayOrderUnifiedReqDTO();
|
||||||
|
payOrderUnifiedReqDTO.setOutTradeNo(dto.getOutTradeNo());
|
||||||
|
payOrderUnifiedReqDTO.setSubject(dto.getSubject());
|
||||||
|
payOrderUnifiedReqDTO.setBody(dto.getBody());
|
||||||
|
payOrderUnifiedReqDTO.setPrice(dto.getPrice());
|
||||||
|
payOrderUnifiedReqDTO.setUserIp(dto.getUserIp());
|
||||||
|
payOrderUnifiedReqDTO.setNotifyUrl("https://yclhit.com:8896/admin-api/pay/notify/order/xx");
|
||||||
|
payOrderUnifiedReqDTO.setExpireTime(LocalDateTime.now().plusMinutes(1));
|
||||||
|
Map<String, String> channelExtras = new HashMap<>();
|
||||||
|
channelExtras.put("authCode", dto.getAuthCode());
|
||||||
|
payOrderUnifiedReqDTO.setChannelExtras(channelExtras);
|
||||||
|
try {
|
||||||
|
cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO payOrderRespDTO = payClient.unifiedOrder(payOrderUnifiedReqDTO);
|
||||||
|
return PayOrderStatusRespEnum.isSuccess(payOrderRespDTO.getStatus());
|
||||||
|
}catch (Exception e){
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideBackRespDt
|
|||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideBackUnifiedDto;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideBackUnifiedDto;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideRespDto;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideRespDto;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideUnifiedDto;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideUnifiedDto;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayCodeUnifiedDto;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO;
|
||||||
@ -136,4 +137,12 @@ public interface PayClient {
|
|||||||
*/
|
*/
|
||||||
PayDivideBackRespDto unifiedDivideback(PayDivideBackUnifiedDto reqDTO);
|
PayDivideBackRespDto unifiedDivideback(PayDivideBackUnifiedDto reqDTO);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发起分账
|
||||||
|
*
|
||||||
|
* @param reqDTO 分账参数
|
||||||
|
* @return 分账
|
||||||
|
*/
|
||||||
|
PayDivideRespDto unifiedCode(PayCodeUnifiedDto reqDTO);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package cn.iocoder.yudao.framework.pay.core.client.dto.order;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PayCodeUnifiedDto {
|
||||||
|
|
||||||
|
private String body;
|
||||||
|
|
||||||
|
private String outTradeNo;
|
||||||
|
|
||||||
|
private Integer totalFee;
|
||||||
|
|
||||||
|
private String spbillCreateIp;
|
||||||
|
|
||||||
|
private String authCode;
|
||||||
|
}
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideBackRespDt
|
|||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideBackUnifiedDto;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideBackUnifiedDto;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideRespDto;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideRespDto;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideUnifiedDto;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideUnifiedDto;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayCodeUnifiedDto;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO;
|
||||||
@ -334,6 +335,11 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
|
|||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PayDivideRespDto unifiedCode(PayCodeUnifiedDto reqDTO) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract PayDivideBackRespDto doUnifiedDivideback(PayDivideBackUnifiedDto reqDTO)
|
protected abstract PayDivideBackRespDto doUnifiedDivideback(PayDivideBackUnifiedDto reqDTO)
|
||||||
throws Throwable;
|
throws Throwable;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user