zxl
4 小时以前 34cd76ac611c3422b3ab467c5b29d8476f266032
framework/src/main/java/cn/lili/modules/lmk/service/impl/StoreCouponClaimRecordServiceImpl.java
@@ -201,7 +201,6 @@
            storeCouponSingle.setClaimStatus(ClaimStatusEnum.CLAIM.name());
            storeCouponSingle.setClaimUserId(userId);
            storeCouponSingle.setClaimUserName(nickName);
            storeCouponSingleService.updateById(storeCouponSingle);
            //校验是否在单品卷类领取过
            LambdaQueryWrapper<StoreCoupon> storeCoupQuery = Wrappers.<StoreCoupon>lambdaQuery()
                    .eq(StoreCoupon::getId, storeCouponSingle.getStoreCoupRef()).last("FOR UPDATE");
@@ -213,12 +212,16 @@
                throw new ServiceException("当前店铺优惠卷状态异常");
            }
            //领取对应的优惠卷写入记录
            memberCouponService.receiveCoupon(storeCouponSingle.getCouponId(),userId , nickName);
            MemberCoupon memberCoupon = memberCouponService.receiveCoupon(storeCouponSingle.getCouponId(), userId, nickName);
            String memberCouponId = memberCoupon.getId();
            storeCouponSingle.setMemberCouponId(memberCouponId);
            storeCouponSingleService.updateById(storeCouponSingle);
            StoreCouponClaimRecord storeCouponClaimRecord = getStoreCouponClaimRecord(storeCouponSingle, userId);
            storeCouponClaimRecord.setMemberCouponId(memberCouponId);
            this.save(storeCouponClaimRecord);
            LambdaUpdateWrapper<StoreCoupon> updateStoreCoupon = Wrappers.<StoreCoupon>lambdaUpdate().eq(StoreCoupon::getId, storeCoupon.getId())
                    .set(StoreCoupon::getCouponClaimNum, storeCoupon.getCouponClaimNum() + 1)
                    .gt(StoreCoupon::getCouponClaimNum, storeCoupon.getCouponClaimNum() + 1);
                    .ge(StoreCoupon::getCouponNum, storeCoupon.getCouponClaimNum() + 1);
            boolean update = storeCouponService.update(updateStoreCoupon);
            if (!update) {
                throw new ServiceException("更新失败");
@@ -263,8 +266,8 @@
        Row header = sheet.createRow(0);
        String[] headers = {
                "会员名称", "优惠券名称", "发布店铺", "面额/折扣",
                 "获取方式", "会员优惠券状态", "优惠券类型",
                 "使用起始时间", "截止时间"
                 "获取方式", "会员优惠券状态", "优惠券类型","订单状态",
                 "使用起始时间", "截止时间","领取时间"
        };
        for (int i = 0; i < headers.length; i++) {
            Cell cell = header.createCell(i);
@@ -352,9 +355,33 @@
            }
            row.createCell(6).setCellValue(couponTypeDesc);
            //7.订单状态
            String orderStatusType = dto.getOrderStatus();
            System.out.println(orderStatusType);
            String orderStatusDesc;
            if ("UNPAID".equals(orderStatusType)) {
                orderStatusDesc = "未付款";
            } else if ("PAID".equals(orderStatusType)) {
                orderStatusDesc = "已付款";
            }else if ("UNDELIVERED".equals(orderStatusType)) {
                orderStatusDesc = "待发货";
            }else if ("DELIVERED".equals(orderStatusType)) {
                orderStatusDesc = "已发货";
            }else if ("COMPLETED".equals(orderStatusType)) {
                orderStatusDesc = "已完成";
            }else if ("STAY_PICKED_UP".equals(orderStatusType)) {
                orderStatusDesc = "待自提";
            }else if ("TAKE".equals(orderStatusType)) {
                orderStatusDesc = "待核验";
            }else if ("CANCELLED".equals(orderStatusType)) {
                orderStatusDesc = "已关闭";
            }else {
                orderStatusDesc ="未知";
            }
            Cell orderStatus = row.createCell(7);
            orderStatus.setCellValue(orderStatusDesc);
            // 10. 使用起始时间(处理null,格式化时间)
            Cell startTimeCell = row.createCell(7);
            Cell startTimeCell = row.createCell(8);
            if (Objects.nonNull(dto.getStartTime())) {
                startTimeCell.setCellValue(DateUtil.formatDateTime(dto.getStartTime()));
            } else {
@@ -362,12 +389,18 @@
            }
            // 11. 截止时间(同上)
            Cell endTimeCell = row.createCell(8);
            Cell endTimeCell = row.createCell(9);
            if (Objects.nonNull(dto.getEndTime())) {
                endTimeCell.setCellValue(DateUtil.formatDateTime(dto.getEndTime()));
            } else {
                endTimeCell.setCellValue("");
            }
            Cell claimTimeCell = row.createCell(10);
            if (Objects.nonNull(dto.getClaimTime())) {
                endTimeCell.setCellValue(DateUtil.formatDateTime(dto.getClaimTime()));
            } else {
                claimTimeCell.setCellValue("");
            }
        }
        return workbook;