|
|
|
@ -16,6 +16,7 @@ import com.logpm.report.vo.indexCount.IndexSignforDataVO;
|
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.checkerframework.checker.units.qual.A; |
|
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
|
import org.springblade.common.cache.CacheNames; |
|
|
|
|
import org.springblade.common.utils.CommonUtil; |
|
|
|
|
import org.springblade.core.redis.cache.BladeRedis; |
|
|
|
@ -463,40 +464,47 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IndexTrunklineHandOrderDataVO trunklineHandOrderData(IndexDTO indexDTO) { |
|
|
|
|
public List<IndexTrunklineHandOrderDataVO> trunklineHandOrderData(IndexDTO indexDTO) { |
|
|
|
|
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
String key = CacheNames.tenantKey(user.getTenantId(), user.getUserId() + "", "trunklineHandOrderData:" + indexDTO.toString()); |
|
|
|
|
IndexTrunklineHandOrderDataVO indexTrunklineHandOrderDataVO = bladeRedis.get(key); |
|
|
|
|
List<IndexTrunklineHandOrderDataVO> data = getIndexTrunklineHandOrderDataVOS(indexDTO); |
|
|
|
|
return data; |
|
|
|
|
|
|
|
|
|
if (Objects.isNull(indexTrunklineHandOrderDataVO)) { |
|
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
|
indexTrunklineHandOrderDataVO = new IndexTrunklineHandOrderDataVO(); |
|
|
|
|
if (warehouseIds.isEmpty()) { |
|
|
|
|
return indexTrunklineHandOrderDataVO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NotNull |
|
|
|
|
private List<IndexTrunklineHandOrderDataVO> getIndexTrunklineHandOrderDataVOS(IndexDTO indexDTO) { |
|
|
|
|
List<IndexTrunklineHandOrderDataVO> data = new ArrayList<>(); |
|
|
|
|
List<Long> warehouseIds = indexDTO.getWarehouseIds(); |
|
|
|
|
|
|
|
|
|
warehouseIds.forEach(warehouseId -> { |
|
|
|
|
|
|
|
|
|
String key = CacheNames.tenantKey(AuthUtil.getTenantId(), "trunklineHandOrderData", "warehouseId:" + warehouseId); |
|
|
|
|
IndexTrunklineHandOrderDataVO indexTrunklineHandOrderDataVO = bladeRedis.get(key); |
|
|
|
|
if (Objects.isNull(indexTrunklineHandOrderDataVO)) { |
|
|
|
|
indexTrunklineHandOrderDataVO = new IndexTrunklineHandOrderDataVO(); |
|
|
|
|
indexTrunklineHandOrderDataVO.setWarehouseId(warehouseId); |
|
|
|
|
JSONObject packageJson = warehouseIndexMapper.findPackageTrunklineHandOrderData(warehouseId); |
|
|
|
|
Integer packageWaybillNum = packageJson.getInteger("waybillNum"); |
|
|
|
|
Integer packageHandleNum = packageJson.getInteger("handleNum"); |
|
|
|
|
BigDecimal packageHandleWeight = packageJson.getBigDecimal("handleWeight"); |
|
|
|
|
BigDecimal packageHandleVolume = packageJson.getBigDecimal("handleVolume"); |
|
|
|
|
JSONObject zeroJson = warehouseIndexMapper.findZeroTrunklineHandOrderData(warehouseId); |
|
|
|
|
Integer zeroWaybillNum = zeroJson.getInteger("waybillNum"); |
|
|
|
|
Integer zeroHandleNum = zeroJson.getInteger("handleNum"); |
|
|
|
|
BigDecimal zeroHandleWeight = zeroJson.getBigDecimal("handleWeight"); |
|
|
|
|
BigDecimal zeroHandleVolume = zeroJson.getBigDecimal("handleVolume"); |
|
|
|
|
indexTrunklineHandOrderDataVO.setWaybillNum(packageWaybillNum + zeroWaybillNum); |
|
|
|
|
indexTrunklineHandOrderDataVO.setHandleNum(packageHandleNum + zeroHandleNum); |
|
|
|
|
indexTrunklineHandOrderDataVO.setHandleWeight(packageHandleWeight.add(zeroHandleWeight)); |
|
|
|
|
indexTrunklineHandOrderDataVO.setHandleVolume(packageHandleVolume.add(zeroHandleVolume)); |
|
|
|
|
|
|
|
|
|
indexTrunklineHandOrderDataVO.setWarehouseName(getCacheWarehouseName(indexTrunklineHandOrderDataVO.getWarehouseId())); |
|
|
|
|
|
|
|
|
|
data.add(indexTrunklineHandOrderDataVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//订制品
|
|
|
|
|
JSONObject packageJson = warehouseIndexMapper.findPackageTrunklineHandOrderData(indexDTO); |
|
|
|
|
Integer packageWaybillNum = packageJson.getInteger("waybillNum"); |
|
|
|
|
Integer packageHandleNum = packageJson.getInteger("handleNum"); |
|
|
|
|
BigDecimal packageHandleWeight = packageJson.getBigDecimal("handleWeight"); |
|
|
|
|
BigDecimal packageHandleVolume = packageJson.getBigDecimal("handleVolume"); |
|
|
|
|
//零担
|
|
|
|
|
JSONObject zeroJson = warehouseIndexMapper.findZeroTrunklineHandOrderData(indexDTO); |
|
|
|
|
Integer zeroWaybillNum = zeroJson.getInteger("waybillNum"); |
|
|
|
|
Integer zeroHandleNum = zeroJson.getInteger("handleNum"); |
|
|
|
|
BigDecimal zeroHandleWeight = zeroJson.getBigDecimal("handleWeight"); |
|
|
|
|
BigDecimal zeroHandleVolume = zeroJson.getBigDecimal("handleVolume"); |
|
|
|
|
|
|
|
|
|
indexTrunklineHandOrderDataVO.setWaybillNum(packageWaybillNum + zeroWaybillNum); |
|
|
|
|
indexTrunklineHandOrderDataVO.setHandleNum(packageHandleNum + zeroHandleNum); |
|
|
|
|
indexTrunklineHandOrderDataVO.setHandleWeight(packageHandleWeight.add(zeroHandleWeight)); |
|
|
|
|
indexTrunklineHandOrderDataVO.setHandleVolume(packageHandleVolume.add(zeroHandleVolume)); |
|
|
|
|
bladeRedis.setEx(key, indexTrunklineHandOrderDataVO, 3600L); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return indexTrunklineHandOrderDataVO; |
|
|
|
|
}); |
|
|
|
|
return data; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|