diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseDispatchTrainDetailChangeEntity.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseDispatchTrainDetailChangeEntity.java
index 0d930e1cc..86352e7c8 100644
--- a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseDispatchTrainDetailChangeEntity.java
+++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseDispatchTrainDetailChangeEntity.java
@@ -60,6 +60,6 @@ public class ExpenseDispatchTrainDetailChangeEntity extends TenantEntity {
* 结算表id
*/
@ApiModelProperty(value = "结算表id")
- private String detailId;
+ private Long detailId;
}
diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchTrainDetailMapper.xml b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchTrainDetailMapper.xml
index bc9d2c827..68e9e287e 100644
--- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchTrainDetailMapper.xml
+++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchTrainDetailMapper.xml
@@ -19,6 +19,9 @@
and settlement_status = #{expenseDispatchTrainDetail.settlementStatus}
+
+ and delivery_driver = #{expenseDispatchTrainDetail.deliveryDriver}
+
and settlement_year = #{expenseDispatchTrainDetail.settlementYear}
diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/query/ExpenseDispatchTrainDetailQuery.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/query/ExpenseDispatchTrainDetailQuery.java
index 79788c518..8080f6230 100644
--- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/query/ExpenseDispatchTrainDetailQuery.java
+++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/query/ExpenseDispatchTrainDetailQuery.java
@@ -18,6 +18,11 @@ public class ExpenseDispatchTrainDetailQuery extends Query {
*/
@ApiModelProperty(value = "配送日期结束")
private String deliveryDateEnd;
+ /**
+ * 配送司机
+ */
+ @ApiModelProperty(value = "配送司机")
+ private String deliveryDriver;
/**
* 车次号
*/
diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseDispatchTrainDetailServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseDispatchTrainDetailServiceImpl.java
index a1fe436fd..0c5f8072b 100644
--- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseDispatchTrainDetailServiceImpl.java
+++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseDispatchTrainDetailServiceImpl.java
@@ -18,8 +18,11 @@ package com.logpm.statistics.service.impl;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
+import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.statistics.entity.ExpenseDispatchTrainDetailChangeEntity;
import com.logpm.statistics.entity.ExpenseDispatchTrainDetailEntity;
import com.logpm.statistics.excel.ExpenseDispatchTrainDetailExcel;
@@ -40,6 +43,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
+import java.util.stream.Collectors;
/**
* 配送成本-车次成本明细表 服务实现类
@@ -52,13 +56,29 @@ public class ExpenseDispatchTrainDetailServiceImpl extends BaseServiceImpl selectExpenseDispatchTrainDetailPage(ExpenseDispatchTrainDetailQuery query) {
IPage page = Condition.getPage(query);
+ // 增加仓库权限
+ buildWarehouseAuth(query);
return page.setRecords(baseMapper.selectExpenseDispatchTrainDetailPage(page, query));
}
+ private void buildWarehouseAuth(ExpenseDispatchTrainDetailQuery query) {
+ if (StrUtil.isEmpty(query.getDestinationWarehouse())) {
+ BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
+ if (ObjectUtil.isNotEmpty(myCurrentWarehouse)) {
+ query.setDestinationWarehouse(myCurrentWarehouse.getName());
+ } else {
+ List warehouseEntities = warehouseClient.getMyWarehouseList();
+ query.setDestinationWarehouse(warehouseEntities.stream().map(BasicdataWarehouseEntity::getName).collect(Collectors.joining(",")));
+ }
+ }
+ }
+
@Override
public List exportExpenseDispatchTrainDetail(Wrapper queryWrapper) {
@@ -94,6 +114,7 @@ public class ExpenseDispatchTrainDetailServiceImpl extends BaseServiceImpl page = Condition.getPage(query);
page.setSize(-1);
page.setCurrent(1);
+ buildWarehouseAuth(query);
List list = baseMapper.selectExpenseDispatchTrainDetailPage(page, query);
ExcelUtil.export(response, list, ExpenseDispatchTrainDetailVO.class);
diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseDispatchWarehouseMonthServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseDispatchWarehouseMonthServiceImpl.java
index 0fad66a89..fb3991abe 100644
--- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseDispatchWarehouseMonthServiceImpl.java
+++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseDispatchWarehouseMonthServiceImpl.java
@@ -20,8 +20,11 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
+import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.statistics.entity.ExpenseDispatchWarehouseMonthEntity;
import com.logpm.statistics.excel.ExpenseDispatchWarehouseMonthExcel;
import com.logpm.statistics.mapper.ExpenseDispatchWarehouseMonthMapper;
@@ -34,8 +37,10 @@ import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
+import java.util.stream.Collectors;
/**
* 配送成本-仓库月度配送成本 服务实现类
@@ -47,6 +52,8 @@ import java.util.List;
public class ExpenseDispatchWarehouseMonthServiceImpl extends BaseServiceImpl implements IExpenseDispatchWarehouseMonthService {
private final CollectorRegistry collectorRegistry;
+ @Resource
+ private IBasicdataWarehouseClient warehouseClient;
public ExpenseDispatchWarehouseMonthServiceImpl(CollectorRegistry collectorRegistry) {
this.collectorRegistry = collectorRegistry;
@@ -55,9 +62,22 @@ public class ExpenseDispatchWarehouseMonthServiceImpl extends BaseServiceImpl selectExpenseDispatchWarehouseMonthPage(ExpenseDispatchTrainDetailMonthQuery query) {
IPage page = Condition.getPage(query);
+ buildWarehouseAuth(query);
return page.setRecords(baseMapper.selectExpenseDispatchWarehouseMonthPage(page, query));
}
+ private void buildWarehouseAuth(ExpenseDispatchTrainDetailMonthQuery query) {
+ if (StrUtil.isEmpty(query.getDestinationWarehouse())) {
+ BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
+ if (ObjectUtil.isNotEmpty(myCurrentWarehouse)) {
+ query.setDestinationWarehouse(myCurrentWarehouse.getName());
+ } else {
+ List warehouseEntities = warehouseClient.getMyWarehouseList();
+ query.setDestinationWarehouse(warehouseEntities.stream().map(BasicdataWarehouseEntity::getName).collect(Collectors.joining(",")));
+ }
+ }
+ }
+
@Override
public List exportExpenseDispatchWarehouseMonth(Wrapper queryWrapper) {
@@ -86,6 +106,7 @@ public class ExpenseDispatchWarehouseMonthServiceImpl extends BaseServiceImpl page = Condition.getPage(query);
page.setSize(-1);
page.setCurrent(1);
+ buildWarehouseAuth(query);
List list = baseMapper.selectExpenseDispatchWarehouseMonthPage(page, query);
ExcelUtil.export(response, list, ExpenseDispatchWarehouseMonthVO.class);
}
diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseOrderWarehouseTotalServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseOrderWarehouseTotalServiceImpl.java
index f079a32d9..c9140ee39 100644
--- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseOrderWarehouseTotalServiceImpl.java
+++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseOrderWarehouseTotalServiceImpl.java
@@ -16,7 +16,11 @@
*/
package com.logpm.statistics.service.impl;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
+import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.statistics.entity.ExpenseWarehouseOrderEntity;
import com.logpm.statistics.mapper.ExpenseOrderWarehouseTotalMapper;
import com.logpm.statistics.query.ExpenseWarehouseOrderQuery;
@@ -27,8 +31,10 @@ import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
+import java.util.stream.Collectors;
/**
* 订单总仓储成本明细 服务实现类
@@ -39,17 +45,34 @@ import java.util.List;
@Service
public class ExpenseOrderWarehouseTotalServiceImpl extends BaseServiceImpl implements IExpenseOrderWarehouseTotalService {
+ @Resource
+ private IBasicdataWarehouseClient warehouseClient;
+
@Override
public IPage orderPage(ExpenseWarehouseOrderQuery query) {
IPage page = Condition.getPage(query);
+ buildWarehouseAuth(query);
return page.setRecords(baseMapper.selectExpenseOrderWarehouseTotalPage(page, query));
}
+ private void buildWarehouseAuth(ExpenseWarehouseOrderQuery query) {
+ if (StrUtil.isEmpty(query.getWarehouseName())) {
+ BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
+ if (ObjectUtil.isNotEmpty(myCurrentWarehouse)) {
+ query.setWarehouseName(myCurrentWarehouse.getName());
+ } else {
+ List warehouseEntities = warehouseClient.getMyWarehouseList();
+ query.setWarehouseName(warehouseEntities.stream().map(BasicdataWarehouseEntity::getName).collect(Collectors.joining(",")));
+ }
+ }
+ }
+
@Override
public void exporOrder(HttpServletResponse response, ExpenseWarehouseOrderQuery query) {
IPage page = Condition.getPage(query);
page.setSize(-1);
page.setCurrent(1);
+ buildWarehouseAuth(query);
List list = baseMapper.selectExpenseOrderWarehouseTotalPage(page, query);
ExcelUtil.export(response, list, ExpenseWarehouseOrderVO.class);
}
diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseDayServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseDayServiceImpl.java
index 49a24df52..e5cdfccd8 100644
--- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseDayServiceImpl.java
+++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseDayServiceImpl.java
@@ -17,7 +17,10 @@
package com.logpm.statistics.service.impl;
import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
+import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.statistics.entity.ExpenseWarehouseDayEntity;
import com.logpm.statistics.entity.ExpenseWarehouseMonthEntity;
import com.logpm.statistics.mapper.ExpenseWarehouseDayMapper;
@@ -29,9 +32,11 @@ import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Collections;
import java.util.List;
+import java.util.stream.Collectors;
/**
* 日仓储成本统计表 服务实现类
@@ -42,12 +47,28 @@ import java.util.List;
@Service
public class ExpenseWarehouseDayServiceImpl extends BaseServiceImpl implements IExpenseWarehouseDayService {
+ @Resource
+ private IBasicdataWarehouseClient warehouseClient;
+
@Override
public IPage dayPage(ExpenseWarehouseDayQuery query) {
IPage page = Condition.getPage(query);
+ buildWarehouseAuth(query);
return page.setRecords(baseMapper.selectExpenseWarehouseDayPage(page, query));
}
+ private void buildWarehouseAuth(ExpenseWarehouseDayQuery query) {
+ if (StrUtil.isEmpty(query.getWarehouseName())) {
+ BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
+ if (ObjectUtil.isNotEmpty(myCurrentWarehouse)) {
+ query.setWarehouseName(myCurrentWarehouse.getName());
+ } else {
+ List warehouseEntities = warehouseClient.getMyWarehouseList();
+ query.setWarehouseName(warehouseEntities.stream().map(BasicdataWarehouseEntity::getName).collect(Collectors.joining(",")));
+ }
+ }
+ }
+
@Override
public List statisticsMonthWarehouseExpense(int year, int month) {
if (ObjectUtil.isEmpty(year) || ObjectUtil.isEmpty(month)) {
@@ -61,6 +82,7 @@ public class ExpenseWarehouseDayServiceImpl extends BaseServiceImpl page = Condition.getPage(query);
page.setSize(-1);
page.setCurrent(1);
+ buildWarehouseAuth(query);
List list = baseMapper.selectExpenseWarehouseDayPage(page, query);
ExcelUtil.export(response, list, ExpenseWarehouseDayVO.class);
}
diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseMonthServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseMonthServiceImpl.java
index de191d0f0..751e78f73 100644
--- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseMonthServiceImpl.java
+++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseMonthServiceImpl.java
@@ -16,7 +16,11 @@
*/
package com.logpm.statistics.service.impl;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
+import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.statistics.entity.ExpenseWarehouseMonthEntity;
import com.logpm.statistics.mapper.ExpenseWarehouseMonthMapper;
import com.logpm.statistics.query.ExpenseWarehouseMonthQuery;
@@ -27,8 +31,10 @@ import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
+import java.util.stream.Collectors;
/**
* 月度仓储成本统计表 服务实现类
@@ -39,17 +45,34 @@ import java.util.List;
@Service
public class ExpenseWarehouseMonthServiceImpl extends BaseServiceImpl implements IExpenseWarehouseMonthService {
+ @Resource
+ private IBasicdataWarehouseClient warehouseClient;
+
@Override
public IPage monthPage(ExpenseWarehouseMonthQuery query) {
IPage page = Condition.getPage(query);
+ buildWarehouseAuth(query);
return page.setRecords(baseMapper.selectExpenseWarehouseMonthPage(page, query));
}
+ private void buildWarehouseAuth(ExpenseWarehouseMonthQuery query) {
+ if (StrUtil.isEmpty(query.getWarehouseName())) {
+ BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
+ if (ObjectUtil.isNotEmpty(myCurrentWarehouse)) {
+ query.setWarehouseName(myCurrentWarehouse.getName());
+ } else {
+ List warehouseEntities = warehouseClient.getMyWarehouseList();
+ query.setWarehouseName(warehouseEntities.stream().map(BasicdataWarehouseEntity::getName).collect(Collectors.joining(",")));
+ }
+ }
+ }
+
@Override
public void exporMonth(HttpServletResponse response, ExpenseWarehouseMonthQuery query) {
IPage page = Condition.getPage(query);
page.setSize(-1);
page.setCurrent(1);
+ buildWarehouseAuth(query);
List list = baseMapper.selectExpenseWarehouseMonthPage(page, query);
ExcelUtil.export(response, list, ExpenseWarehouseMonthVO.class);
}
diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseTransitMonthServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseTransitMonthServiceImpl.java
index fa2506e43..8eac9880f 100644
--- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseTransitMonthServiceImpl.java
+++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseTransitMonthServiceImpl.java
@@ -17,7 +17,10 @@
package com.logpm.statistics.service.impl;
import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
+import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.statistics.entity.ExpenseWarehouseTransitMonthEntity;
import com.logpm.statistics.mapper.ExpenseWarehouseTransitMonthMapper;
import com.logpm.statistics.query.ExpenseWarehouseTransitMonthQuery;
@@ -36,6 +39,7 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.List;
+import java.util.stream.Collectors;
/**
* 中转仓月度仓储作业账单 服务实现类
@@ -48,13 +52,34 @@ import java.util.List;
public class ExpenseWarehouseTransitMonthServiceImpl extends BaseServiceImpl implements IExpenseWarehouseTransitMonthService {
private final IExpenseWarehouseTransitChangeService expenseWarehouseTransitChangeService;
+ private final IBasicdataWarehouseClient warehouseClient;
@Override
public IPage selectExpenseWarehouseTransitMonthPage(ExpenseWarehouseTransitMonthQuery query) {
IPage page = Condition.getPage(query);
+ buildWarehouseAuth(query);
return page.setRecords(baseMapper.selectExpenseWarehouseTransitMonthPage(page, query));
}
+ private void buildWarehouseAuth(ExpenseWarehouseTransitMonthQuery query) {
+ BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
+ List warehouseEntities = warehouseClient.getMyWarehouseList();
+ if (StrUtil.isEmpty(query.getTransitWarehouseName())) {
+ if (ObjectUtil.isNotEmpty(myCurrentWarehouse)) {
+ query.setTransitWarehouseName(myCurrentWarehouse.getName());
+ } else {
+ query.setTransitWarehouseName(warehouseEntities.stream().map(BasicdataWarehouseEntity::getName).collect(Collectors.joining(",")));
+ }
+ }
+ if (StrUtil.isEmpty(query.getDestinationWarehouseName())) {
+ if (ObjectUtil.isNotEmpty(myCurrentWarehouse)) {
+ query.setDestinationWarehouseName(myCurrentWarehouse.getName());
+ } else {
+ query.setDestinationWarehouseName(warehouseEntities.stream().map(BasicdataWarehouseEntity::getName).collect(Collectors.joining(",")));
+ }
+ }
+ }
+
@Override
public ExpenseWarehouseTransitMonthVO detail(Long id, String type) {
if (ObjectUtil.isEmpty(id)) {
@@ -75,6 +100,7 @@ public class ExpenseWarehouseTransitMonthServiceImpl extends BaseServiceImpl page = Condition.getPage(query);
page.setSize(-1);
page.setCurrent(1);
+ buildWarehouseAuth(query);
List list = baseMapper.selectExpenseWarehouseTransitMonthPage(page, query);
ExcelUtil.export(response, list, ExpenseWarehouseTransitMonthVO.class);
}
diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseTransitServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseTransitServiceImpl.java
index 0c51ebc61..5a30a123e 100644
--- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseTransitServiceImpl.java
+++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/ExpenseWarehouseTransitServiceImpl.java
@@ -16,8 +16,12 @@
*/
package com.logpm.statistics.service.impl;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
+import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.statistics.entity.ExpenseWarehouseTransitEntity;
import com.logpm.statistics.excel.ExpenseWarehouseTransitExcel;
import com.logpm.statistics.mapper.ExpenseWarehouseTransitMapper;
@@ -29,8 +33,10 @@ import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
+import java.util.stream.Collectors;
/**
* 中转仓仓储作业明细 服务实现类
@@ -41,12 +47,34 @@ import java.util.List;
@Service
public class ExpenseWarehouseTransitServiceImpl extends BaseServiceImpl implements IExpenseWarehouseTransitService {
+ @Resource
+ private IBasicdataWarehouseClient warehouseClient;
+
@Override
public IPage selectExpenseWarehouseTransitPage(ExpenseWarehouseTransitQuery query) {
IPage page = Condition.getPage(query);
+ buildWarehouseAuth(query);
return page.setRecords(baseMapper.selectExpenseWarehouseTransitPage(page, query));
}
+ private void buildWarehouseAuth(ExpenseWarehouseTransitQuery query) {
+ BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
+ List warehouseEntities = warehouseClient.getMyWarehouseList();
+ if (StrUtil.isEmpty(query.getTransitWarehouseName())) {
+ if (ObjectUtil.isNotEmpty(myCurrentWarehouse)) {
+ query.setTransitWarehouseName(myCurrentWarehouse.getName());
+ } else {
+ query.setTransitWarehouseName(warehouseEntities.stream().map(BasicdataWarehouseEntity::getName).collect(Collectors.joining(",")));
+ }
+ }
+ if (StrUtil.isEmpty(query.getDestinationWarehouseName())) {
+ if (ObjectUtil.isNotEmpty(myCurrentWarehouse)) {
+ query.setDestinationWarehouseName(myCurrentWarehouse.getName());
+ } else {
+ query.setDestinationWarehouseName(warehouseEntities.stream().map(BasicdataWarehouseEntity::getName).collect(Collectors.joining(",")));
+ }
+ }
+ }
@Override
public List exportExpenseWarehouseTransit(Wrapper queryWrapper) {
@@ -62,6 +90,7 @@ public class ExpenseWarehouseTransitServiceImpl extends BaseServiceImpl page = Condition.getPage(query);
page.setSize(-1);
page.setCurrent(1);
+ buildWarehouseAuth(query);
List list = baseMapper.selectExpenseWarehouseTransitPage(page, query);
ExcelUtil.export(response, list, ExpenseWarehouseTransitVO.class);
}
diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/util/ReportUtil.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/util/ReportUtil.java
new file mode 100644
index 000000000..4ce15fad6
--- /dev/null
+++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/util/ReportUtil.java
@@ -0,0 +1,97 @@
+package com.logpm.statistics.util;
+
+import cn.hutool.core.date.DateUnit;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
+import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
+import org.springblade.core.log.exception.ServiceException;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * 报表工具类
+ *
+ * @Author zqb
+ * @Date 2024/6/13
+ **/
+public class ReportUtil {
+
+ /**
+ * 校验两个时间相差不超过 30 天
+ * 如果不跨月则返回 true
+ * 如果跨月则不超过 30 天
+ *
+ * @Param start 开始时间
+ * @Param end 解释时间
+ * @Return boolean
+ * @Author zqb 2024/6/13
+ **/
+ public static boolean isWithinOneMonth(Date start, Date end) {
+ // 检查输入是否为null
+ if (start == null || end == null) {
+ return false;
+ }
+
+ // 是否跨月,不跨越则直接返回true
+ if (DateUtil.year(start) == DateUtil.year(end) && DateUtil.month(start) == DateUtil.month(end)) {
+ return true;
+ }
+
+ // 跨越则判断两个日期是否相差超过30天
+ return DateUtil.between(start, end, DateUnit.DAY) <= 30;
+ }
+
+ public static void buildReportWarehouseAuth(String warehouseName, String warehouseNameRange,
+ QueryWrapper queryWrapper, IBasicdataWarehouseClient warehouseClient) {
+ if (StrUtil.isEmpty(warehouseName) && StrUtil.isEmpty(warehouseNameRange)) {
+ BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
+ if (ObjectUtil.isNotEmpty(myCurrentWarehouse)) {
+ queryWrapper.eq("warehouse_id", myCurrentWarehouse.getId());
+ } else {
+ List warehouseEntities = warehouseClient.getMyWarehouseList();
+ queryWrapper.in("warehouse_id", warehouseEntities.stream().map(BasicdataWarehouseEntity::getId).collect(Collectors.toList()));
+ }
+ }
+ }
+
+ public static void dateIsWithinOneMonth(String taskTime, Date startTaskTime, Date endTaskTime, String title) {
+ if (ObjectUtil.isEmpty(taskTime)) {
+ boolean withinOneMonth = isWithinOneMonth(startTaskTime, endTaskTime);
+ if (!withinOneMonth) {
+ throw new ServiceException(title + "必选且时间不超过一个月");
+ }
+ }
+ }
+
+ public static boolean areAllPropertiesEmpty(Object obj) {
+ if (obj == null) return true;
+ return Stream.of(obj.getClass().getDeclaredFields())
+ .filter(field -> !field.getName().equals("serialVersionUID"))
+ .peek(field -> field.setAccessible(true)) // 设置所有字段可访问
+ .allMatch(field -> {
+ Object value = null;
+ try {
+ value = field.get(obj);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ if (value == null) return true;
+ if (value instanceof String) return ((String) value).isEmpty();
+ if (value instanceof Collection) return ((Collection>) value).isEmpty();
+ if (value instanceof Map) return ((Map, ?>) value).isEmpty();
+ if (value.getClass().isArray()) return Arrays.asList((Object[]) value).isEmpty();
+ // 对于基本类型或其他不可空类型,你可能需要返回 false 或进行更详细的检查
+ return false;
+ });
+ }
+
+}