|
|
|
@@ -464,10 +464,6 @@ public class WxMerchantServiceImpl implements WxMerchantService { |
|
|
|
//如果原来店铺在商户里面有有效的合同,则不能操作 |
|
|
|
List<Long> oldShopIds = wxMerchantShopMapper.findShopIds(wxMerchant.getId()); |
|
|
|
if (null != oldShopIds && oldShopIds.size() > 0) { |
|
|
|
if(null != shopIds) { |
|
|
|
//去重 |
|
|
|
oldShopIds.removeAll(shopIds); |
|
|
|
} |
|
|
|
for (Long osid : oldShopIds) { |
|
|
|
WxRentContract wrc = new WxRentContract(); |
|
|
|
wrc.setMerchantId(wxMerchant.getId()); |
|
|
|
@@ -484,22 +480,28 @@ public class WxMerchantServiceImpl implements WxMerchantService { |
|
|
|
//都验证过了之后,先把之前的商铺释放,删除关系 |
|
|
|
if (null != oldShopIds && oldShopIds.size() > 0 ) { |
|
|
|
wxShopMapper.updateUnRentByIds(oldShopIds); |
|
|
|
wxMerchantShopMapper.realDelByMerchantId(wxMerchant.getId()); |
|
|
|
for (Long sid: oldShopIds) { |
|
|
|
WxMerchantShop mcs = new WxMerchantShop(); |
|
|
|
mcs.setMerchantId(wxMerchant.getId()); |
|
|
|
mcs.setShopId(sid); |
|
|
|
mcs.setIsDel(EnumDelStatus.NOT_DEL.getCode()); |
|
|
|
mcs.setId(idWorker.nextId()); |
|
|
|
mcs.updateTenantInfo(wxMerchant); |
|
|
|
Date shopdate = new Date(); |
|
|
|
mcs.setUpdateDate(shopdate); |
|
|
|
mcs.setCreateDate(shopdate); |
|
|
|
wxMerchantShopMapper.insert(mcs); |
|
|
|
//更新商铺状态 |
|
|
|
WxShop sh = wxShopMapper.selectById(sid); |
|
|
|
sh.setStatus(EnumShopStatus.RENT.getCode()); |
|
|
|
wxShopMapper.updateById(sh); |
|
|
|
} |
|
|
|
wxMerchantShopMapper.realDelByMerchantId(wxMerchant.getId()); |
|
|
|
if (null != shopIds) { |
|
|
|
List<Long> currSIds = new ArrayList<Long>(); |
|
|
|
for (Long sid: shopIds) { |
|
|
|
if (!currSIds.contains(sid)) { |
|
|
|
WxMerchantShop mcs = new WxMerchantShop(); |
|
|
|
mcs.setMerchantId(wxMerchant.getId()); |
|
|
|
mcs.setShopId(sid); |
|
|
|
mcs.setIsDel(EnumDelStatus.NOT_DEL.getCode()); |
|
|
|
mcs.setId(idWorker.nextId()); |
|
|
|
mcs.updateTenantInfo(wxMerchant); |
|
|
|
Date shopdate = new Date(); |
|
|
|
mcs.setUpdateDate(shopdate); |
|
|
|
mcs.setCreateDate(shopdate); |
|
|
|
wxMerchantShopMapper.insert(mcs); |
|
|
|
//更新商铺状态 |
|
|
|
WxShop sh = wxShopMapper.selectById(sid); |
|
|
|
sh.setStatus(EnumShopStatus.RENT.getCode()); |
|
|
|
wxShopMapper.updateById(sh); |
|
|
|
currSIds.add(sid); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|