From 3b42a2709fd7508bf09fde3c4a8cd4ce0f7a1b59 Mon Sep 17 00:00:00 2001 From: furunxin <864795252@qq.com> Date: Mon, 10 Aug 2020 18:06:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=88=E5=90=8C=E5=95=86?= =?UTF-8?q?=E6=88=B7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxMerchantServiceImpl.java | 53 +++++++++---------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index 2cac7183e..9180725e4 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -247,13 +247,10 @@ public class WxMerchantServiceImpl implements WxMerchantService { return; } - if(!wxMerchant.getCarVendorType().equals(EnumCarVendor.CAR_NOTFOUND.getCode())){ + if (!wxMerchant.getCarVendorType().equals(EnumCarVendor.CAR_NOTFOUND.getCode())) { logger.info("不能停用停车商户"); return; } - - wxMerchant.setStatus(EnumMerchantStatus.NOT_VALID.getCode()); - wxMerchantMapper.updateById(wxMerchant); //是否有租赁合同 WxRentContract wxRentContract = new WxRentContract(); wxRentContract.setMerchantId(id); @@ -270,6 +267,8 @@ public class WxMerchantServiceImpl implements WxMerchantService { c.getStatus().equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())).count(); //解绑商铺-没有租赁合同或物业合同才可以 if (countRentContract == 0 || countPropertyContract == 0) { + wxMerchant.setStatus(EnumMerchantStatus.NOT_VALID.getCode()); + wxMerchantMapper.updateById(wxMerchant); WxMerchantShop wxMerchantShopQuery = new WxMerchantShop(); wxMerchantShopQuery.updateTenantInfo(wxMerchant); wxMerchantShopQuery.setMerchantId(wxMerchant.getId()); @@ -285,30 +284,30 @@ public class WxMerchantServiceImpl implements WxMerchantService { wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode()); wxShopMapper.updateById(wxShop); } + //解绑用户 + WxMerchantBUser bUser = new WxMerchantBUser(); + bUser.setMerchantId(wxMerchant.getId()); + List wxMerchantBUserMapperList = wxMerchantBUserMapper.findList(bUser); + for (WxMerchantBUser wxMerchantBUser : wxMerchantBUserMapperList) { + wxMerchantBUser.setStatus(EnumMerchantBUserStatus.INVALID.getCode()); + wxMerchantBUserMapper.updateById(wxMerchantBUser); + } + //作废卡券 + WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); + wxCouponMerchant.updateTenantInfo(wxMerchant); + wxCouponMerchant.setMerchantId(wxMerchant.getId()); + wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); + List wxCouponMerchantList = wxCouponMerchantMapper.findList(wxCouponMerchant); + List couponIds = wxCouponMerchantList.stream().map(cm -> cm.getProductId()).collect(Collectors.toList()); + + couponIds.stream().filter(cid -> !isCouponMerchantValid(cid)).forEach(cid -> { + WxCoupon wxCoupon = new WxCoupon(); + wxCoupon.setId(cid); + wxCoupon.updateTenantInfo(wxMerchant); + wxCoupon.setStatus(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()); + wxCouponService.saveOrUpdate(wxCoupon); + }); } - //解绑用户 - WxMerchantBUser bUser = new WxMerchantBUser(); - bUser.setMerchantId(wxMerchant.getId()); - List wxMerchantBUserMapperList = wxMerchantBUserMapper.findList(bUser); - for (WxMerchantBUser wxMerchantBUser : wxMerchantBUserMapperList) { - wxMerchantBUser.setStatus(EnumMerchantBUserStatus.INVALID.getCode()); - wxMerchantBUserMapper.updateById(wxMerchantBUser); - } - //作废卡券 - WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); - wxCouponMerchant.updateTenantInfo(wxMerchant); - wxCouponMerchant.setMerchantId(wxMerchant.getId()); - wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); - List wxCouponMerchantList = wxCouponMerchantMapper.findList(wxCouponMerchant); - List couponIds = wxCouponMerchantList.stream().map(cm->cm.getProductId()).collect(Collectors.toList()); - - couponIds.stream().filter(cid->!isCouponMerchantValid(cid)).forEach(cid->{ - WxCoupon wxCoupon = new WxCoupon(); - wxCoupon.setId(cid); - wxCoupon.updateTenantInfo(wxMerchant); - wxCoupon.setStatus(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()); - wxCouponService.saveOrUpdate(wxCoupon); - }); } @Transactional(rollbackFor = {Exception.class})