Browse Source

1.修复库位缓存清除问题

dist.1.3.0
zhenghaoyu 5 months ago
parent
commit
87caf7e753
  1. 21
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAllocationServiceImpl.java
  2. 20
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsShelfServiceImpl.java

21
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAllocationServiceImpl.java

@ -48,6 +48,7 @@ import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
@ -57,10 +58,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -88,6 +86,8 @@ public class BasicdataGoodsAllocationServiceImpl extends BaseServiceImpl<Basicda
private final IWarehouseUpdownGoodsClient warehouseUpdownGoodsClient;
private final BladeRedis bladeRedis;
@Override
public IPage<BasicdataGoodsAllocationVO> selectBasicdataGoodsAllocationPage(IPage<BasicdataGoodsAllocationVO> page, BasicdataGoodsAllocationVO BasicdataGoodsAllocation) {
@ -278,6 +278,12 @@ public class BasicdataGoodsAllocationServiceImpl extends BaseServiceImpl<Basicda
boolean update = this.update(new UpdateWrapper<BasicdataGoodsAllocationEntity>().lambda()
.set(BasicdataGoodsAllocationEntity::getEnableStatus, 1)
.in(BasicdataGoodsAllocationEntity::getId, Func.toLongList(ids)));
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseService.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
bladeRedis.del("warehouse:all:allocationIds:" + myCurrentWarehouse.getId());
}
return update ? R.success("成功") : R.fail("失败");
}
@ -293,6 +299,13 @@ public class BasicdataGoodsAllocationServiceImpl extends BaseServiceImpl<Basicda
boolean update = this.update(new UpdateWrapper<BasicdataGoodsAllocationEntity>().lambda()
.set(BasicdataGoodsAllocationEntity::getEnableStatus, 2)
.in(BasicdataGoodsAllocationEntity::getId, Func.toLongList(ids)));
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
if(!Objects.isNull(myCurrentWarehouse)){
bladeRedis.del("warehouse:all:allocationIds:" + myCurrentWarehouse.getId());
}
return update ? R.success("成功") : R.fail("失败");
}

20
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsShelfServiceImpl.java

@ -28,10 +28,8 @@ import com.logpm.basic.feign.IBasicPrintTemplateClient;
import com.logpm.basic.feign.IBasicTenantCodeClient;
import com.logpm.basicdata.dto.BasicdataGoodsShelfDTO;
import com.logpm.basicdata.entity.BasicdataGoodsAllocationEntity;
import com.logpm.basicdata.entity.BasicdataGoodsAreaEntity;
import com.logpm.basicdata.entity.BasicdataGoodsShelfEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.excel.BasicdataGoodsAreaExcel;
import com.logpm.basicdata.excel.BasicdataGoodsShelfExcel;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.basicdata.mapper.BasicdataGoodsAllocationMapper;
@ -47,6 +45,7 @@ import org.springblade.common.utils.FileUtil;
import org.springblade.common.utils.QRCodeUtil;
import org.springblade.common.utils.TemplateUtil;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
@ -93,6 +92,8 @@ public class BasicdataGoodsShelfServiceImpl extends BaseServiceImpl<BasicdataGoo
private IBasicdataWarehouseService basicdataWarehouseService;
private BladeRedis bladeRedis;
@ -137,6 +138,9 @@ public class BasicdataGoodsShelfServiceImpl extends BaseServiceImpl<BasicdataGoo
log.error("仓库货区信息不合法");
throw new RuntimeException("请完善货区信息!!!");
}
Long warehouseId = basicdataGoodsShelfDTO.getWarehouseId();
// BasicdataWarehouseEntity basicdataWarehouseVO = basicdataWarehouseClient.getMyCurrentWarehouse();
// if (Objects.isNull(basicdataWarehouseVO)){
// throw new RuntimeException("当前登录人没有选择仓库!!!");
@ -194,6 +198,7 @@ public class BasicdataGoodsShelfServiceImpl extends BaseServiceImpl<BasicdataGoo
// }
// }
// basicdataGoodsAllocationService.saveBatch(arrayList);
bladeRedis.del("warehouse:all:allocationIds:" + warehouseId);
return result;
}
@ -206,8 +211,12 @@ public class BasicdataGoodsShelfServiceImpl extends BaseServiceImpl<BasicdataGoo
return result;
}
BasicdataGoodsShelfEntity goodsShelfEntity = this.getById(basicdataGoodsShelfDTO.getId());
Long warehouseId = goodsShelfEntity.getWarehouseId();
BeanUtils.copyProperties(basicdataGoodsShelfDTO, goodsShelfEntity);
result = SqlHelper.retBool(basicdataGoodsShelfMapper.updateById(goodsShelfEntity));
bladeRedis.del("warehouse:all:allocationIds:" + warehouseId);
return result;
}
@ -242,6 +251,12 @@ public class BasicdataGoodsShelfServiceImpl extends BaseServiceImpl<BasicdataGoo
.in(BasicdataGoodsAllocationEntity::getGoodsShelfId, longs)
);
int i = basicdataGoodsShelfMapper.deleteBatchIds(longs);
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
if(!Objects.isNull(myCurrentWarehouse)){
bladeRedis.del("warehouse:all:allocationIds:" + myCurrentWarehouse.getId());
}
return i > 0 ? R.success("删除成功") : R.fail("删除失败");
}
@ -662,6 +677,7 @@ public class BasicdataGoodsShelfServiceImpl extends BaseServiceImpl<BasicdataGoo
}
}
}
bladeRedis.del("warehouse:all:allocationIds:" + ck);
return R.fail("无法新增");
}

Loading…
Cancel
Save