Procházet zdrojové kódy

统计销售增加结算日期查询、导出,导出再额外增加上架销售价格1

liyuan před 1 dnem
rodič
revize
d8dd01e1aa

+ 9 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/dto/SaleDetail.java

@@ -122,5 +122,14 @@ public class SaleDetail {
 	@ExcelIgnore
 	private String storageIds;
 
+	/**
+	 * 结算开始日期
+	 */
+	private String settlementDateStart;
+
+	/**
+	 * 结算结束日期
+	 */
+	private String settlementDateEnd;
 
 }

+ 19 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/dto/SaleDetailDto.java

@@ -5,9 +5,12 @@ import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
 import com.alibaba.excel.annotation.write.style.ContentRowHeight;
 import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * @author :jixinyuan
@@ -55,6 +58,15 @@ public class SaleDetailDto {
 	@ExcelProperty(value = "完成日期")
 	private String deliveryBusinesDate;
 
+
+	/**
+	 * 结算日期
+	 */
+	@ExcelProperty(value = "结算日期")
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	private Date paymentDate;
+
 	/**
 	 * 结算状态
 	 */
@@ -96,6 +108,13 @@ public class SaleDetailDto {
 	 */
 	@ExcelProperty(value = "价格")
 	private BigDecimal price;
+
+	/**
+	 * 价格
+	 */
+	@ExcelProperty(value = "上架管理售价1")
+	private BigDecimal productPrice;
+
 	/**
 	 * 金额
 	 */

+ 15 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/mapper/OrderItemsMapper.xml

@@ -112,6 +112,7 @@
     <select id="saleDetailPage" resultType="org.springblade.salesPart.dto.SaleDetailDto">
         SELECT
         po.customer_name AS customerName,
+        po.payment_date AS paymentDate,
         bu.real_name AS salerName,
         poi.pid AS pid,
         poi.id AS itemId,
@@ -301,6 +302,13 @@
         <if test="saleDetailDto.businesDateEnd !=null and saleDetailDto.businesDateEnd !=''">
             and DATE_FORMAT(po.busines_date,'%Y-%m-%d') &lt;= #{saleDetailDto.businesDateEnd}
         </if>
+
+        <if test="saleDetailDto.settlementDateStart !=null and saleDetailDto.settlementDateStart !=''">
+            and DATE_FORMAT(po.payment_date,'%Y-%m-%d') &gt;= #{saleDetailDto.settlementDateStart}
+        </if>
+        <if test="saleDetailDto.settlementDateEnd !=null and saleDetailDto.settlementDateEnd !=''">
+            and DATE_FORMAT(po.payment_date,'%Y-%m-%d') &lt;= #{saleDetailDto.settlementDateEnd}
+        </if>
         <if test="saleDetailDto.dateStart !=null and saleDetailDto.dateStart !=''">
             and DATE_FORMAT(po.delivery_busines_date,'%Y-%m-%d') &gt;= #{saleDetailDto.dateStart}
         </if>
@@ -338,6 +346,7 @@
         poi.goods_no AS code,
         po.ord_no AS ordNo,
         po.freight AS freight,
+        po.payment_date AS paymentDate,
         po.returns_status,
         poi.returns_number,
         poi.returns_amount,
@@ -519,6 +528,12 @@
         <if test="businesDateEnd !=null and businesDateEnd !=''">
             and DATE_FORMAT(po.busines_date,'%Y-%m-%d') &lt;=  DATE_FORMAT(#{businesDateEnd},'%Y-%m-%d')
         </if>
+        <if test="settlementDateStart !=null and settlementDateStart !=''">
+            and DATE_FORMAT(po.payment_date,'%Y-%m-%d') &gt;= #{settlementDateStart}
+        </if>
+        <if test="settlementDateEnd !=null and settlementDateEnd !=''">
+            and DATE_FORMAT(po.payment_date,'%Y-%m-%d') &lt;= #{settlementDateEnd}
+        </if>
         <if test="dateStart !=null and dateStart !=''">
             and DATE_FORMAT(po.delivery_busines_date,'%Y-%m-%d') &gt;= #{dateStart}
         </if>

+ 21 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/statistics/controller/StatisticsController.java

@@ -1,14 +1,19 @@
 package org.springblade.salesPart.statistics.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import io.swagger.annotations.Api;
 import lombok.AllArgsConstructor;
 import org.springblade.core.excel.util.ExcelUtil;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.salesPart.dto.*;
+import org.springblade.salesPart.entity.PjProductLaunch;
+import org.springblade.salesPart.productLaunch.service.IProductLaunchService;
 import org.springblade.salesPart.statistics.service.IStatisticsService;
 import org.springblade.salesPart.vo.CapitalSummaryDataVo;
 import org.springblade.salesPart.vo.CapitalSummaryVo;
@@ -19,6 +24,8 @@ import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * @author :jixinyuan
@@ -32,6 +39,8 @@ public class StatisticsController {
 
 	private IStatisticsService statisticsService;
 
+	private IProductLaunchService productLaunchService;
+
 	/**
 	 * 首页金额统计
 	 */
@@ -117,6 +126,18 @@ public class StatisticsController {
 	public void saleDetailExport(SaleDetail saleDetailDto, HttpServletResponse response) {
 		List<SaleDetailDto> saleDetailDtoList = statisticsService.saleDetailExport(saleDetailDto);
 		if ("XS,TKXS".contains(saleDetailDto.getBsType())) {
+			if (!CollectionUtils.isEmpty(saleDetailDtoList)) {
+				List<String> goodsIds = saleDetailDtoList.stream().map(SaleDetailDto::getGoodsId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
+				List<PjProductLaunch> productLaunchList = productLaunchService.list(new LambdaQueryWrapper<PjProductLaunch>()
+					.eq(PjProductLaunch::getIsDeleted, 0).eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId()).in(PjProductLaunch::getGoodsId, goodsIds));
+				for (SaleDetailDto dto: saleDetailDtoList) {
+					PjProductLaunch nowGoodsProduct = productLaunchList.stream().filter(item -> item.getGoodsId().equals(Long.valueOf(dto.getGoodsId()))).findFirst().orElse(null);
+					if (nowGoodsProduct == null) {
+						continue;
+					}
+					dto.setProductPrice(nowGoodsProduct.getPriceOne());
+				}
+			}
 			ExcelUtil.export(response, "统计销售明细", "统计销售明细", saleDetailDtoList, SaleDetailDto.class);
 		} else if ("RZCG".equals(saleDetailDto.getBsType())) {
 			ExcelUtil.export(response, "融资采购明细", "统计采购明细", BeanUtil.copy(saleDetailDtoList, SaleDetailRZDto.class), SaleDetailRZDto.class);

+ 5 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/statistics/service/impl/StatisticsServiceImpl.java

@@ -849,6 +849,8 @@ public class StatisticsServiceImpl implements IStatisticsService {
 				.apply("find_in_set(ord_no,'" + billNo + "')")
 				.ge(ObjectUtils.isNotNull(saleDetailDto.getBusinesDateStart()), PjOrder::getBusinesDate, saleDetailDto.getBusinesDateStart())
 				.le(ObjectUtils.isNotNull(saleDetailDto.getBusinesDateEnd()), PjOrder::getBusinesDate, saleDetailDto.getBusinesDateEnd())
+				.ge(ObjectUtils.isNotNull(saleDetailDto.getSettlementDateStart()), PjOrder::getPaymentDate, saleDetailDto.getSettlementDateStart())
+				.le(ObjectUtils.isNotNull(saleDetailDto.getSettlementDateEnd()), PjOrder::getPaymentDate, saleDetailDto.getSettlementDateEnd())
 				.apply(ObjectUtils.isNotNull(saleDetailDto.getDateStart()), "DATE_FORMAT( delivery_busines_date, '%Y-%m-%d' )  >= '" + saleDetailDto.getDateStart() + "'")
 				.apply(ObjectUtils.isNotNull(saleDetailDto.getDateEnd()), "DATE_FORMAT( delivery_busines_date, '%Y-%m-%d' )  <= '" + saleDetailDto.getDateEnd() + "'");
 			if (ObjectUtils.isNotNull(ParameterUtils.getStorageId()) && ParameterUtils.whetherDatabaseSharding()) {
@@ -955,6 +957,8 @@ public class StatisticsServiceImpl implements IStatisticsService {
 			.in(PjOrder::getOrdNo, billNoList)
 			.ge(ObjectUtils.isNotNull(saleDetailDto.getBusinesDateStart()), PjOrder::getBusinesDate, saleDetailDto.getBusinesDateStart())
 			.le(ObjectUtils.isNotNull(saleDetailDto.getBusinesDateEnd()), PjOrder::getBusinesDate, saleDetailDto.getBusinesDateEnd())
+			.ge(ObjectUtils.isNotNull(saleDetailDto.getSettlementDateStart()), PjOrder::getPaymentDate, saleDetailDto.getSettlementDateStart())
+			.le(ObjectUtils.isNotNull(saleDetailDto.getSettlementDateEnd()), PjOrder::getPaymentDate, saleDetailDto.getSettlementDateEnd())
 			.apply(ObjectUtils.isNotNull(saleDetailDto.getDateStart()), "DATE_FORMAT( delivery_busines_date, '%Y-%m-%d' )  >= '" + saleDetailDto.getDateStart() + "'")
 			.apply(ObjectUtils.isNotNull(saleDetailDto.getDateEnd()), "DATE_FORMAT( delivery_busines_date, '%Y-%m-%d' )  <= '" + saleDetailDto.getDateEnd() + "'");
 		if (ObjectUtils.isNotNull(ParameterUtils.getStorageId()) && ParameterUtils.whetherDatabaseSharding()) {
@@ -1213,6 +1217,7 @@ public class StatisticsServiceImpl implements IStatisticsService {
 						if (!pjOrderItemsList.isEmpty()) {
 							PjOrderItems orderItems = pjOrderItemsList.stream().filter(e -> e.getId().equals(items.getItemId())).findFirst().orElse(null);
 							if (orderItems != null) {
+								items.setGoodsId(String.valueOf(orderItems.getGoodsId()));
 								items.setItemRemarks(orderItems.getRemarks());
 								items.setGoodsNum(orderItems.getGoodsNum());
 								items.setPrice(orderItems.getPrice());