Просмотр исходного кода

Merge branch 'release_real_200809' of https://git.malls.iformall.com/server/formallProject into release_real_200809

release_toaliyun_real
xiaohanzi 5 лет назад
Родитель
Сommit
6b34fab198
2 измененных файлов: 55 добавлений и 46 удалений
  1. +48
    -45
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java
  2. +7
    -1
      pom.xml

+ 48
- 45
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java Просмотреть файл

@@ -461,53 +461,56 @@ public class WxMerchantServiceImpl implements WxMerchantService {
wxMerchant.setUpdateDate(date);
wxMerchantMapper.updateById(wxMerchant);
List<Long> shopIds = wxMerchant.getShopids();
//如果原来店铺在商户里面有有效的合同,则不能操作
List<Long> oldShopIds = wxMerchantShopMapper.findShopIds(wxMerchant.getId());
List<Long> coldShopIds = new ArrayList<Long>();
if (null != oldShopIds && oldShopIds.size() > 0) {
coldShopIds.addAll(oldShopIds);
oldShopIds.removeAll(shopIds);
if (null != oldShopIds && oldShopIds.size() > 0 ) {
for (Long osid : oldShopIds) {
WxRentContract wrc = new WxRentContract();
wrc.setMerchantId(wxMerchant.getId());
wrc.setQueryShopId(osid);
wrc.setStatuss(EnumRentContractStatus.getValidStatus());
wrc.updateTenantInfo(wxMerchant);
List<WxRentContract> clist = wxRentContractService.findList(wrc);
if (null != clist && clist.size() > 0 ) {
return new ResultData(ErrorCode.MERCHANT_HASRENTCONTRACT.getCode(),"店铺["+osid+"]存在有效的合同,不能解除绑定.");
}
}
//都验证过了之后,先把之前的商铺释放,删除关系
wxShopMapper.updateUnRentByIds(oldShopIds);
wxMerchantShopMapper.realDelByMerchantId(wxMerchant.getId(),oldShopIds);
if(null != shopIds && shopIds.size() > 0){
//如果原来店铺在商户里面有有效的合同,则不能操作
List<Long> oldShopIds = wxMerchantShopMapper.findShopIds(wxMerchant.getId());
List<Long> coldShopIds = new ArrayList<Long>();
if (null != oldShopIds && oldShopIds.size() > 0) {
coldShopIds.addAll(oldShopIds);
oldShopIds.removeAll(shopIds);
if (null != oldShopIds && oldShopIds.size() > 0 ) {
for (Long osid : oldShopIds) {
WxRentContract wrc = new WxRentContract();
wrc.setMerchantId(wxMerchant.getId());
wrc.setQueryShopId(osid);
wrc.setStatuss(EnumRentContractStatus.getValidStatus());
wrc.updateTenantInfo(wxMerchant);
List<WxRentContract> clist = wxRentContractService.findList(wrc);
if (null != clist && clist.size() > 0 ) {
return new ResultData(ErrorCode.MERCHANT_HASRENTCONTRACT.getCode(),"店铺["+osid+"]存在有效的合同,不能解除绑定.");
}
}
//都验证过了之后,先把之前的商铺释放,删除关系
wxShopMapper.updateUnRentByIds(oldShopIds);
wxMerchantShopMapper.realDelByMerchantId(wxMerchant.getId(),oldShopIds);
}
}

if (null != shopIds) {
shopIds.removeAll(coldShopIds);
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);
}
}
}
}
if (null != shopIds) {
shopIds.removeAll(coldShopIds);
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);
}
}
}

return new ResultData(Result.SUCCESS, "商户更新成功");


+ 7
- 1
pom.xml Просмотреть файл

@@ -394,7 +394,13 @@
<version>1.4</version>
</dependency>


<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.8.0</version>
<scope>system</scope>
<systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>


</dependencies>


Загрузка…
Отмена
Сохранить