|
@@ -1,20 +1,34 @@
|
|
|
package com.ydtech.modules.admin.service.impl;
|
|
package com.ydtech.modules.admin.service.impl;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
+import com.fasterxml.jackson.annotation.JsonManagedReference;
|
|
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
+import com.ydtech.core.page.HttpResult;
|
|
|
|
|
+import com.ydtech.modules.admin.dao.CompanyDataReportMapper;
|
|
|
|
|
+import com.ydtech.modules.admin.model.dto.OrdersDataExcel;
|
|
|
|
|
+import com.ydtech.modules.admin.model.dto.TaskStatisticsExcel;
|
|
|
import com.ydtech.modules.admin.model.report.company.*;
|
|
import com.ydtech.modules.admin.model.report.company.*;
|
|
|
import com.ydtech.modules.admin.model.report.opetationData.QuotationCountDataDto;
|
|
import com.ydtech.modules.admin.model.report.opetationData.QuotationCountDataDto;
|
|
|
import com.ydtech.modules.admin.model.vo.OrdersDataVo;
|
|
import com.ydtech.modules.admin.model.vo.OrdersDataVo;
|
|
|
|
|
+import com.ydtech.modules.admin.model.vo.TaskStatisticsVo;
|
|
|
import com.ydtech.modules.admin.service.CompanyDataReportService;
|
|
import com.ydtech.modules.admin.service.CompanyDataReportService;
|
|
|
import com.ydtech.modules.admin.utils.SliceUpDateUtil;
|
|
import com.ydtech.modules.admin.utils.SliceUpDateUtil;
|
|
|
|
|
+import com.ydtech.modules.inv.utils.EasyExcelUtils;
|
|
|
import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
|
|
import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
|
|
|
import com.ydtech.modules.order.entity.BasePageResult;
|
|
import com.ydtech.modules.order.entity.BasePageResult;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
|
|
+import java.nio.file.Files;
|
|
|
|
|
+import java.nio.file.Path;
|
|
|
|
|
+import java.nio.file.Paths;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
@@ -30,6 +44,14 @@ public class CompanyDataReportServiceImpl implements CompanyDataReportService {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private InsAreaCompanyMapper insAreaCompanyMapper;
|
|
private InsAreaCompanyMapper insAreaCompanyMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private CompanyDataReportMapper companyDataReportMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Value("${upload.file.path}")
|
|
|
|
|
+ private String uploadPath;
|
|
|
|
|
+
|
|
|
|
|
+ @Value("${upload.file.url}")
|
|
|
|
|
+ private String uploadUrl;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @version
|
|
* @version
|
|
@@ -130,11 +152,8 @@ public class CompanyDataReportServiceImpl implements CompanyDataReportService {
|
|
|
@Override
|
|
@Override
|
|
|
public BasePageResult<OrdersDataDto> querOrdersDataPage(OrdersDataVo ordersDataVo) {
|
|
public BasePageResult<OrdersDataDto> querOrdersDataPage(OrdersDataVo ordersDataVo) {
|
|
|
Page<OrdersDataDto> page = new Page<>(ordersDataVo.getPageNum(), ordersDataVo.getPageSize());
|
|
Page<OrdersDataDto> page = new Page<>(ordersDataVo.getPageNum(), ordersDataVo.getPageSize());
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
//判断开始时间和结束时间是否为空,如果为空的走时间类型逻辑
|
|
//判断开始时间和结束时间是否为空,如果为空的走时间类型逻辑
|
|
|
HashMap<String, String> dateMapByType = getDateMapByType(ordersDataVo.getDateType(), ordersDataVo.getBeginDate(), ordersDataVo.getEndDate());
|
|
HashMap<String, String> dateMapByType = getDateMapByType(ordersDataVo.getDateType(), ordersDataVo.getBeginDate(), ordersDataVo.getEndDate());
|
|
|
-
|
|
|
|
|
ordersDataVo.setBeginDate(dateMapByType.get("startDate"));
|
|
ordersDataVo.setBeginDate(dateMapByType.get("startDate"));
|
|
|
ordersDataVo.setEndDate(dateMapByType.get("endDate"));
|
|
ordersDataVo.setEndDate(dateMapByType.get("endDate"));
|
|
|
Page<OrdersDataDto> resultSubOrder = insAreaCompanyMapper.querOrdersDataPage(ordersDataVo, page);
|
|
Page<OrdersDataDto> resultSubOrder = insAreaCompanyMapper.querOrdersDataPage(ordersDataVo, page);
|
|
@@ -157,8 +176,6 @@ public class CompanyDataReportServiceImpl implements CompanyDataReportService {
|
|
|
record.setNamesimple(dto.getNamesimple());
|
|
record.setNamesimple(dto.getNamesimple());
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
return new BasePageResult<>(ordersDataVo.getPageNum(), page.getSize(), resultSubOrder.getTotal(), page.getPages(),
|
|
return new BasePageResult<>(ordersDataVo.getPageNum(), page.getSize(), resultSubOrder.getTotal(), page.getPages(),
|
|
|
resultSubOrder.getRecords());
|
|
resultSubOrder.getRecords());
|
|
@@ -176,9 +193,20 @@ public class CompanyDataReportServiceImpl implements CompanyDataReportService {
|
|
|
HashMap<String, String> dateMapByType = getDateMapByType(ordersDataVo.getDateType(), ordersDataVo.getBeginDate(), ordersDataVo.getEndDate());
|
|
HashMap<String, String> dateMapByType = getDateMapByType(ordersDataVo.getDateType(), ordersDataVo.getBeginDate(), ordersDataVo.getEndDate());
|
|
|
ordersDataVo.setBeginDate(dateMapByType.get("startDate"));
|
|
ordersDataVo.setBeginDate(dateMapByType.get("startDate"));
|
|
|
ordersDataVo.setEndDate(dateMapByType.get("endDate"));
|
|
ordersDataVo.setEndDate(dateMapByType.get("endDate"));
|
|
|
- OrdersDataDto resultSubOrder = insAreaCompanyMapper.querOrdersamountTo(ordersDataVo);
|
|
|
|
|
|
|
+ OrdersDataDto bigOrderNo=companyDataReportMapper.querOrdersTotal(ordersDataVo);
|
|
|
|
|
+ OrdersDataDto smallOrderNo = companyDataReportMapper.smallQuerOrders(ordersDataVo);
|
|
|
|
|
+ if(ObjectUtils.isNotEmpty(smallOrderNo) && ObjectUtils.isNotEmpty(bigOrderNo)){
|
|
|
|
|
+ String smallorderNumber = smallOrderNo.getOrderNumber();
|
|
|
|
|
+ String bigOrderNumber = bigOrderNo.getOrderNumber();
|
|
|
|
|
+ BigDecimal smallBigDecimal = new BigDecimal(smallorderNumber);
|
|
|
|
|
+ BigDecimal bigBigDecimal = new BigDecimal(bigOrderNumber);
|
|
|
|
|
+ BigDecimal result = smallBigDecimal.divide(bigBigDecimal, 2, RoundingMode.HALF_UP);
|
|
|
|
|
+ bigOrderNo.setCloseRate(result.toString());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- return resultSubOrder;
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ return bigOrderNo;
|
|
|
}
|
|
}
|
|
|
private BigDecimal calculateTotal(BigDecimal value1, BigDecimal value2, BigDecimal value3) {
|
|
private BigDecimal calculateTotal(BigDecimal value1, BigDecimal value2, BigDecimal value3) {
|
|
|
BigDecimal total = BigDecimal.ZERO;
|
|
BigDecimal total = BigDecimal.ZERO;
|
|
@@ -196,6 +224,34 @@ public class CompanyDataReportServiceImpl implements CompanyDataReportService {
|
|
|
|
|
|
|
|
return total;
|
|
return total;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @description: 大订单导出
|
|
|
|
|
+ * @author: whp
|
|
|
|
|
+ * @date: 2024/9/13
|
|
|
|
|
+ **/
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public HttpResult largeOrdersExcel(OrdersDataVo ordersDataVo) {
|
|
|
|
|
+
|
|
|
|
|
+ //判断开始时间和结束时间是否为空,如果为空的走时间类型逻辑
|
|
|
|
|
+ HashMap<String, String> dateMapByType = getDateMapByType(ordersDataVo.getDateType(), ordersDataVo.getBeginDate(), ordersDataVo.getEndDate());
|
|
|
|
|
+ ordersDataVo.setBeginDate(dateMapByType.get("startDate"));
|
|
|
|
|
+ ordersDataVo.setEndDate(dateMapByType.get("endDate"));
|
|
|
|
|
+
|
|
|
|
|
+ List<OrdersDataExcel> resultSubOrder = insAreaCompanyMapper.querOrdersDataListExcel(ordersDataVo);
|
|
|
|
|
+ String uploadPath = this.uploadPath + "/excel/";
|
|
|
|
|
+ Path path = Paths.get(uploadPath);
|
|
|
|
|
+ if (!Files.exists(path)) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ Files.createDirectories(path);
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ String fileName = EasyExcelUtils.downExcel(uploadPath, "控制台大订单导出", OrdersDataExcel.class, resultSubOrder);
|
|
|
|
|
+ return HttpResult.ok("", uploadUrl + "excel/" + fileName);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|