| | |
| | | import cn.lili.common.exception.ServiceException; |
| | | import cn.lili.modules.lmk.domain.entity.CouponVirtual; |
| | | import cn.lili.modules.lmk.domain.entity.StoreCouponSingle; |
| | | import cn.lili.modules.lmk.domain.query.StoreCouponSingleQuery; |
| | | import cn.lili.modules.lmk.enums.general.GenerateCouponStausEnum; |
| | | import cn.lili.modules.lmk.enums.general.StoreCouponStausEnum; |
| | | import cn.lili.modules.lmk.service.StoreCouponSingleService; |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Result getPageByStoreCoupon(StoreCouponSingleQuery query){ |
| | | return storeCouponSingleService.pageByRefId(query); |
| | | } |
| | | |
| | | private static StoreCouponSingle getStoreCouponSingle(StoreCoupon storeCoupon, int i) { |
| | | StoreCouponSingle storeCouponSingle = new StoreCouponSingle(); |
| | | storeCouponSingle.setStoreCoupRef(storeCoupon.getId()); |
| | |
| | | storeCouponSingle.setCouponNo(String.format("%08d", i)); |
| | | return storeCouponSingle; |
| | | } |
| | | |
| | | @Override |
| | | public Result changeStatus(String id) { |
| | | StoreCoupon storeCoupon = this.getById(id); |
| | | if (storeCoupon == null) { |
| | | throw new ServiceException("当前店铺优惠卷不存在"); |
| | | } |
| | | String status = storeCoupon.getStatus(); |
| | | if (StoreCouponStausEnum.ENABLE.name().equals(status)) { |
| | | storeCoupon.setStatus(StoreCouponStausEnum.DISABLE.name()); |
| | | }else if (StoreCouponStausEnum.DISABLE.name().equals(status)) { |
| | | storeCoupon.setStatus(StoreCouponStausEnum.ENABLE.name()); |
| | | }else { |
| | | throw new ServiceException("当前店铺优惠卷状态异常无法修改"); |
| | | } |
| | | this.updateById(storeCoupon); |
| | | return Result.ok(); |
| | | } |
| | | } |