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})