Merge branch 'main' of http://hmgit.huamar.com:8881/yanghaodong/zdsc
						commit
						55c9b8ccc1
					
				@ -0,0 +1,113 @@
 | 
				
			|||||||
 | 
					package cn.iocoder.yudao.module.trade.controller.admin.verifylog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.trade.convert.verifylog.VerifyLogConvert;
 | 
				
			||||||
 | 
					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.apilog.core.annotation.ApiAccessLog;
 | 
				
			||||||
 | 
					import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
 | 
				
			||||||
 | 
					import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.trade.controller.admin.verifylog.vo.*;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.trade.dal.dataobject.verifylog.VerifyLogDO;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.trade.service.verifylog.VerifyLogService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Tag(name = "管理后台 - 门店核销记录")
 | 
				
			||||||
 | 
					@RestController
 | 
				
			||||||
 | 
					@RequestMapping("/trade/verify-log")
 | 
				
			||||||
 | 
					@Validated
 | 
				
			||||||
 | 
					public class VerifyLogController {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    private VerifyLogService verifyLogService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    private MemberUserApi memberUserApi;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PostMapping("/create")
 | 
				
			||||||
 | 
					    @Operation(summary = "创建门店核销记录")
 | 
				
			||||||
 | 
					    @PreAuthorize("@ss.hasPermission('trade:verify-log:create')")
 | 
				
			||||||
 | 
					    public CommonResult<Long> createVerifyLog(@Valid @RequestBody VerifyLogSaveReqVO createReqVO) {
 | 
				
			||||||
 | 
					        return success(verifyLogService.createVerifyLog(createReqVO));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PutMapping("/update")
 | 
				
			||||||
 | 
					    @Operation(summary = "更新门店核销记录")
 | 
				
			||||||
 | 
					    @PreAuthorize("@ss.hasPermission('trade:verify-log:update')")
 | 
				
			||||||
 | 
					    public CommonResult<Boolean> updateVerifyLog(@Valid @RequestBody VerifyLogSaveReqVO updateReqVO) {
 | 
				
			||||||
 | 
					        verifyLogService.updateVerifyLog(updateReqVO);
 | 
				
			||||||
 | 
					        return success(true);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @DeleteMapping("/delete")
 | 
				
			||||||
 | 
					    @Operation(summary = "删除门店核销记录")
 | 
				
			||||||
 | 
					    @Parameter(name = "id", description = "编号", required = true)
 | 
				
			||||||
 | 
					    @PreAuthorize("@ss.hasPermission('trade:verify-log:delete')")
 | 
				
			||||||
 | 
					    public CommonResult<Boolean> deleteVerifyLog(@RequestParam("id") Long id) {
 | 
				
			||||||
 | 
					        verifyLogService.deleteVerifyLog(id);
 | 
				
			||||||
 | 
					        return success(true);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @GetMapping("/get")
 | 
				
			||||||
 | 
					    @Operation(summary = "获得门店核销记录")
 | 
				
			||||||
 | 
					    @Parameter(name = "id", description = "编号", required = true, example = "1024")
 | 
				
			||||||
 | 
					    @PreAuthorize("@ss.hasPermission('trade:verify-log:query')")
 | 
				
			||||||
 | 
					    public CommonResult<VerifyLogRespVO> getVerifyLog(@RequestParam("id") Long id) {
 | 
				
			||||||
 | 
					        VerifyLogDO verifyLog = verifyLogService.getVerifyLog(id);
 | 
				
			||||||
 | 
					        return success(BeanUtils.toBean(verifyLog, VerifyLogRespVO.class));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @GetMapping("/page")
 | 
				
			||||||
 | 
					    @Operation(summary = "获得门店核销记录分页")
 | 
				
			||||||
 | 
					    @PreAuthorize("@ss.hasPermission('trade:verify-log:query')")
 | 
				
			||||||
 | 
					    public CommonResult<PageResult<VerifyLogRespVO>> getVerifyLogPage(@Valid VerifyLogPageReqVO pageReqVO) {
 | 
				
			||||||
 | 
					        PageResult<VerifyLogRespVO> pageResult = verifyLogService.getVerifyLogPage(pageReqVO);
 | 
				
			||||||
 | 
					        List<MemberUserRespDTO> users = memberUserApi.getUserList(
 | 
				
			||||||
 | 
					                convertSet(pageResult.getList(), VerifyLogRespVO::getMebId));
 | 
				
			||||||
 | 
					        return success(VerifyLogConvert.INSTANCE.convertPage(pageResult, users));
 | 
				
			||||||
 | 
					//        return success(BeanUtils.toBean(pageResult, VerifyLogRespVO.class));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @GetMapping("/export-excel")
 | 
				
			||||||
 | 
					    @Operation(summary = "导出门店核销记录 Excel")
 | 
				
			||||||
 | 
					    @PreAuthorize("@ss.hasPermission('trade:verify-log:export')")
 | 
				
			||||||
 | 
					    @ApiAccessLog(operateType = EXPORT)
 | 
				
			||||||
 | 
					    public void exportVerifyLogExcel(@Valid VerifyLogPageReqVO pageReqVO,
 | 
				
			||||||
 | 
					              HttpServletResponse response) throws IOException {
 | 
				
			||||||
 | 
					        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
 | 
				
			||||||
 | 
					        List<VerifyLogRespVO> list = verifyLogService.getVerifyLogPage(pageReqVO).getList();
 | 
				
			||||||
 | 
					        // 导出 Excel
 | 
				
			||||||
 | 
					        ExcelUtils.write(response, "门店核销记录.xls", "数据", VerifyLogRespVO.class,
 | 
				
			||||||
 | 
					                        BeanUtils.toBean(list, VerifyLogRespVO.class));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PutMapping("/updateAlready")
 | 
				
			||||||
 | 
					    @Operation(summary = "结算核销统计")
 | 
				
			||||||
 | 
					    @PreAuthorize("@ss.hasPermission('member:distribution-statistics:update')")
 | 
				
			||||||
 | 
					    public CommonResult<Boolean> updateAlready(@Valid @RequestBody VerifyLogSaveReqVO updateReqVO) {
 | 
				
			||||||
 | 
					        verifyLogService.updateAlready(updateReqVO);
 | 
				
			||||||
 | 
					        return success(true);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,41 @@
 | 
				
			|||||||
 | 
					package cn.iocoder.yudao.module.trade.controller.admin.verifylog.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 VerifyLogPageReqVO extends PageParam {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "会员id", example = "11234")
 | 
				
			||||||
 | 
					    private Long mebId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "订单id", example = "20689")
 | 
				
			||||||
 | 
					    private Long orderId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "核销编码")
 | 
				
			||||||
 | 
					    private String pickUpVerifyCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "核销时间")
 | 
				
			||||||
 | 
					    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
 | 
				
			||||||
 | 
					    private LocalDateTime[] verifyTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "兑换状态", example = "1")
 | 
				
			||||||
 | 
					    private String status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "备注", example = "你猜")
 | 
				
			||||||
 | 
					    private String remark;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "创建时间")
 | 
				
			||||||
 | 
					    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
 | 
				
			||||||
 | 
					    private LocalDateTime[] createTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,63 @@
 | 
				
			|||||||
 | 
					package cn.iocoder.yudao.module.trade.controller.admin.verifylog.vo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import io.swagger.v3.oas.annotations.media.Schema;
 | 
				
			||||||
 | 
					import lombok.*;
 | 
				
			||||||
 | 
					import java.util.*;
 | 
				
			||||||
 | 
					import org.springframework.format.annotation.DateTimeFormat;
 | 
				
			||||||
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					import com.alibaba.excel.annotation.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Schema(description = "管理后台 - 门店核销记录 Response VO")
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					@ExcelIgnoreUnannotated
 | 
				
			||||||
 | 
					public class VerifyLogRespVO {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24309")
 | 
				
			||||||
 | 
					    @ExcelProperty("订单编号")
 | 
				
			||||||
 | 
					    private Long id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "会员id", example = "11234")
 | 
				
			||||||
 | 
					    @ExcelProperty("会员id")
 | 
				
			||||||
 | 
					    private Long mebId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "订单id", example = "20689")
 | 
				
			||||||
 | 
					    @ExcelProperty("订单id")
 | 
				
			||||||
 | 
					    private Long orderId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "核销编码")
 | 
				
			||||||
 | 
					    @ExcelProperty("核销编码")
 | 
				
			||||||
 | 
					    private String pickUpVerifyCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "核销时间")
 | 
				
			||||||
 | 
					    @ExcelProperty("核销时间")
 | 
				
			||||||
 | 
					    private LocalDateTime verifyTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "兑换状态", example = "1")
 | 
				
			||||||
 | 
					    @ExcelProperty("兑换状态")
 | 
				
			||||||
 | 
					    private String status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "备注", example = "你猜")
 | 
				
			||||||
 | 
					    @ExcelProperty("备注")
 | 
				
			||||||
 | 
					    private String remark;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
				
			||||||
 | 
					    @ExcelProperty("创建时间")
 | 
				
			||||||
 | 
					    private LocalDateTime createTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "用户昵称", example = "2")
 | 
				
			||||||
 | 
					    @ExcelProperty("用户昵称")
 | 
				
			||||||
 | 
					    private String nickname;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "手机号", example = "2")
 | 
				
			||||||
 | 
					    @ExcelProperty("手机号")
 | 
				
			||||||
 | 
					    private String phone;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "已结算", example = "2")
 | 
				
			||||||
 | 
					    @ExcelProperty("已结算")
 | 
				
			||||||
 | 
					    private Integer haveAlready;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "未结算", example = "2")
 | 
				
			||||||
 | 
					    @ExcelProperty("未结算")
 | 
				
			||||||
 | 
					    private Integer unAlready;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					package cn.iocoder.yudao.module.trade.controller.admin.verifylog.vo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import io.swagger.v3.oas.annotations.media.Schema;
 | 
				
			||||||
 | 
					import lombok.*;
 | 
				
			||||||
 | 
					import java.util.*;
 | 
				
			||||||
 | 
					import javax.validation.constraints.*;
 | 
				
			||||||
 | 
					import org.springframework.format.annotation.DateTimeFormat;
 | 
				
			||||||
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Schema(description = "管理后台 - 门店核销记录新增/修改 Request VO")
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					public class VerifyLogSaveReqVO {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24309")
 | 
				
			||||||
 | 
					    private Long id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "会员id", example = "11234")
 | 
				
			||||||
 | 
					    private Long mebId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "订单id", example = "20689")
 | 
				
			||||||
 | 
					    private Long orderId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "核销编码")
 | 
				
			||||||
 | 
					    private String pickUpVerifyCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "核销时间")
 | 
				
			||||||
 | 
					    private LocalDateTime verifyTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "兑换状态", example = "1")
 | 
				
			||||||
 | 
					    private String status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Schema(description = "备注", example = "你猜")
 | 
				
			||||||
 | 
					    private String remark;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					package cn.iocoder.yudao.module.trade.convert.verifylog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.framework.common.pojo.PageResult;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.member.api.level.dto.MemberLevelRespDTO;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.trade.controller.admin.verifylog.vo.VerifyLogRespVO;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.trade.dal.dataobject.verifylog.VerifyLogDO;
 | 
				
			||||||
 | 
					import org.mapstruct.Mapper;
 | 
				
			||||||
 | 
					import org.mapstruct.factory.Mappers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Mapper
 | 
				
			||||||
 | 
					public interface VerifyLogConvert {
 | 
				
			||||||
 | 
					    VerifyLogConvert INSTANCE = Mappers.getMapper(VerifyLogConvert.class);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    default PageResult<VerifyLogRespVO> convertPage(PageResult<VerifyLogRespVO> pageResult, List<MemberUserRespDTO> users) {
 | 
				
			||||||
 | 
					        PageResult<VerifyLogRespVO> voPageResult = convertPage(pageResult);
 | 
				
			||||||
 | 
					        // user 拼接
 | 
				
			||||||
 | 
					        Map<Long, MemberUserRespDTO> userMap = convertMap(users, MemberUserRespDTO::getId);
 | 
				
			||||||
 | 
					        voPageResult.getList().forEach(record -> {
 | 
				
			||||||
 | 
					            MapUtils.findAndThen(userMap, record.getMebId(),
 | 
				
			||||||
 | 
					                memberUserRespDTO -> record.setNickname(memberUserRespDTO.getNickname()).setPhone(memberUserRespDTO.getMobile()));
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        return voPageResult;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    PageResult<VerifyLogRespVO> convertPage(PageResult<VerifyLogRespVO> page);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,56 @@
 | 
				
			|||||||
 | 
					package cn.iocoder.yudao.module.trade.dal.dataobject.verifylog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.*;
 | 
				
			||||||
 | 
					import java.util.*;
 | 
				
			||||||
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.annotation.*;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 门店核销记录 DO
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @author 郑大钒水
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@TableName("trade_verify_log")
 | 
				
			||||||
 | 
					@KeySequence("trade_verify_log_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					@EqualsAndHashCode(callSuper = true)
 | 
				
			||||||
 | 
					@ToString(callSuper = true)
 | 
				
			||||||
 | 
					@Builder
 | 
				
			||||||
 | 
					@NoArgsConstructor
 | 
				
			||||||
 | 
					@AllArgsConstructor
 | 
				
			||||||
 | 
					public class VerifyLogDO extends BaseDO {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 订单编号
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @TableId
 | 
				
			||||||
 | 
					    private Long id;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 会员id
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Long mebId;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 订单id
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Long orderId;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 核销编码
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String pickUpVerifyCode;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 核销时间
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private LocalDateTime verifyTime;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 兑换状态
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String status;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 备注
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String remark;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,53 @@
 | 
				
			|||||||
 | 
					package cn.iocoder.yudao.module.trade.dal.mysql.verifylog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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.trade.dal.dataobject.verifylog.VerifyLogDO;
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
				
			||||||
 | 
					import org.apache.ibatis.annotations.Mapper;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.trade.controller.admin.verifylog.vo.*;
 | 
				
			||||||
 | 
					import org.apache.ibatis.annotations.Param;
 | 
				
			||||||
 | 
					import org.apache.ibatis.annotations.Select;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 门店核销记录 Mapper
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @author 郑大钒水
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Mapper
 | 
				
			||||||
 | 
					public interface VerifyLogMapper extends BaseMapperX<VerifyLogDO> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    default PageResult<VerifyLogDO> selectPage(VerifyLogPageReqVO reqVO) {
 | 
				
			||||||
 | 
					        return selectPage(reqVO, new LambdaQueryWrapperX<VerifyLogDO>()
 | 
				
			||||||
 | 
					                .eqIfPresent(VerifyLogDO::getMebId, reqVO.getMebId())
 | 
				
			||||||
 | 
					                .eqIfPresent(VerifyLogDO::getOrderId, reqVO.getOrderId())
 | 
				
			||||||
 | 
					                .eqIfPresent(VerifyLogDO::getPickUpVerifyCode, reqVO.getPickUpVerifyCode())
 | 
				
			||||||
 | 
					                .betweenIfPresent(VerifyLogDO::getVerifyTime, reqVO.getVerifyTime())
 | 
				
			||||||
 | 
					                .eqIfPresent(VerifyLogDO::getStatus, reqVO.getStatus())
 | 
				
			||||||
 | 
					                .eqIfPresent(VerifyLogDO::getRemark, reqVO.getRemark())
 | 
				
			||||||
 | 
					                .betweenIfPresent(VerifyLogDO::getCreateTime, reqVO.getCreateTime())
 | 
				
			||||||
 | 
					                .orderByDesc(VerifyLogDO::getId));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Select({"<script>",
 | 
				
			||||||
 | 
					            "SELECT\n" +
 | 
				
			||||||
 | 
					                    "\tl.meb_id,\n" +
 | 
				
			||||||
 | 
					                    "\tsum( CASE WHEN l.STATUS = 1 THEN 1 ELSE 0 END ) AS 'have_already',\n" +
 | 
				
			||||||
 | 
					                    "\tsum( CASE WHEN l.STATUS = 0 THEN 1 ELSE 0 END ) AS 'un_already' \n" +
 | 
				
			||||||
 | 
					                    "FROM\n" +
 | 
				
			||||||
 | 
					                    "\ttrade_verify_log l",
 | 
				
			||||||
 | 
					            "where l.deleted = FALSE ",
 | 
				
			||||||
 | 
					//            "<if test='status !=null and status!=\"\" '>" ,
 | 
				
			||||||
 | 
					//            "  and l.status = #{status}" ,
 | 
				
			||||||
 | 
					//            "</if> ",
 | 
				
			||||||
 | 
					            "GROUP BY\n" +
 | 
				
			||||||
 | 
					                    "\tl.meb_id\n" +
 | 
				
			||||||
 | 
					            "order BY\n" +
 | 
				
			||||||
 | 
					                    "\tl.meb_id\n" +
 | 
				
			||||||
 | 
					            "</script>"})
 | 
				
			||||||
 | 
					    IPage<VerifyLogRespVO> selectPage1(IPage<?> page, @Param("reqVO") VerifyLogPageReqVO reqVO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,62 @@
 | 
				
			|||||||
 | 
					package cn.iocoder.yudao.module.trade.service.verifylog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.*;
 | 
				
			||||||
 | 
					import javax.validation.*;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.trade.controller.admin.verifylog.vo.*;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.trade.dal.dataobject.verifylog.VerifyLogDO;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.framework.common.pojo.PageResult;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.framework.common.pojo.PageParam;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 门店核销记录 Service 接口
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @author 郑大钒水
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public interface VerifyLogService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 创建门店核销记录
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param createReqVO 创建信息
 | 
				
			||||||
 | 
					     * @return 编号
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Long createVerifyLog(@Valid VerifyLogSaveReqVO createReqVO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 更新门店核销记录
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param updateReqVO 更新信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void updateVerifyLog(@Valid VerifyLogSaveReqVO updateReqVO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 删除门店核销记录
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param id 编号
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void deleteVerifyLog(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获得门店核销记录
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param id 编号
 | 
				
			||||||
 | 
					     * @return 门店核销记录
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    VerifyLogDO getVerifyLog(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获得门店核销记录分页
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param pageReqVO 分页查询
 | 
				
			||||||
 | 
					     * @return 门店核销记录分页
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    PageResult<VerifyLogRespVO> getVerifyLogPage(VerifyLogPageReqVO pageReqVO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 更新核销统计
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param updateReqVO 更新信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void updateAlready(@Valid VerifyLogSaveReqVO updateReqVO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,84 @@
 | 
				
			|||||||
 | 
					package cn.iocoder.yudao.module.trade.service.verifylog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
				
			||||||
 | 
					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.trade.controller.admin.verifylog.vo.*;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.trade.dal.dataobject.verifylog.VerifyLogDO;
 | 
				
			||||||
 | 
					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.trade.dal.mysql.verifylog.VerifyLogMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 | 
				
			||||||
 | 
					import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 门店核销记录 Service 实现类
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @author 郑大钒水
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Service
 | 
				
			||||||
 | 
					@Validated
 | 
				
			||||||
 | 
					public class VerifyLogServiceImpl implements VerifyLogService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    private VerifyLogMapper verifyLogMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Long createVerifyLog(VerifyLogSaveReqVO createReqVO) {
 | 
				
			||||||
 | 
					        // 插入
 | 
				
			||||||
 | 
					        VerifyLogDO verifyLog = BeanUtils.toBean(createReqVO, VerifyLogDO.class);
 | 
				
			||||||
 | 
					        verifyLogMapper.insert(verifyLog);
 | 
				
			||||||
 | 
					        // 返回
 | 
				
			||||||
 | 
					        return verifyLog.getId();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void updateVerifyLog(VerifyLogSaveReqVO updateReqVO) {
 | 
				
			||||||
 | 
					        // 校验存在
 | 
				
			||||||
 | 
					        validateVerifyLogExists(updateReqVO.getId());
 | 
				
			||||||
 | 
					        // 更新
 | 
				
			||||||
 | 
					        VerifyLogDO updateObj = BeanUtils.toBean(updateReqVO, VerifyLogDO.class);
 | 
				
			||||||
 | 
					        verifyLogMapper.updateById(updateObj);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void deleteVerifyLog(Long id) {
 | 
				
			||||||
 | 
					        // 校验存在
 | 
				
			||||||
 | 
					        validateVerifyLogExists(id);
 | 
				
			||||||
 | 
					        // 删除
 | 
				
			||||||
 | 
					        verifyLogMapper.deleteById(id);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private void validateVerifyLogExists(Long id) {
 | 
				
			||||||
 | 
					        if (verifyLogMapper.selectById(id) == null) {
 | 
				
			||||||
 | 
					            throw exception(VERIFY_LOG_NOT_EXISTS);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public VerifyLogDO getVerifyLog(Long id) {
 | 
				
			||||||
 | 
					        return verifyLogMapper.selectById(id);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public PageResult<VerifyLogRespVO> getVerifyLogPage(VerifyLogPageReqVO pageReqVO) {
 | 
				
			||||||
 | 
					        IPage<VerifyLogRespVO> pageResult = verifyLogMapper.selectPage1(MyBatisUtils.buildPage(pageReqVO),pageReqVO);
 | 
				
			||||||
 | 
					        return new PageResult<>(pageResult.getRecords(), pageResult.getTotal());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void updateAlready(VerifyLogSaveReqVO updateReqVO) {
 | 
				
			||||||
 | 
					        // 结算
 | 
				
			||||||
 | 
					        verifyLogMapper.update(new UpdateWrapper<VerifyLogDO>().lambda().set(VerifyLogDO::getStatus,1).eq(VerifyLogDO::getMebId,updateReqVO.getMebId()));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,36 @@
 | 
				
			|||||||
 | 
					package cn.iocoder.yudao.module.pay.api.wallet.dto;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					import lombok.EqualsAndHashCode;
 | 
				
			||||||
 | 
					import lombok.ToString;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.validation.constraints.NotNull;
 | 
				
			||||||
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					public class PayWalletRespDTO  {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Long id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private LocalDateTime createTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String nickname;
 | 
				
			||||||
 | 
					    private String avatar;
 | 
				
			||||||
 | 
					    @NotNull(message = "用户编号不能为空")
 | 
				
			||||||
 | 
					    private Long userId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @NotNull(message = "用户类型不能为空")
 | 
				
			||||||
 | 
					    private Integer userType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @NotNull(message = "余额,单位分不能为空")
 | 
				
			||||||
 | 
					    private Integer balance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @NotNull(message = "累计支出,单位分不能为空")
 | 
				
			||||||
 | 
					    private Integer totalExpense;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @NotNull(message = "累计充值,单位分不能为空")
 | 
				
			||||||
 | 
					    private Integer totalRecharge;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @NotNull(message = "冻结金额,单位分不能为空")
 | 
				
			||||||
 | 
					    private Integer freezePrice;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,82 @@
 | 
				
			|||||||
 | 
					package cn.iocoder.yudao.module.pay.api.wallet;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import cn.hutool.core.lang.Assert;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.framework.common.pojo.PageResult;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.member.api.distributionconfig.vo.DistributionConfigRespDTO;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.pay.api.wallet.dto.PayWalletDTO;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.pay.api.wallet.dto.PayWalletTransactionDTO;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletMapper;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.pay.service.refund.PayRefundService;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO;
 | 
				
			||||||
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
 | 
					import org.springframework.context.annotation.Lazy;
 | 
				
			||||||
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					import org.springframework.transaction.annotation.Transactional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.annotation.Resource;
 | 
				
			||||||
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 | 
				
			||||||
 | 
					import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*;
 | 
				
			||||||
 | 
					import static cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum.PAYMENT;
 | 
				
			||||||
 | 
					import static cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum.PAYMENT_REFUND;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 钱包 Service 实现类
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @author jason
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Service
 | 
				
			||||||
 | 
					@Slf4j
 | 
				
			||||||
 | 
					public class PayWalletApiImpl implements PayWalletApi {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    @Lazy // 延迟加载,避免循环依赖
 | 
				
			||||||
 | 
					    private PayWalletService payWalletService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public PayWalletDTO getOrCreateWallet(Long userId, Integer userType) {
 | 
				
			||||||
 | 
					        return BeanUtils.toBean(payWalletService.getOrCreateWallet(userId,userType), PayWalletDTO.class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public PayWalletDTO getWallet(Long walletId) {
 | 
				
			||||||
 | 
					        return BeanUtils.toBean(payWalletService.getWallet(walletId), PayWalletDTO.class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public PayWalletTransactionDTO reduceWalletBalance(Long walletId, Long bizId, PayWalletBizTypeEnum bizType, Integer price) {
 | 
				
			||||||
 | 
					        return BeanUtils.toBean(payWalletService.reduceWalletBalance(walletId,bizId,bizType,price), PayWalletTransactionDTO.class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public PayWalletTransactionDTO reduceWalletBalance1(Long userId, Long bizId, PayWalletBizTypeEnum bizType, Integer price) {
 | 
				
			||||||
 | 
					        return BeanUtils.toBean(payWalletService.reduceWalletBalance1(userId,bizId,bizType,price), PayWalletTransactionDTO.class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public PayWalletTransactionDTO addWalletBalance(Long walletId, String bizId, PayWalletBizTypeEnum bizType, Integer price) {
 | 
				
			||||||
 | 
					        return BeanUtils.toBean(payWalletService.addWalletBalance(walletId,bizId,bizType,price), PayWalletTransactionDTO.class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void freezePrice(Long id, Integer price) {
 | 
				
			||||||
 | 
					        payWalletService.freezePrice(id,price);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void unfreezePrice(Long id, Integer price) {
 | 
				
			||||||
 | 
					        payWalletService.unfreezePrice(id,price);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,49 @@
 | 
				
			|||||||
 | 
					import request from '@/config/axios'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 门店核销记录 VO
 | 
				
			||||||
 | 
					export interface VerifyLogVO {
 | 
				
			||||||
 | 
					  id: number // 订单编号
 | 
				
			||||||
 | 
					  mebId: number // 会员id
 | 
				
			||||||
 | 
					  orderId: number // 订单id
 | 
				
			||||||
 | 
					  pickUpVerifyCode: string // 核销编码
 | 
				
			||||||
 | 
					  verifyTime: Date // 核销时间
 | 
				
			||||||
 | 
					  status: string // 兑换状态
 | 
				
			||||||
 | 
					  remark: string // 备注
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 门店核销记录 API
 | 
				
			||||||
 | 
					export const VerifyLogApi = {
 | 
				
			||||||
 | 
					  // 查询门店核销记录分页
 | 
				
			||||||
 | 
					  getVerifyLogPage: async (params: any) => {
 | 
				
			||||||
 | 
					    return await request.get({ url: `/trade/verify-log/page`, params })
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // 查询门店核销记录详情
 | 
				
			||||||
 | 
					  getVerifyLog: async (id: number) => {
 | 
				
			||||||
 | 
					    return await request.get({ url: `/trade/verify-log/get?id=` + id })
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // 新增门店核销记录
 | 
				
			||||||
 | 
					  createVerifyLog: async (data: VerifyLogVO) => {
 | 
				
			||||||
 | 
					    return await request.post({ url: `/trade/verify-log/create`, data })
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // 修改门店核销记录
 | 
				
			||||||
 | 
					  updateVerifyLog: async (data: VerifyLogVO) => {
 | 
				
			||||||
 | 
					    return await request.put({ url: `/trade/verify-log/update`, data })
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // 删除门店核销记录
 | 
				
			||||||
 | 
					  deleteVerifyLog: async (id: number) => {
 | 
				
			||||||
 | 
					    return await request.delete({ url: `/trade/verify-log/delete?id=` + id })
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // 导出门店核销记录 Excel
 | 
				
			||||||
 | 
					  exportVerifyLog: async (params) => {
 | 
				
			||||||
 | 
					    return await request.download({ url: `/trade/verify-log/export-excel`, params })
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  // 结算核销统计
 | 
				
			||||||
 | 
					  updateAlready: async (data: VerifyLogVO) => {
 | 
				
			||||||
 | 
					    return await request.put({ url: `/trade/verify-log/updateAlready`, data })
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,42 @@
 | 
				
			|||||||
 | 
					<template>
 | 
				
			||||||
 | 
					  <div class="flex flex-col gap-2 bg-[var(--el-bg-color-overlay)] p-6">
 | 
				
			||||||
 | 
					    <div class="flex items-center justify-between text-gray-500">
 | 
				
			||||||
 | 
					      <span>{{ title }}</span>
 | 
				
			||||||
 | 
					      <el-tag>{{ tag }}</el-tag>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					    <div class="flex flex-row items-baseline justify-between">
 | 
				
			||||||
 | 
					      <CountTo :prefix="prefix" :end-val="value" :decimals="decimals" class="text-3xl" />
 | 
				
			||||||
 | 
					      <span :class="toNumber(percent) > 0 ? 'text-red-500' : 'text-green-500'">
 | 
				
			||||||
 | 
					        {{ Math.abs(toNumber(percent)) }}%
 | 
				
			||||||
 | 
					        <Icon :icon="toNumber(percent) > 0 ? 'ep:caret-top' : 'ep:caret-bottom'" class="!text-sm" />
 | 
				
			||||||
 | 
					      </span>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					    <el-divider class="mb-1! mt-2!" />
 | 
				
			||||||
 | 
					    <div class="flex flex-row items-center justify-between text-sm">
 | 
				
			||||||
 | 
					      <span class="text-gray-500">昨日数据</span>
 | 
				
			||||||
 | 
					      <span>{{ prefix || '' }}{{ reference }}</span>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					  </div>
 | 
				
			||||||
 | 
					</template>
 | 
				
			||||||
 | 
					<script lang="ts" setup>
 | 
				
			||||||
 | 
					import { propTypes } from '@/utils/propTypes'
 | 
				
			||||||
 | 
					import { toNumber } from 'lodash-es'
 | 
				
			||||||
 | 
					import { calculateRelativeRate } from '@/utils'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 交易对照卡片 */
 | 
				
			||||||
 | 
					defineOptions({ name: 'ComparisonCard' })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const props = defineProps({
 | 
				
			||||||
 | 
					  title: propTypes.string.def('').isRequired,
 | 
				
			||||||
 | 
					  tag: propTypes.string.def(''),
 | 
				
			||||||
 | 
					  prefix: propTypes.string.def(''),
 | 
				
			||||||
 | 
					  value: propTypes.number.def(0).isRequired,
 | 
				
			||||||
 | 
					  reference: propTypes.number.def(0).isRequired,
 | 
				
			||||||
 | 
					  decimals: propTypes.number.def(0)
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 计算环比
 | 
				
			||||||
 | 
					const percent = computed(() =>
 | 
				
			||||||
 | 
					  calculateRelativeRate(props.value as number, props.reference as number)
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
@ -0,0 +1,91 @@
 | 
				
			|||||||
 | 
					<template>
 | 
				
			||||||
 | 
					  <el-card shadow="never">
 | 
				
			||||||
 | 
					    <template #header>
 | 
				
			||||||
 | 
					      <CardTitle title="用户统计" />
 | 
				
			||||||
 | 
					    </template>
 | 
				
			||||||
 | 
					    <!-- 折线图 -->
 | 
				
			||||||
 | 
					    <Echart :height="300" :options="lineChartOptions" />
 | 
				
			||||||
 | 
					  </el-card>
 | 
				
			||||||
 | 
					</template>
 | 
				
			||||||
 | 
					<script lang="ts" setup>
 | 
				
			||||||
 | 
					import dayjs from 'dayjs'
 | 
				
			||||||
 | 
					import { EChartsOption } from 'echarts'
 | 
				
			||||||
 | 
					import * as MemberStatisticsApi from '@/api/mall/statistics/member'
 | 
				
			||||||
 | 
					import { formatDate } from '@/utils/formatTime'
 | 
				
			||||||
 | 
					import { CardTitle } from '@/components/Card'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 会员用户统计卡片 */
 | 
				
			||||||
 | 
					defineOptions({ name: 'MemberStatisticsCard' })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const loading = ref(true) // 加载中
 | 
				
			||||||
 | 
					/** 折线图配置 */
 | 
				
			||||||
 | 
					const lineChartOptions = reactive<EChartsOption>({
 | 
				
			||||||
 | 
					  dataset: {
 | 
				
			||||||
 | 
					    dimensions: ['date', 'count'],
 | 
				
			||||||
 | 
					    source: []
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  grid: {
 | 
				
			||||||
 | 
					    left: 20,
 | 
				
			||||||
 | 
					    right: 20,
 | 
				
			||||||
 | 
					    bottom: 20,
 | 
				
			||||||
 | 
					    top: 80,
 | 
				
			||||||
 | 
					    containLabel: true
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  legend: {
 | 
				
			||||||
 | 
					    top: 50
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  series: [{ name: '注册量', type: 'line', smooth: true, areaStyle: {} }],
 | 
				
			||||||
 | 
					  toolbox: {
 | 
				
			||||||
 | 
					    feature: {
 | 
				
			||||||
 | 
					      // 数据区域缩放
 | 
				
			||||||
 | 
					      dataZoom: {
 | 
				
			||||||
 | 
					        yAxisIndex: false // Y轴不缩放
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      brush: {
 | 
				
			||||||
 | 
					        type: ['lineX', 'clear'] // 区域缩放按钮、还原按钮
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      saveAsImage: { show: true, name: '会员统计' } // 保存为图片
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  tooltip: {
 | 
				
			||||||
 | 
					    trigger: 'axis',
 | 
				
			||||||
 | 
					    axisPointer: {
 | 
				
			||||||
 | 
					      type: 'cross'
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    padding: [5, 10]
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  xAxis: {
 | 
				
			||||||
 | 
					    type: 'category',
 | 
				
			||||||
 | 
					    boundaryGap: false,
 | 
				
			||||||
 | 
					    axisTick: {
 | 
				
			||||||
 | 
					      show: false
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    axisLabel: {
 | 
				
			||||||
 | 
					      formatter: (date: string) => formatDate(date, 'MM-DD')
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  yAxis: {
 | 
				
			||||||
 | 
					    axisTick: {
 | 
				
			||||||
 | 
					      show: false
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}) as EChartsOption
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const getMemberRegisterCountList = async () => {
 | 
				
			||||||
 | 
					  loading.value = true
 | 
				
			||||||
 | 
					  // 查询最近一月数据
 | 
				
			||||||
 | 
					  const beginTime = dayjs().subtract(30, 'd').startOf('d')
 | 
				
			||||||
 | 
					  const endTime = dayjs().endOf('d')
 | 
				
			||||||
 | 
					  const list = await MemberStatisticsApi.getMemberRegisterCountList(beginTime, endTime)
 | 
				
			||||||
 | 
					  // 更新 Echarts 数据
 | 
				
			||||||
 | 
					  if (lineChartOptions.dataset && lineChartOptions.dataset['source']) {
 | 
				
			||||||
 | 
					    lineChartOptions.dataset['source'] = list
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  loading.value = false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 初始化 **/
 | 
				
			||||||
 | 
					onMounted(() => {
 | 
				
			||||||
 | 
					  getMemberRegisterCountList()
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
@ -0,0 +1,82 @@
 | 
				
			|||||||
 | 
					<template>
 | 
				
			||||||
 | 
					  <el-card shadow="never">
 | 
				
			||||||
 | 
					    <template #header>
 | 
				
			||||||
 | 
					      <CardTitle title="快捷入口" />
 | 
				
			||||||
 | 
					    </template>
 | 
				
			||||||
 | 
					    <div class="flex flex-row flex-wrap gap-8 p-4">
 | 
				
			||||||
 | 
					      <div
 | 
				
			||||||
 | 
					        v-for="menu in menuList"
 | 
				
			||||||
 | 
					        :key="menu.name"
 | 
				
			||||||
 | 
					        class="h-20 w-20% flex flex-col cursor-pointer items-center justify-center gap-2"
 | 
				
			||||||
 | 
					        @click="handleMenuClick(menu.routerName)"
 | 
				
			||||||
 | 
					      >
 | 
				
			||||||
 | 
					        <div
 | 
				
			||||||
 | 
					          :class="menu.bgColor"
 | 
				
			||||||
 | 
					          class="h-48px w-48px flex items-center justify-center rounded text-white"
 | 
				
			||||||
 | 
					        >
 | 
				
			||||||
 | 
					          <Icon :icon="menu.icon" class="text-7.5!" />
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					        <span>{{ menu.name }}</span>
 | 
				
			||||||
 | 
					      </div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					  </el-card>
 | 
				
			||||||
 | 
					</template>
 | 
				
			||||||
 | 
					<script lang="ts" setup>
 | 
				
			||||||
 | 
					/** 快捷入口卡片 */
 | 
				
			||||||
 | 
					import { CardTitle } from '@/components/Card'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					defineOptions({ name: 'ShortcutCard' })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const router = useRouter() // 路由
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 菜单列表 */
 | 
				
			||||||
 | 
					const menuList = [
 | 
				
			||||||
 | 
					  { name: '用户管理', icon: 'ep:user-filled', bgColor: 'bg-red-400', routerName: 'MemberUser' },
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    name: '商品管理',
 | 
				
			||||||
 | 
					    icon: 'fluent-mdl2:product',
 | 
				
			||||||
 | 
					    bgColor: 'bg-orange-400',
 | 
				
			||||||
 | 
					    routerName: 'ProductSpu'
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  { name: '订单管理', icon: 'ep:list', bgColor: 'bg-yellow-500', routerName: 'TradeOrder' },
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    name: '售后管理',
 | 
				
			||||||
 | 
					    icon: 'ri:refund-2-line',
 | 
				
			||||||
 | 
					    bgColor: 'bg-green-600',
 | 
				
			||||||
 | 
					    routerName: 'TradeAfterSale'
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    name: '分销管理',
 | 
				
			||||||
 | 
					    icon: 'fa-solid:project-diagram',
 | 
				
			||||||
 | 
					    bgColor: 'bg-cyan-500',
 | 
				
			||||||
 | 
					    routerName: 'TradeBrokerageUser'
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    name: '优惠券',
 | 
				
			||||||
 | 
					    icon: 'ep:ticket',
 | 
				
			||||||
 | 
					    bgColor: 'bg-blue-500',
 | 
				
			||||||
 | 
					    routerName: 'PromotionCoupon'
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    name: '拼团活动',
 | 
				
			||||||
 | 
					    icon: 'fa:group',
 | 
				
			||||||
 | 
					    bgColor: 'bg-purple-500',
 | 
				
			||||||
 | 
					    routerName: 'PromotionBargainActivity'
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    name: '佣金提现',
 | 
				
			||||||
 | 
					    icon: 'vaadin:money-withdraw',
 | 
				
			||||||
 | 
					    bgColor: 'bg-rose-500',
 | 
				
			||||||
 | 
					    routerName: 'TradeBrokerageWithdraw'
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 跳转到菜单对应页面
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param routerName 路由页面组件的名称
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					const handleMenuClick = (routerName: string) => {
 | 
				
			||||||
 | 
					  router.push({ name: routerName })
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
					Loading…
					
					
				
		Reference in New Issue