Browse Source

1.增加首页的干线数据查询 返回仓库信息

fix-sign
pref_mail@163.com 4 months ago
parent
commit
6151850972
  1. 111
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataWarehouseClient.java
  2. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java
  3. 22
      blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/WarehouseIndexServiceImpl.java

111
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataWarehouseClient.java

@ -29,10 +29,12 @@ import com.logpm.basicdata.service.IBasicdataWarehouseService;
import com.logpm.basicdata.vo.BasicdataWarehouseVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.cache.CacheNames;
import org.springblade.core.mp.support.BladePage;
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.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.IDeptClient;
@ -56,53 +58,53 @@ import java.util.stream.Collectors;
@Slf4j
public class BasicdataWarehouseClient implements IBasicdataWarehouseClient {
private final IBasicdataWarehouseService warehouseWarehouseService;
private final IBasicdataWarehouseService warehouseWarehouseService;
private final IDeptClient deptClient;
private final BladeRedis bladeRedis;
@Override
@GetMapping(TOP)
public BladePage<BasicdataWarehouseEntity> topWarehouse(Integer current, Integer size) {
Query query = new Query();
query.setCurrent(current);
query.setSize(size);
IPage<BasicdataWarehouseEntity> page = warehouseWarehouseService.page(Condition.getPage(query));
return BladePage.of(page);
}
@Override
@GetMapping(TOP)
public BladePage<BasicdataWarehouseEntity> topWarehouse(Integer current, Integer size) {
Query query = new Query();
query.setCurrent(current);
query.setSize(size);
IPage<BasicdataWarehouseEntity> page = warehouseWarehouseService.page(Condition.getPage(query));
return BladePage.of(page);
}
@Override
public BasicdataWarehouseEntity findByName(String destinationWarehouse) {
QueryWrapper<BasicdataWarehouseEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("name",destinationWarehouse);
queryWrapper.eq("name", destinationWarehouse);
return warehouseWarehouseService.getOne(queryWrapper);
}
/**
* 查询仓库数据
*/
*/
@Override
public BasicdataWarehouseEntity getWarehouse(String name, String warehouseCode) {
return warehouseWarehouseService.getOne(Wrappers.<BasicdataWarehouseEntity>query().lambda()
.eq(StringUtils.isNotEmpty(name),BasicdataWarehouseEntity::getName,name)
.eq(StringUtils.isNotEmpty(warehouseCode),BasicdataWarehouseEntity::getWarehouseCode,warehouseCode)
.eq(StringUtils.isNotEmpty(name), BasicdataWarehouseEntity::getName, name)
.eq(StringUtils.isNotEmpty(warehouseCode), BasicdataWarehouseEntity::getWarehouseCode, warehouseCode)
);
}
@Override
public BasicdataWarehouseEntity getWarehouseByOldId(Integer id) {
QueryWrapper<BasicdataWarehouseEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("old_id",id);
queryWrapper.eq("old_id", id);
return warehouseWarehouseService.getOne(queryWrapper);
}
@Override
public Long addWarehouse(BasicdataWarehouseEntity newEntity) {
boolean saveFlag = warehouseWarehouseService.save(newEntity);
if(saveFlag){
if (saveFlag) {
return newEntity.getId();
}else{
} else {
return null;
}
}
@ -111,15 +113,15 @@ public class BasicdataWarehouseClient implements IBasicdataWarehouseClient {
public BasicdataWarehouseEntity getWarehouseEntityByWarehouseCode(String warehouseCode) {
QueryWrapper<BasicdataWarehouseEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("warehouse_code",warehouseCode)
.eq("is_deleted",0)
.eq("enable_status",2);
queryWrapper.eq("warehouse_code", warehouseCode)
.eq("is_deleted", 0)
.eq("enable_status", 2);
List<BasicdataWarehouseEntity> list = warehouseWarehouseService.list(queryWrapper);
if(!Objects.isNull(list) && !list.isEmpty()){
if (!Objects.isNull(list) && !list.isEmpty()) {
return list.get(0);
}else{
} else {
return null;
}
@ -128,34 +130,37 @@ public class BasicdataWarehouseClient implements IBasicdataWarehouseClient {
/**
* 查看当前登录人能够操作的仓库列表
*
* @return
*/
@GetMapping(API_PREFIX+"/getMyWarehouseList")
@GetMapping(API_PREFIX + "/getMyWarehouseList")
@Override
public List<BasicdataWarehouseEntity> getMyWarehouseList() {
return warehouseWarehouseService.getMyWarehouseList();
return warehouseWarehouseService.getMyWarehouseList();
}
/**
* 将用户当前选择仓库存放至Redis
*
* @param warehouseEntity
* @return
*/
@PostMapping(API_PREFIX+"/preserveCurrentWarehouse")
@PostMapping(API_PREFIX + "/preserveCurrentWarehouse")
@Override
public BasicdataWarehouseEntity preserveCurrentWarehouse(BasicdataWarehouseEntity warehouseEntity) {
warehouseWarehouseService.preserveCurrentMyWarehouse( warehouseEntity);
warehouseWarehouseService.preserveCurrentMyWarehouse(warehouseEntity);
return warehouseEntity;
}
/**
* 根据当前登录人获取Redis中用户选择的仓库信息
*
* @return
*/
@GetMapping(API_PREFIX+"/getMyCurrentWarehouse")
@GetMapping(API_PREFIX + "/getMyCurrentWarehouse")
@Override
public BasicdataWarehouseEntity getMyCurrentWarehouse() {
return warehouseWarehouseService.getMyCurrentWarehouse();
return warehouseWarehouseService.getMyCurrentWarehouse();
}
@Override
@ -188,13 +193,13 @@ public class BasicdataWarehouseClient implements IBasicdataWarehouseClient {
}
@Override
@GetMapping(API_PREFIX+"/getMyWatchWarehouse")
@GetMapping(API_PREFIX + "/getMyWatchWarehouse")
public List<BasicdataWarehouseEntity> getMyWatchWarehouse() {
return warehouseWarehouseService.getMyWatchWarehouse();
}
@Override
@GetMapping(API_PREFIX+"/clearWarehouseCache")
@GetMapping(API_PREFIX + "/clearWarehouseCache")
public R clearWarehouseCache() {
return warehouseWarehouseService.clearWarehouseCache();
}
@ -240,31 +245,37 @@ public class BasicdataWarehouseClient implements IBasicdataWarehouseClient {
@Override
public BasicdataWarehouseEntity getEntityWarehouseId(Long warehouseId) {
return warehouseWarehouseService.getById(warehouseId);
// 增加缓存
String key = CacheNames.tenantKey(AuthUtil.getTenantId(), "getEntityWarehouseId", ":" + warehouseId);
BasicdataWarehouseEntity o = bladeRedis.get(key);
if (Objects.isNull(o)) {
o = warehouseWarehouseService.getById(warehouseId);
bladeRedis.setEx(key, o, 60L);
}
return o;
}
@Override
public List<JSONObject> findWarehouseList(String warehouseName) {
List<BasicdataWarehouseEntity> ls = warehouseWarehouseService.findWarehouseList(warehouseName);
List<JSONObject> list = new ArrayList<>();
for (BasicdataWarehouseEntity warehouseEntity:ls){
for (BasicdataWarehouseEntity warehouseEntity : ls) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("warehouseId",warehouseEntity.getId());
jsonObject.put("warehouseName",warehouseEntity.getName());
jsonObject.put("linkMan",warehouseEntity.getLinkman());
jsonObject.put("linkPhone",warehouseEntity.getContactNumber());
jsonObject.put("linkAddress",warehouseEntity.getWarehouseAddress());
jsonObject.put("warehouseId", warehouseEntity.getId());
jsonObject.put("warehouseName", warehouseEntity.getName());
jsonObject.put("linkMan", warehouseEntity.getLinkman());
jsonObject.put("linkPhone", warehouseEntity.getContactNumber());
jsonObject.put("linkAddress", warehouseEntity.getWarehouseAddress());
list.add(jsonObject);
}
return list;
}
@Override
public List<BasicdataWarehouseEntity> findAllList() {
return warehouseWarehouseService.list(Wrappers.<BasicdataWarehouseEntity>lambdaQuery()
.eq(BasicdataWarehouseEntity::getEnableStatus,2)
.eq(BasicdataWarehouseEntity::getEnableStatus, 2)
);
}
@ -273,19 +284,19 @@ public class BasicdataWarehouseClient implements IBasicdataWarehouseClient {
List<BasicdataWarehouseEntity> list = warehouseWarehouseService.list(Wrappers.<BasicdataWarehouseEntity>lambdaQuery()
.eq(BasicdataWarehouseEntity::getEnableStatus, 2)
);
if(CollUtil.isNotEmpty(list)){
if (CollUtil.isNotEmpty(list)) {
for (BasicdataWarehouseEntity warehouseEntity : list) {
Long department = warehouseEntity.getDepartment();
if(ObjectUtil.isNotNull(department)){
if (ObjectUtil.isNotNull(department)) {
Dept dept = deptClient.findEntityById(department);
if(ObjectUtil.isNotEmpty(dept)){
if (ObjectUtil.isNotEmpty(dept)) {
Integer deptCategory = dept.getDeptCategory();
if(NumberUtil.equals(deptCategory,2)){
if (NumberUtil.equals(deptCategory, 2)) {
warehouseEntity.setBusinessLine(dept.getDeptName());
} else {
Long parentId = dept.getParentId();
Dept parentDept = deptClient.findEntityById(parentId);
if(ObjectUtil.isNotEmpty(parentDept)){
if (ObjectUtil.isNotEmpty(parentDept)) {
warehouseEntity.setBusinessLine(parentDept.getDeptName());
}
}
@ -298,21 +309,21 @@ public class BasicdataWarehouseClient implements IBasicdataWarehouseClient {
@Override
public List<BasicdataWarehouseEntity> findWarehousesByIds(List<Long> ids) {
if(CollUtil.isNotEmpty(ids)){
if (CollUtil.isNotEmpty(ids)) {
List<BasicdataWarehouseEntity> list = warehouseWarehouseService.list(Wrappers.<BasicdataWarehouseEntity>lambdaQuery().in(BasicdataWarehouseEntity::getId, ids.stream().collect(Collectors.toSet())));
if(CollUtil.isNotEmpty(list)){
if (CollUtil.isNotEmpty(list)) {
for (BasicdataWarehouseEntity warehouseEntity : list) {
Long department = warehouseEntity.getDepartment();
if(ObjectUtil.isNotNull(department)){
if (ObjectUtil.isNotNull(department)) {
Dept dept = deptClient.findEntityById(department);
if(ObjectUtil.isNotEmpty(dept)){
if (ObjectUtil.isNotEmpty(dept)) {
Integer deptCategory = dept.getDeptCategory();
if(NumberUtil.equals(deptCategory,2)){
if (NumberUtil.equals(deptCategory, 2)) {
warehouseEntity.setBusinessLine(dept.getDeptName());
} else {
Long parentId = dept.getParentId();
Dept parentDept = deptClient.findEntityById(parentId);
if(ObjectUtil.isNotEmpty(parentDept)){
if (ObjectUtil.isNotEmpty(parentDept)) {
warehouseEntity.setBusinessLine(parentDept.getDeptName());
}
}

10
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -2790,15 +2790,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
// }
// }
List<Long> warehouseIdList = new ArrayList<>();
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if (Func.isEmpty(myCurrentWarehouse)) {
List<BasicdataWarehouseEntity> myWarehouseList = warehouseClient.getMyWarehouseList();
List<Long> collect = myWarehouseList.stream().map(BasicdataWarehouseEntity::getId).collect(Collectors.toList());
warehouseIdList.addAll(collect);
} else {
warehouseIdList.add(myCurrentWarehouse.getId());
}
List<Long> warehouseIdList =warehouseClient.getWarehouseIds();
stockArticleEntity.setOpenTimeStart(CommonUtil.getStartByDateStr(stockArticleEntity.getOpenTimeStartStr()));
stockArticleEntity.setOpenTimeEnd(CommonUtil.getEndByDateStr(stockArticleEntity.getOpenTimeEndStr()));

22
blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/WarehouseIndexServiceImpl.java

@ -1,11 +1,13 @@
package com.logpm.report.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.report.dto.IndexDTO;
import com.logpm.report.mapper.WarehouseIndexMapper;
import com.logpm.report.service.IWarehouseIndexService;
import com.logpm.report.typepage.TimeType;
import com.logpm.report.vo.*;
import com.logpm.report.vo.indexCount.IndexDeliveryDataVO;
import com.logpm.report.vo.indexCount.IndexOpenItemDataByWarWarehouseIdVO;
@ -919,9 +921,29 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService {
// 卸车完成 目的仓当前仓 点了卸车完成了
Integer unloadCompleteNum = warehouseIndexMapper.findCarsStattisUnloadCompleteNum(warehouseId);
carsStattisNumVO.setUnloadCompleteNum(unloadCompleteNum);
carsStattisNumVO.setWarehouseId(warehouseId);
carsStattisNumVO.setWarehouseName(getCacheWarehouseName(warehouseId));
}
data.add(carsStattisNumVO);
}
return data;
}
private String getCacheWarehouseName(Long warehouseId) {
String key = CacheNames.tenantKey(AuthUtil.getTenantId(), "warehouseName", "warehouseId:" + warehouseId);
String warehouseName = bladeRedis.get(key);
if (StrUtil.isEmpty(warehouseName)) {
BasicdataWarehouseEntity entityWarehouseId = warehouseClient.getEntityWarehouseId(warehouseId);
warehouseName = entityWarehouseId.getName();
bladeRedis.setEx(key, warehouseName, 60L);
}
return warehouseName;
}
}

Loading…
Cancel
Save