|
@@ -30,17 +30,20 @@ import org.springblade.client.entity.StorageDesc;
|
|
|
import org.springblade.client.feign.ICorpsDescClient;
|
|
import org.springblade.client.feign.ICorpsDescClient;
|
|
|
import org.springblade.client.feign.IStorageClient;
|
|
import org.springblade.client.feign.IStorageClient;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
+import org.springblade.core.excel.util.ExcelUtil;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.api.R;
|
|
|
|
|
+import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.finance.feign.IFinanceClient;
|
|
import org.springblade.finance.feign.IFinanceClient;
|
|
|
import org.springblade.finance.vojo.Acc;
|
|
import org.springblade.finance.vojo.Acc;
|
|
|
import org.springblade.purchase.sales.entity.Order;
|
|
import org.springblade.purchase.sales.entity.Order;
|
|
|
import org.springblade.purchase.sales.entity.OrderItems;
|
|
import org.springblade.purchase.sales.entity.OrderItems;
|
|
|
|
|
+import org.springblade.purchase.sales.excel.AnalysisDetailsExcel;
|
|
|
import org.springblade.purchase.sales.service.IOrderItemsService;
|
|
import org.springblade.purchase.sales.service.IOrderItemsService;
|
|
|
import org.springblade.purchase.sales.service.IOrderService;
|
|
import org.springblade.purchase.sales.service.IOrderService;
|
|
|
import org.springblade.purchase.sales.vo.OrderVO;
|
|
import org.springblade.purchase.sales.vo.OrderVO;
|
|
@@ -48,14 +51,12 @@ import org.springblade.system.user.entity.User;
|
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.math.MathContext;
|
|
import java.math.MathContext;
|
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 国内销售或采购订单表 控制器
|
|
* 国内销售或采购订单表 控制器
|
|
@@ -466,4 +467,110 @@ public class AppPartsController extends BladeController {
|
|
|
map.put("averageAmount", averageAmount);
|
|
map.put("averageAmount", averageAmount);
|
|
|
return R.data(map);
|
|
return R.data(map);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 中电 统计分析 :应付分析
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/detailsList")
|
|
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
|
|
+ @ApiOperation(value = "分页", notes = "传入order")
|
|
|
|
|
+ public R<IPage<Order>> detailsList(OrderVO order, Query query) {
|
|
|
|
|
+ LambdaQueryWrapper<Order> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ lambdaQueryWrapper.eq(Order::getTenantId, order.getTenantId());//租户id
|
|
|
|
|
+ lambdaQueryWrapper.eq(Order::getIsDeleted, 0);//订单是否有效
|
|
|
|
|
+ if (ObjectUtils.isNotNull(order.getCorpsName())) {
|
|
|
|
|
+ String corpsName = order.getCorpsName().replaceAll(" ","");
|
|
|
|
|
+ List<Long> ids = corpsDescClient.listCorpIdByName(corpsName);
|
|
|
|
|
+ if (ObjectUtils.isNotNull(ids) && ids.size() > 0) {
|
|
|
|
|
+ lambdaQueryWrapper.in(Order::getCorpId, ids);//客户id
|
|
|
|
|
+ } else {
|
|
|
|
|
+ lambdaQueryWrapper.isNull(Order::getCorpId);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getCorpId()), Order::getCorpId, order.getCorpId());//客户id
|
|
|
|
|
+ }
|
|
|
|
|
+ if (order.getBusinesDateList() != null && order.getBusinesDateList().size() > 1) {
|
|
|
|
|
+ lambdaQueryWrapper.ge(Order::getBusinesDate, order.getBusinesDateList().get(0));
|
|
|
|
|
+ lambdaQueryWrapper.le(Order::getBusinesDate, order.getBusinesDateList().get(1));
|
|
|
|
|
+ }
|
|
|
|
|
+ lambdaQueryWrapper.eq(Func.isNotEmpty(order.getBillType()), Order::getBillType, order.getBillType());
|
|
|
|
|
+ lambdaQueryWrapper.eq(Func.isNotEmpty(order.getTradeType()), Order::getTradeType, order.getTradeType());
|
|
|
|
|
+ IPage<Order> page = orderService.page(Condition.getPage(query), lambdaQueryWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ String corpIds = "";//客户拼接
|
|
|
|
|
+
|
|
|
|
|
+ for (Order orders : page.getRecords()) {
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(orders.getCorpId())) {
|
|
|
|
|
+ corpIds = corpIds + orders.getCorpId() + ",";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ List<CorpsDesc> corpsDescList = corpsDescClient.selectByCorpIds(corpIds);
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(page.getRecords())) {
|
|
|
|
|
+ page.getRecords().stream().forEach(item -> {
|
|
|
|
|
+ if (item.getCorpId() != null) {
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(corpsDescList)) {
|
|
|
|
|
+ CorpsDesc corpsDesc = corpsDescList.stream().filter(d -> d.getId().equals(item.getCorpId())).findFirst().orElse(null);
|
|
|
|
|
+ if (ObjectUtils.isNotNull(corpsDesc)) {
|
|
|
|
|
+ item.setCorpsName(corpsDesc.getCname());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ return R.data(page);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 明细列表导出
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/detailsListExport")
|
|
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
|
|
+ @ApiOperation(value = "统计分析", notes = "传入orderAcctVO")
|
|
|
|
|
+ public void detailsListExport(OrderVO order, HttpServletResponse response) {
|
|
|
|
|
+ LambdaQueryWrapper<Order> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ lambdaQueryWrapper.eq(Order::getTenantId, order.getTenantId());//租户id
|
|
|
|
|
+ lambdaQueryWrapper.eq(Order::getIsDeleted, 0);//订单是否有效
|
|
|
|
|
+ if (ObjectUtils.isNotNull(order.getCorpsName())) {
|
|
|
|
|
+ String corpsName = order.getCorpsName().replaceAll(" ","");
|
|
|
|
|
+ List<Long> ids = corpsDescClient.listCorpIdByName(corpsName);
|
|
|
|
|
+ if (ObjectUtils.isNotNull(ids) && ids.size() > 0) {
|
|
|
|
|
+ lambdaQueryWrapper.in(Order::getCorpId, ids);//客户id
|
|
|
|
|
+ } else {
|
|
|
|
|
+ lambdaQueryWrapper.isNull(Order::getCorpId);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getCorpId()), Order::getCorpId, order.getCorpId());//客户id
|
|
|
|
|
+ }
|
|
|
|
|
+ if (order.getBusinesDateList() != null && order.getBusinesDateList().size() > 1) {
|
|
|
|
|
+ lambdaQueryWrapper.ge(Order::getBusinesDate, order.getBusinesDateList().get(0));
|
|
|
|
|
+ lambdaQueryWrapper.le(Order::getBusinesDate, order.getBusinesDateList().get(1));
|
|
|
|
|
+ }
|
|
|
|
|
+ lambdaQueryWrapper.eq(Func.isNotEmpty(order.getBillType()), Order::getBillType, order.getBillType());
|
|
|
|
|
+ lambdaQueryWrapper.eq(Func.isNotEmpty(order.getTradeType()), Order::getTradeType, order.getTradeType());
|
|
|
|
|
+ List<Order> list = orderService.list(lambdaQueryWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ String corpIds = "";//客户拼接
|
|
|
|
|
+
|
|
|
|
|
+ for (Order orders : list) {
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(orders.getCorpId())) {
|
|
|
|
|
+ corpIds = corpIds + orders.getCorpId() + ",";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ List<CorpsDesc> corpsDescList = corpsDescClient.selectByCorpIds(corpIds);
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
|
+ list.stream().forEach(item -> {
|
|
|
|
|
+ if (item.getCorpId() != null) {
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(corpsDescList)) {
|
|
|
|
|
+ CorpsDesc corpsDesc = corpsDescList.stream().filter(d -> d.getId().equals(item.getCorpId())).findFirst().orElse(null);
|
|
|
|
|
+ if (ObjectUtils.isNotNull(corpsDesc)) {
|
|
|
|
|
+ item.setCorpsName(corpsDesc.getCname());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ ExcelUtil.export(response, "导出应收明细信息", "导出数据表", BeanUtil.copy(list, AnalysisDetailsExcel.class), AnalysisDetailsExcel.class);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|