|
|
@@ -1,10 +1,6 @@
|
|
|
package com.sckw.report.service.impl;
|
|
|
|
|
|
import com.sckw.contract.api.feign.SalesReportContractFeignService;
|
|
|
-import com.sckw.contract.api.model.dto.req.SalesReportGoodsQueryDto;
|
|
|
-import com.sckw.contract.api.model.dto.req.TradeEntListQueryFeignDto;
|
|
|
-import com.sckw.contract.api.model.dto.res.SalesReportGoodsResVo;
|
|
|
-import com.sckw.contract.api.model.dto.res.TradeEntInfoResVo;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.BaseResult;
|
|
|
import com.sckw.excel.utils.ExcelUtil;
|
|
|
@@ -12,8 +8,6 @@ import com.sckw.order.api.feign.SalesReportOrderFeignService;
|
|
|
import com.sckw.order.api.model.SalesReportDataVo;
|
|
|
import com.sckw.order.api.model.SalesReportQueryDto;
|
|
|
import com.sckw.report.model.dto.SalesReportDTO;
|
|
|
-import com.sckw.report.model.vo.CustomerVO;
|
|
|
-import com.sckw.report.model.vo.ProductVO;
|
|
|
import com.sckw.report.model.vo.SalesReportVO;
|
|
|
import com.sckw.report.model.vo.SalesReportSummaryVO;
|
|
|
import com.sckw.report.service.KwSalesReportService;
|
|
|
@@ -34,7 +28,7 @@ import java.util.stream.Collectors;
|
|
|
@RequiredArgsConstructor
|
|
|
public class KwSalesReportServiceImpl implements KwSalesReportService {
|
|
|
|
|
|
- private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
@Autowired
|
|
|
private SalesReportContractFeignService salesReportContractFeignService;
|
|
|
@@ -46,8 +40,8 @@ public class KwSalesReportServiceImpl implements KwSalesReportService {
|
|
|
// 调用订单服务获取销售报表数据
|
|
|
SalesReportQueryDto queryDto = new SalesReportQueryDto();
|
|
|
queryDto.setCurEntId(LoginUserHolder.getEntId());
|
|
|
- queryDto.setCustomerId(salesReportDTO.getCustomerId());
|
|
|
- queryDto.setGoodsId(salesReportDTO.getProductId());
|
|
|
+ queryDto.setTradeEntId(salesReportDTO.getTradeEntId());
|
|
|
+ queryDto.setGoodsId(salesReportDTO.getGoodsId());
|
|
|
|
|
|
// 转换时间格式:Date转String yyyy-MM-dd
|
|
|
if (salesReportDTO.getStartTime() != null) {
|
|
|
@@ -65,8 +59,8 @@ public class KwSalesReportServiceImpl implements KwSalesReportService {
|
|
|
return salesReportData.stream().map(data -> {
|
|
|
SalesReportVO vo = new SalesReportVO();
|
|
|
vo.setSerialNumber(serialNumber.getAndIncrement());
|
|
|
- vo.setCustomerName(data.getCustomerName());
|
|
|
- vo.setProductName(data.getGoodsName());
|
|
|
+ vo.setEntName(data.getCustomerName());
|
|
|
+ vo.setGoodsName(data.getGoodsName());
|
|
|
vo.setSalesQuantity(data.getSalesQuantity());
|
|
|
vo.setAveragePrice(data.getAveragePrice());
|
|
|
vo.setSalesAmount(data.getSalesAmount());
|
|
|
@@ -111,38 +105,4 @@ public class KwSalesReportServiceImpl implements KwSalesReportService {
|
|
|
// 导出Excel
|
|
|
ExcelUtil.download(response, SalesReportVO.class, reportData);
|
|
|
}
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<CustomerVO> getAllCustomers() {
|
|
|
- TradeEntListQueryFeignDto queryDto = new TradeEntListQueryFeignDto();
|
|
|
- queryDto.setCurEntId(LoginUserHolder.getEntId());
|
|
|
- BaseResult<List<TradeEntInfoResVo>> result = salesReportContractFeignService.queryTradeEntList(queryDto);
|
|
|
- if (result != null && result.isSuccess() && result.getData() != null) {
|
|
|
- List<TradeEntInfoResVo> customerList = result.getData();
|
|
|
- return customerList.stream().map(customer -> {
|
|
|
- CustomerVO vo = new CustomerVO();
|
|
|
- vo.setCustomerId(customer.getEntId());
|
|
|
- vo.setCustomerName(customer.getEntName());
|
|
|
- return vo;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- }
|
|
|
- return new ArrayList<>();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<ProductVO> getAllProducts() {
|
|
|
- SalesReportGoodsQueryDto queryDto = new SalesReportGoodsQueryDto();
|
|
|
- queryDto.setCurEntId(LoginUserHolder.getEntId());
|
|
|
- BaseResult<List<SalesReportGoodsResVo>> result = salesReportContractFeignService.queryGoodsList(queryDto);
|
|
|
- if (result != null && result.isSuccess() && result.getData() != null) {
|
|
|
- List<SalesReportGoodsResVo> goodsList = result.getData();
|
|
|
- return goodsList.stream().map(goods -> {
|
|
|
- ProductVO vo = new ProductVO();
|
|
|
- vo.setProductId(goods.getGoodsId());
|
|
|
- vo.setProductName(goods.getGoodsName());
|
|
|
- return vo;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- }
|
|
|
- return new ArrayList<>();
|
|
|
- }
|
|
|
}
|