dev-discount
袁野 4 years ago
parent 496662b9a3
commit 4eeedb29e7
  1. 10
      hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java

@ -164,30 +164,29 @@ public class HighCouponController {
}
// 是否赠送卡卷
if (highCoupon.getIsPresent() == true) {
if (highCoupon.getIsPresent()) {
if (highCoupon.getHandselCouponId() == null || highCoupon.getHandselCouponId().size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.SELECT_HANDSEL_COUPON_ERROR, "");
}
HighCouponHandselModel highCouponHandsel;
// 上传数据与数据库对比,需要新增的数据
for (Long couponId : highCoupon.getHandselCouponId()) {
List<HighCouponHandselModel> collect = coupon.getHandselCouponList().stream().filter(o -> o.getHandselCouponId().equals(couponId)).collect(Collectors.toList());
if (collect == null || collect.size() == 0) {
if (collect.size() == 0) {
highCouponHandsel = new HighCouponHandselModel();
highCouponHandsel.setHandselCouponId(couponId);
highCouponHandsel.setCreateTime(new Date());
highCouponHandsel.setStatus(1);
highCouponHandsel.setOperatorId(userInfoModel.getSecUser().getId());
highCouponHandsel.setOperatorName(userInfoModel.getSecUser().getUserName());
highCoupon.getHandselCouponList().add(highCouponHandsel);
coupon.getHandselCouponList().add(highCouponHandsel);
}
}
// 上传数据与数据库对比,需要删除的数据
for (HighCouponHandsel handsel : coupon.getHandselCouponList()) {
List<Long> collect = highCoupon.getHandselCouponId().stream().filter(o -> o.equals(handsel.getHandselCouponId())).collect(Collectors.toList());
if (collect == null || collect.size() == 0) {
if (collect.size() == 0) {
handsel.setStatus(0);
}
}
@ -204,6 +203,7 @@ public class HighCouponController {
highCoupon.setOperatorId(userInfoModel.getSecUser().getId());
highCoupon.setOperatorName(userInfoModel.getSecUser().getUserName());
highCoupon.setUpdateTime(new Date());
highCoupon.setHandselCouponList(coupon.getHandselCouponList());
highCoupon.setStatus(3); // 状态:0.删除 1.编辑中 2.已上架 3.已下架 101.上架审批中 102.上架审批驳回
highCouponService.updateCoupon(highCoupon);

Loading…
Cancel
Save