Commit 70e036a0 by 吕明尚

优惠卷领取记录增加作废和恢复功能

parent 387a6edf
package share.web.controller.system; package share.web.controller.system;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.annotation.Log; import share.common.annotation.Log;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType; import share.common.enums.BusinessType;
import share.common.enums.RoomType; import share.common.enums.RoomType;
import share.common.enums.StoreType; import share.common.enums.StoreType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.SConsumer; import share.system.domain.SConsumer;
import share.system.domain.SConsumerCoupon; import share.system.domain.SConsumerCoupon;
import share.system.service.ISConsumerCouponService; import share.system.service.ISConsumerCouponService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
import share.system.service.SConsumerService; import share.system.service.SConsumerService;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/** /**
* 优惠券领取记录Controller * 优惠券领取记录Controller
* *
...@@ -151,4 +143,16 @@ public class SConsumerCouponController extends BaseController ...@@ -151,4 +143,16 @@ public class SConsumerCouponController extends BaseController
public AjaxResult give(@RequestBody SConsumerCoupon sConsumerCoupon) { public AjaxResult give(@RequestBody SConsumerCoupon sConsumerCoupon) {
return toAjax(sConsumerCouponService.give(sConsumerCoupon)); return toAjax(sConsumerCouponService.give(sConsumerCoupon));
} }
@GetMapping("/cancelCoupon")
public AjaxResult cancelCoupon(Long id) {
return toAjax(sConsumerCouponService.cancelCoupon(id));
}
@GetMapping("/restoreCoupon")
public AjaxResult restoreCoupon(Long id) {
return toAjax(sConsumerCouponService.restoreCoupon(id));
}
} }
...@@ -80,4 +80,8 @@ public interface ISConsumerCouponService extends IService<SConsumerCoupon> ...@@ -80,4 +80,8 @@ public interface ISConsumerCouponService extends IService<SConsumerCoupon>
List<SConsumerCoupon> queryByIds(List<Long> couponIds); List<SConsumerCoupon> queryByIds(List<Long> couponIds);
List<SConsumerCoupon> queryList(); List<SConsumerCoupon> queryList();
int cancelCoupon(Long id);
int restoreCoupon(Long id);
} }
...@@ -430,6 +430,22 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe ...@@ -430,6 +430,22 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
return baseMapper.queryList(); return baseMapper.queryList();
} }
@Override
public int cancelCoupon(Long id) {
SConsumerCoupon sConsumerCoupon = new SConsumerCoupon();
sConsumerCoupon.setId(id);
sConsumerCoupon.setIsDelete(YesNoEnum.yes.getIndex());
return baseMapper.updateSConsumerCoupon(sConsumerCoupon);
}
@Override
public int restoreCoupon(Long id) {
SConsumerCoupon sConsumerCoupon = new SConsumerCoupon();
sConsumerCoupon.setId(id);
sConsumerCoupon.setIsDelete(YesNoEnum.no.getIndex());
return baseMapper.updateSConsumerCoupon(sConsumerCoupon);
}
private void extracted(SConsumerCoupon item, BigDecimal bigDecimal, SRoom byId, BigDecimal subtract, SStore sStore) { private void extracted(SConsumerCoupon item, BigDecimal bigDecimal, SRoom byId, BigDecimal subtract, SStore sStore) {
//计算价格 //计算价格
BigDecimal multiply = bigDecimal.multiply(byId.getPrice()); BigDecimal multiply = bigDecimal.multiply(byId.getPrice());
......
...@@ -470,7 +470,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -470,7 +470,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} else { } else {
// 使用中订单断电, 延时3分钟断电 // 使用中订单断电, 延时3分钟断电
deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(),
OpTypeEnum.CUT_ELECTRIC.getCode(), true, 180); OpTypeEnum.CUT_ELECTRIC.getCode(), true, 10);
} }
} else if (one.getStatus().equals(OrderStatusEnum.INUSE.getCode())) { } else if (one.getStatus().equals(OrderStatusEnum.INUSE.getCode())) {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
<include refid="selectSConsumerCouponVo"/> <include refid="selectSConsumerCouponVo"/>
where where
1=1 1=1
and is_delete = '0' <if test="isDelete != null ">and is_delete = #{isDelete}</if>
<if test="consumerId != null "> and consumer_id = #{consumerId}</if> <if test="consumerId != null "> and consumer_id = #{consumerId}</if>
<if test="couponId != null "> and coupon_id = #{couponId}</if> <if test="couponId != null "> and coupon_id = #{couponId}</if>
<if test="storeId !=null">and store_id = #{storeId}</if> <if test="storeId !=null">and store_id = #{storeId}</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment