From 6bea3effaf3d6d086338043e8d861227b95cf2d2 Mon Sep 17 00:00:00 2001 From: 199901012 Date: Mon, 22 Mar 2021 19:28:42 +0800 Subject: [PATCH] =?UTF-8?q?'=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bweb/controller/HighCouponController.java | 17 ++++++++++++++++- .../java/com/hai/service/HighCouponService.java | 7 +++++++ .../hai/service/impl/HighCouponServiceImpl.java | 14 ++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java index c4c027f1..31b473c1 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java @@ -109,7 +109,7 @@ public class HighCouponController { throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, ""); } - String setCouponKey = DateUtil.date2String(new Date(), "yyyyMMddhhmmss") + ((Math.random()*9+1)*10000); //订单号生成 年月日小时分秒 + 5位随机数 + String setCouponKey = DateUtil.date2String(new Date(), "yyyyMMddhhmmss"); //订单号生成 年月日小时分秒 + 5位随机数 highCoupon.setCouponKey(setCouponKey); highCoupon.setCompanyId(merchant.getCompanyId()); highCoupon.setOperatorId(userInfoModel.getSecUser().getId()); @@ -255,6 +255,21 @@ public class HighCouponController { } } + @RequestMapping(value="/deleteCoupon",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "删除卡卷") + public ResponseData deleteCoupon(@RequestParam(name = "id", required = true) Long id) { + try { + + highCouponService.ofShelfCoupon(id); + + return ResponseMsgUtil.success("操作成功"); + } catch (Exception e) { + log.error("HighCouponController -> deleteCoupon() error!",e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/getCouponById",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据id 查询卡卷") diff --git a/hai-service/src/main/java/com/hai/service/HighCouponService.java b/hai-service/src/main/java/com/hai/service/HighCouponService.java index 49e48497..2ac64d35 100644 --- a/hai-service/src/main/java/com/hai/service/HighCouponService.java +++ b/hai-service/src/main/java/com/hai/service/HighCouponService.java @@ -61,6 +61,13 @@ public interface HighCouponService { **/ void ofShelfCoupon(Long id); + /** + * @Author 胡锐 + * @Description 删除 + * @Date 2021/3/22 19:25 + **/ + void deleteCoupon(Long id); + /** * @Author 胡锐 * @Description 价格审批结果 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java index ee44e081..eb90c8f8 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java @@ -186,6 +186,20 @@ public class HighCouponServiceImpl implements HighCouponService { highGoodsPriceReferService.couponAllInvalidKeepCurrent(coupon.getId()); } + @Override + public void deleteCoupon(Long id) { + HighCouponModel coupon = getCouponById(id); + if (coupon == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, ""); + } + //状态:0.删除 1.编辑中 2.已上架 3.已下架 101.上架审批中 102.上架审批驳回 + if (coupon.getStatus() != 1 && coupon.getStatus() != 102) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_UNABLE_UP_SHELF, ""); + } + coupon.setStatus(0); + highCouponMapper.updateByPrimaryKey(coupon); + } + @Override @Transactional(propagation= Propagation.REQUIRES_NEW) public void priceApproveResult(HighApprove highApprove) {