纪新园 2 лет назад
Родитель
Сommit
c86e968108
13 измененных файлов с 399 добавлено и 16 удалено
  1. 8 2
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjGoodsDesc.java
  2. 9 2
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/GoodsExcel.java
  3. 86 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/PjOrderStatisticsExcel.java
  4. 102 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/vo/PjOrderStatisticsWeb.java
  5. 11 0
      blade-service/blade-check/src/main/java/org/springblade/check/controller/AuditProecessController.java
  6. 1 0
      blade-service/blade-pay/src/main/java/org/springblade/pay/tonglianPayment/service/impl/PaymentServiceImpl.java
  7. 14 3
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/controller/CorpsDescController.java
  8. 43 3
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/controller/OrderController.java
  9. 6 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/mapper/OrderMapper.java
  10. 88 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/mapper/OrderMapper.xml
  11. 6 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/IOrderService.java
  12. 17 6
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/impl/OrderServiceImpl.java
  13. 8 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/settlement/service/impl/SettlementServiceImpl.java

+ 8 - 2
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjGoodsDesc.java

@@ -194,9 +194,9 @@ public class PjGoodsDesc implements Serializable {
 	private Integer explosionProof;
 
 	/**
-	 * 原厂
+	 * 静音棉
 	 */
-	@ApiModelProperty(value = "原厂")
+	@ApiModelProperty(value = "静音棉")
 	private String originalFactory;
 
 	/**
@@ -260,4 +260,10 @@ public class PjGoodsDesc implements Serializable {
 	@TableField(exist = false)
 	private String sharedCompanyName;
 
+	/**
+	 * 配套标记
+	 */
+	@ApiModelProperty(value = "配套标记")
+	private String matchedMarkings;
+
 }

+ 9 - 2
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/GoodsExcel.java

@@ -5,6 +5,7 @@ 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 io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -113,9 +114,9 @@ public class GoodsExcel implements Serializable {
 	private Integer explosionProof;
 
 	/**
-	 * 原厂
+	 * 静音棉
 	 */
-	@ExcelProperty(value = "原厂")
+	@ExcelProperty(value = "静音棉(0否,1是)")
 	private String originalFactory;
 
 	/**
@@ -124,4 +125,10 @@ public class GoodsExcel implements Serializable {
 	@ExcelProperty(value = "自修补")
 	private String selfRecovery;
 
+	/**
+	 * 配套标记
+	 */
+	@ExcelProperty(value = "配套标记")
+	private String matchedMarkings;
+
 }

+ 86 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/PjOrderStatisticsExcel.java

@@ -0,0 +1,86 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.excel;
+
+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 lombok.Data;
+import com.alibaba.excel.annotation.ExcelProperty;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 配件销售采购表实体类
+ *
+ * @author BladeX
+ * @since 2023-04-21
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class PjOrderStatisticsExcel implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+
+	/**
+	 * 客户名称
+	 */
+	@ExcelProperty(value = "客户名称")
+	private String customerName;
+
+	/**
+	 * 业务日期
+	 */
+	@ExcelProperty(value = "业务日期")
+	private String businesDate;
+
+	/**
+	 * 金额
+	 */
+	@ExcelProperty(value = "金额")
+	private BigDecimal totalMoney;
+
+	/**
+	 * 结算金额
+	 */
+	@ExcelProperty(value = "结算金额")
+	private BigDecimal paymentAmountTl;
+
+	/**
+	 * 利润
+	 */
+	@ExcelProperty(value = "利润")
+	private BigDecimal profit;
+
+	/**
+	 * 成本
+	 */
+	@ExcelProperty(value = "成本")
+	private BigDecimal cost;
+
+	/**
+	 * 未收金额
+	 */
+	@ExcelProperty(value = "未收金额")
+	private BigDecimal outstandingAmount;
+
+
+}

+ 102 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/vo/PjOrderStatisticsWeb.java

@@ -0,0 +1,102 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 配件销售采购表实体类
+ *
+ * @author BladeX
+ * @since 2023-04-21
+ */
+@Data
+public class PjOrderStatisticsWeb implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+
+	/**
+	 * 客户id
+	 */
+	@ApiModelProperty(value = "客户id")
+	private Long customerId;
+	/**
+	 * 客户名称
+	 */
+	@ApiModelProperty(value = "客户名称")
+	private String customerName;
+
+	/**
+	 * 业务日期
+	 */
+	@ApiModelProperty(value = "业务日期")
+	private String businesDate;
+
+	/**
+	 * 金额
+	 */
+	@ApiModelProperty(value = "金额")
+	private BigDecimal totalMoney;
+
+	/**
+	 * 结算金额
+	 */
+	@ApiModelProperty(value = "结算金额")
+	private BigDecimal paymentAmountTl;
+
+	/**
+	 * 利润
+	 */
+	@ApiModelProperty(value = "利润")
+	private BigDecimal profit;
+
+	/**
+	 * 成本
+	 */
+	@ApiModelProperty(value = "成本")
+	private BigDecimal cost;
+
+	/**
+	 * 未收金额
+	 */
+	@ApiModelProperty(value = "未收金额")
+	private BigDecimal outstandingAmount;
+
+	/**
+	 * 业务日期
+	 */
+	@TableField(exist = false)
+	private List<String> businesDateList;
+
+	/**
+	 * 类型
+	 */
+	@TableField(exist = false)
+	private Integer type;
+
+
+}

+ 11 - 0
blade-service/blade-check/src/main/java/org/springblade/check/controller/AuditProecessController.java

@@ -58,6 +58,8 @@ import org.springblade.land.feign.ILandClient;
 import org.springblade.purchase.sales.entity.Order;
 import org.springblade.purchase.sales.entity.OrderFiles;
 import org.springblade.purchase.sales.feign.IOrderDescClient;
+import org.springblade.salesPart.entity.PjCorpsDesc;
+import org.springblade.salesPart.feign.IPJCorpClient;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springframework.web.bind.annotation.*;
@@ -86,6 +88,8 @@ public class AuditProecessController extends BladeController {
 
 	private final ICorpsDescClient corpsDescClient;
 
+	private final IPJCorpClient ipjCorpClient;
+
 	private final IFinanceClient financeClient;
 
 	private final IUserClient userClient;
@@ -144,6 +148,13 @@ public class AuditProecessController extends BladeController {
 					}
 					auditOrderVO.setAmount(e.getReceivableAmount());
 					auditOrderVO.setAmountReceivable(e.getPayAmount());
+				}else if ("PJTK".equals(e.getCheckType()) || "PJCG".equals(e.getCheckType())){
+					if (ObjectUtils.isNotNull(e.getCorpId())) {
+						PjCorpsDesc corpsDesc = ipjCorpClient.getByCorp(e.getCorpId());
+						if (ObjectUtils.isNotNull(corpsDesc)) {
+							auditOrderVO.setCorpsName(corpsDesc.getCname());
+						}
+					}
 				} else if ("RK".equals(e.getCheckType()) || "CK".equals(e.getCheckType()) || "PD".equals(e.getCheckType())) {
 					if (e.getBillId() != null) {
 						Order order = orderDescClient.getById(e.getBillId());

+ 1 - 0
blade-service/blade-pay/src/main/java/org/springblade/pay/tonglianPayment/service/impl/PaymentServiceImpl.java

@@ -576,6 +576,7 @@ public class PaymentServiceImpl implements IPaymentService {
 					if (re.isSuccess() && ObjectUtils.isNotNull(re.getData())) {
 						for (PjOrder selectOrder : re.getData()) {
 							selectOrder.setActualPaymentStatus(2);
+							selectOrder.setPaymentAmountTl(selectOrder.getTotalMoney());
 							selectOrder.setStatus(OrderTypeEnum.XSDQR.getType());
 							selectOrder.setXcxStatus(OrderTypeEnum.XSDFH.getType());
 							wechatMark.setBillNo(selectOrder.getOrdNo());

+ 14 - 3
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/controller/CorpsDescController.java

@@ -46,6 +46,7 @@ import org.springblade.salesPart.entity.*;
 import org.springblade.salesPart.excel.CorpsDescExportExcel;
 import org.springblade.salesPart.excel.CorpsDescImportExcel;
 import org.springblade.salesPart.excel.SupplierImportExcel;
+import org.springblade.salesPart.order.service.IOrderService;
 import org.springblade.salesPart.storage.service.IStorageDescService;
 import org.springblade.salesPart.vo.CorpsDescVO;
 import org.springframework.web.bind.annotation.*;
@@ -75,6 +76,7 @@ public class CorpsDescController extends BladeController {
 	private final ICorpsTypeService corpsTypeService;
 	private final ICorpsAttnService corpsAttnService;
 	private final IStorageDescService storageDescService;
+	private final IOrderService orderService;
 
 	/**
 	 * 详情
@@ -205,7 +207,16 @@ public class CorpsDescController extends BladeController {
 	@ApiOperationSupport(order = 7)
 	@ApiOperation(value = "删除", notes = "传入ids")
 	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
-		return R.status(corpsDescService.removeByIds(Func.toLongList(ids)));
+		List<Long> list = Func.toLongList(ids);
+		if (list.size() > 0) {
+			if (orderService.count(new LambdaQueryWrapper<PjOrder>()
+				.eq(PjOrder::getTenantId, AuthUtil.getTenantId())
+				.eq(PjOrder::getIsDeleted, 0)
+				.in(PjOrder::getCustomerId, list)) > 0) {
+				throw new RuntimeException("客户已创建业务数据,删除失败");
+			}
+		}
+		return R.status(corpsDescService.removeByIds(list));
 	}
 
 	/**
@@ -316,7 +327,7 @@ public class CorpsDescController extends BladeController {
 			.eq(PjCorpsDesc::getIsDeleted, 0)
 			.eq(PjCorpsDesc::getSalesCompanyId, AuthUtil.getDeptId())//公司
 			.eq(PjCorpsDesc::getCorpType, corpsDesc.getCorpType())
-			.eq(ObjectUtils.isNotNull(corpsDesc.getEnableOrNot()),PjCorpsDesc::getEnableOrNot, corpsDesc.getEnableOrNot())
+			.eq(ObjectUtils.isNotNull(corpsDesc.getEnableOrNot()), PjCorpsDesc::getEnableOrNot, corpsDesc.getEnableOrNot())
 			.like(ObjectUtils.isNotNull(corpsDesc.getCname()), PjCorpsDesc::getCname, corpsDesc.getCname());
 		if (AuthUtil.getUserRole().contains("业务员")) {
 			lambdaQueryWrapper.eq(PjCorpsDesc::getSalesmanId, AuthUtil.getUserId());
@@ -380,7 +391,7 @@ public class CorpsDescController extends BladeController {
 		lambdaQueryWrapper.eq(PjCorpsDesc::getTenantId, AuthUtil.getTenantId());
 		lambdaQueryWrapper.eq(PjCorpsDesc::getIsDeleted, 0);
 		lambdaQueryWrapper.like(StringUtil.isNotBlank(corpsDesc.getCname()), PjCorpsDesc::getCname, corpsDesc.getCname());
-			lambdaQueryWrapper.like(StringUtil.isNotBlank(corpsDesc.getCorpType()), PjCorpsDesc::getCorpType, corpsDesc.getCorpType());
+		lambdaQueryWrapper.like(StringUtil.isNotBlank(corpsDesc.getCorpType()), PjCorpsDesc::getCorpType, corpsDesc.getCorpType());
 		//获得客户信息
 		List<PjCorpsDesc> corpsDescList = corpsDescService.list(lambdaQueryWrapper);
 		List<PjCorpsDesc> voList = BeanUtil.copy(corpsDescList, PjCorpsDesc.class);

+ 43 - 3
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/controller/OrderController.java

@@ -26,6 +26,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.AllArgsConstructor;
+import org.springblade.common.annotation.RepeatSubmit;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.excel.util.ExcelUtil;
 import org.springblade.core.mp.support.Condition;
@@ -42,10 +43,12 @@ import org.springblade.salesPart.entity.PjOrderItems;
 import org.springblade.salesPart.enums.OrderTypeEnum;
 import org.springblade.salesPart.excel.PjOrderExportExcelCG;
 import org.springblade.salesPart.excel.PjOrderExportExcelXS;
+import org.springblade.salesPart.excel.PjOrderStatisticsExcel;
 import org.springblade.salesPart.order.service.IOrderItemsService;
 import org.springblade.salesPart.order.service.IOrderService;
 import org.springblade.salesPart.vo.OrderStatistics;
 import org.springblade.salesPart.vo.OrderVO;
+import org.springblade.salesPart.vo.PjOrderStatisticsWeb;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springframework.web.bind.annotation.*;
@@ -83,7 +86,6 @@ public class OrderController extends BladeController {
 	 */
 	@GetMapping("/detail")
 	@ApiOperationSupport(order = 1)
-
 	@ApiOperation(value = "详情", notes = "传入order")
 	public R<PjOrder> detail(PjOrder order) {
 		order.setTenantId(AuthUtil.getTenantId());
@@ -294,6 +296,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/save")
 	@ApiOperationSupport(order = 4)
 	@ApiOperation(value = "新增", notes = "传入order")
+	@RepeatSubmit
 	public R save(@Valid @RequestBody PjOrder order) {
 		return R.status(orderService.save(order));
 	}
@@ -304,6 +307,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/update")
 	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "修改", notes = "传入order")
+	@RepeatSubmit
 	public R update(@Valid @RequestBody PjOrder order) {
 		int itemCount = orderItemsService.count(new LambdaQueryWrapper<PjOrderItems>()
 			.eq(PjOrderItems::getPid, order.getId())
@@ -325,6 +329,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/submit")
 	@ApiOperationSupport(order = 6)
 	@ApiOperation(value = "新增或修改", notes = "传入order")
+	@RepeatSubmit
 	public R submit(@Valid @RequestBody PjOrder order) {
 		if (StringUtils.isBlank(order.getBsType())) {
 			throw new RuntimeException("缺少必要参数");
@@ -349,6 +354,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/generateShipTask")
 	@ApiOperationSupport(order = 8)
 	@ApiOperation(value = "生成出库任务", notes = "传入order")
+	@RepeatSubmit
 	public R generateShipTask(@Valid @RequestBody PjOrder order) {
 		if (order.getId() == null) {
 			throw new RuntimeException("来源信息错误");
@@ -362,6 +368,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/revokeGenerateShipTask")
 	@ApiOperationSupport(order = 8)
 	@ApiOperation(value = "生成出库任务", notes = "传入order")
+	@RepeatSubmit
 	public R revokeGenerateShipTask(@Valid @RequestBody PjOrder order) {
 		if (order.getId() == null) {
 			throw new RuntimeException("来源信息错误");
@@ -375,6 +382,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/inboundTask")
 	@ApiOperationSupport(order = 9)
 	@ApiOperation(value = "生成入库任务", notes = "传入order")
+	@RepeatSubmit
 	public R inboundTask(@Valid @RequestBody PjOrder order) {
 		if (order.getId() == null) {
 			throw new RuntimeException("来源信息错误");
@@ -388,6 +396,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/revokeInboundTask")
 	@ApiOperationSupport(order = 9)
 	@ApiOperation(value = "生成入库任务", notes = "传入order")
+	@RepeatSubmit
 	public R revokeInboundTask(@Valid @RequestBody PjOrder order) {
 		if (order.getId() == null) {
 			throw new RuntimeException("来源信息错误");
@@ -401,6 +410,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/appUpdate")
 	@ApiOperationSupport(order = 10)
 	@ApiOperation(value = "点击收货修改状态", notes = "传入order")
+	@RepeatSubmit
 	public R appUpdate(@Valid @RequestBody PjOrder order) {
 		order.setXcxStatus(OrderTypeEnum.RECEIVEDGOODS.getType());
 		order.setStatus(OrderTypeEnum.RECEIVEDGOODS.getType());
@@ -465,6 +475,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/checkOrder")
 	@ApiOperationSupport(order = 13)
 	@ApiOperation(value = "请核", notes = "传入order")
+	@RepeatSubmit
 	public R checkOrder(@RequestBody PjOrder order) {
 		PjOrder declare = orderService.checkOrder(order);
 		return R.data(declare);
@@ -476,6 +487,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/revokeCheckOrder")
 	@ApiOperationSupport(order = 13)
 	@ApiOperation(value = "撤销请核", notes = "传入order")
+	@RepeatSubmit
 	public R revokeCheckOrder(@RequestBody PjOrder order) {
 		PjOrder declare = orderService.revokeCheckOrder(order);
 		return R.data(declare);
@@ -487,6 +499,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/passCheck")
 	@ApiOperationSupport(order = 14)
 	@ApiOperation(value = "审核通过", notes = "传入id")
+	@RepeatSubmit
 	public R passCheck(@ApiParam(value = "主表id", required = true) @RequestParam Long id) {
 		return orderService.passCheck(id);
 	}
@@ -497,6 +510,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/underReview")
 	@ApiOperationSupport(order = 15)
 	@ApiOperation(value = "审核中", notes = "传入id")
+	@RepeatSubmit
 	public R underReview(@ApiParam(value = "主表id", required = true) @RequestParam Long id) {
 		return orderService.underReview(id);
 	}
@@ -507,6 +521,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/passCancel")
 	@ApiOperationSupport(order = 16)
 	@ApiOperation(value = "Feign-审核不通过", notes = "传入财务id")
+	@RepeatSubmit
 	public R passCancel(@ApiParam(value = "财务主表id", required = true) @RequestParam Long id) {
 		orderService.passCancel(id);
 		return R.success("操作成功");
@@ -518,6 +533,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/confirmRefund")
 	@ApiOperationSupport(order = 17)
 	@ApiOperation(value = "请核", notes = "传入order")
+	@RepeatSubmit
 	public R confirmRefund(@RequestBody PjOrder order) {
 		return orderService.confirmRefund(order);
 	}
@@ -527,6 +543,7 @@ public class OrderController extends BladeController {
 	 */
 	@ApiOperation(value = "获取支付的请求参数")
 	@GetMapping("/payPrepay")
+	@RepeatSubmit
 	public R payPrepay(@RequestParam("srcOrderNo") String srcOrderNo) {
 		return orderService.getWeChatPayment(srcOrderNo);
 	}
@@ -586,6 +603,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/checkOrderCG")
 	@ApiOperationSupport(order = 13)
 	@ApiOperation(value = "请核", notes = "传入order")
+	@RepeatSubmit
 	public R checkOrderCg(@RequestBody PjOrder order) {
 		PjOrder declare = orderService.checkOrderCG(order);
 		return R.data(declare);
@@ -597,6 +615,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/revokeCheckOrderCG")
 	@ApiOperationSupport(order = 13)
 	@ApiOperation(value = "撤销请核", notes = "传入order")
+	@RepeatSubmit
 	public R revokeCheckOrderCg(@RequestBody PjOrder order) {
 		PjOrder declare = orderService.revokeCheckOrderCG(order);
 		return R.data(declare);
@@ -682,8 +701,8 @@ public class OrderController extends BladeController {
 			.gt(ObjectUtils.isNotNull(statusDate), PjOrder::getBusinesDate, statusDate)
 			.lt(ObjectUtils.isNotNull(endDate), PjOrder::getBusinesDate, endDate)
 			.eq(PjOrder::getBsType, "XS");
-		 if (AuthUtil.getUserRole().contains("业务员")) {
-			lambdaQueryWrapperXS.gt(PjOrder::getSalerId,AuthUtil.getTenantId());
+		if (AuthUtil.getUserRole().contains("业务员")) {
+			lambdaQueryWrapperXS.gt(PjOrder::getSalerId, AuthUtil.getTenantId());
 		}
 		List<PjOrder> pjOrderListXS = orderService.list(lambdaQueryWrapperXS);
 		List<PjOrder> pjOrderListCG = orderService.list(new LambdaQueryWrapper<PjOrder>().eq(PjOrder::getIsDeleted, 0)
@@ -720,4 +739,25 @@ public class OrderController extends BladeController {
 		return R.data(map);
 	}
 
+
+	/**
+	 * web利润统计
+	 */
+	@GetMapping("/statistics")
+	@ApiOperation(value = "app营业分析", notes = "传入参数")
+	public R<IPage<PjOrderStatisticsWeb>> statistics(PjOrderStatisticsWeb order, Query query) {
+		IPage<PjOrderStatisticsWeb> pages = orderService.statisticsPage(Condition.getPage(query), order);
+		return R.data(pages);
+	}
+
+	/**
+	 * web利润统计
+	 */
+	@GetMapping("/statistics-export")
+	@ApiOperation(value = "app营业分析", notes = "传入参数")
+	public void statisticsExport(PjOrderStatisticsWeb order, HttpServletResponse response) {
+		List<PjOrderStatisticsExcel> list = orderService.statisticsExport(order);
+		ExcelUtil.export(response, "利润统计", "利润统计", list, PjOrderStatisticsExcel.class);
+	}
+
 }

+ 6 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/mapper/OrderMapper.java

@@ -20,8 +20,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Param;
 import org.springblade.salesPart.entity.PjOrder;
+import org.springblade.salesPart.excel.PjOrderStatisticsExcel;
 import org.springblade.salesPart.vo.OrderStatistics;
 import org.springblade.salesPart.vo.OrderVO;
+import org.springblade.salesPart.vo.PjOrderStatisticsWeb;
 
 import java.math.BigDecimal;
 import java.time.LocalDate;
@@ -58,4 +60,8 @@ public interface OrderMapper extends BaseMapper<PjOrder> {
 	List<PjOrder> salesman(@Param("order") PjOrder order);
 
 	Map<String, BigDecimal> columnar(LocalDate firstDay, LocalDate lastDay,String tenantId);
+
+    List<PjOrderStatisticsWeb> statisticsPage(IPage<PjOrderStatisticsWeb> page,@Param("order") PjOrderStatisticsWeb order);
+
+	List<PjOrderStatisticsExcel> statisticsExport(@Param("order") PjOrderStatisticsWeb order);
 }

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

@@ -220,5 +220,93 @@
             and pcd.salesman_id = #{order.salerId}
         </if>
     </select>
+    <select id="statisticsPage" resultType="org.springblade.salesPart.vo.PjOrderStatisticsWeb">
+        SELECT
+            o.customer_id AS customerId,
+            o.customer_name AS customerName,
+            DATE_FORMAT( o.busines_date, '%Y-%m' ) AS businesDate,
+            IF
+                ( SUM( o.total_money ), SUM( o.total_money ), 0 ) AS totalMoney,
+            IF
+                ( SUM( o.cost ), SUM( o.cost ), 0 ) AS cost,
+            IF
+                ( SUM( o.gross_profit ), SUM( o.gross_profit ), 0 ) AS profit,
+            IF
+                ( SUM( o.payment_amount_tl ), SUM( o.payment_amount_tl ), 0 ) AS paymentAmountTl,
+            (
+                    IF
+                        ( SUM( o.total_money ), SUM( o.total_money ), 0 ) -
+                    IF
+                        ( SUM( o.payment_amount_tl ), SUM( o.payment_amount_tl ), 0 )) AS outstandingAmount
+        FROM
+            pjpf_order o
+        WHERE
+            o.tenant_id = '883868'
+          AND o.is_deleted = '0'
+        <if test="order.customerId!=null">
+            and o.customer_id = #{order.customerId}
+        </if>
+        <if test="order.businesDateList !=null and order.businesDateList !='' and order.businesDateList[0] != ''">
+            and DATE_FORMAT(o.busines_date,'%Y-%m') &gt;= #{order.businesDateList[0]}
+        </if>
+        <if test="order.businesDateList !=null and order.businesDateList !='' and order.businesDateList[1] != ''">
+            and DATE_FORMAT(o.busines_date,'%Y-%m') &lt;= #{order.businesDateList[1]}
+        </if>
+        <if test="order.type != null and order.type  == 0">
+            and o.bs_type = 'XS'
+        </if>
+        <if test="order.type != null and order.type  == 1">
+            and o.bs_type = 'CG'
+        </if>
+        GROUP BY
+            o.customer_id,
+            DATE_FORMAT(
+                o.busines_date,
+                '%Y-%m')
+    </select>
+    <select id="statisticsExport" resultType="org.springblade.salesPart.excel.PjOrderStatisticsExcel">
+        SELECT
+        o.customer_id AS customerId,
+        o.customer_name AS customerName,
+        DATE_FORMAT( o.busines_date, '%Y-%m' ) AS businesDate,
+        IF
+        ( SUM( o.total_money ), SUM( o.total_money ), 0 ) AS totalMoney,
+        IF
+        ( SUM( o.cost ), SUM( o.cost ), 0 ) AS cost,
+        IF
+        ( SUM( o.gross_profit ), SUM( o.gross_profit ), 0 ) AS profit,
+        IF
+        ( SUM( o.payment_amount_tl ), SUM( o.payment_amount_tl ), 0 ) AS paymentAmountTl,
+        (
+        IF
+        ( SUM( o.total_money ), SUM( o.total_money ), 0 ) -
+        IF
+        ( SUM( o.payment_amount_tl ), SUM( o.payment_amount_tl ), 0 )) AS outstandingAmount
+        FROM
+        pjpf_order o
+        WHERE
+        o.tenant_id = '883868'
+        AND o.is_deleted = '0'
+        <if test="order.customerId!=null">
+            and o.customer_id = #{order.customerId}
+        </if>
+        <if test="order.businesDateList !=null and order.businesDateList !='' and order.businesDateList[0] != ''">
+            and DATE_FORMAT(o.busines_date,'%Y-%m') &gt;= #{order.businesDateList[0]}
+        </if>
+        <if test="order.businesDateList !=null and order.businesDateList !='' and order.businesDateList[1] != ''">
+            and DATE_FORMAT(o.busines_date,'%Y-%m') &lt;= #{order.businesDateList[1]}
+        </if>
+        <if test="order.type != null and order.type  == 0">
+            and o.bs_type = 'XS'
+        </if>
+        <if test="order.type != null and order.type  == 1">
+            and o.bs_type = 'CG'
+        </if>
+        GROUP BY
+        o.customer_id,
+        DATE_FORMAT(
+        o.busines_date,
+        '%Y-%m')
+    </select>
 
 </mapper>

+ 6 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/IOrderService.java

@@ -20,8 +20,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.core.tool.api.R;
 import org.springblade.salesPart.entity.PjOrder;
+import org.springblade.salesPart.excel.PjOrderStatisticsExcel;
 import org.springblade.salesPart.vo.OrderStatistics;
 import org.springblade.salesPart.vo.OrderVO;
+import org.springblade.salesPart.vo.PjOrderStatisticsWeb;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -146,4 +148,8 @@ public interface IOrderService extends IService<PjOrder> {
 	List<PjOrder> salesman(PjOrder order);
 
 	Map<String, List<BigDecimal>> columnar(PjOrder order);
+
+	IPage<PjOrderStatisticsWeb> statisticsPage(IPage<PjOrderStatisticsWeb> page, PjOrderStatisticsWeb order);
+
+	List<PjOrderStatisticsExcel> statisticsExport(PjOrderStatisticsWeb order);
 }

+ 17 - 6
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/impl/OrderServiceImpl.java

@@ -41,6 +41,7 @@ import org.springblade.pay.tonglianPayment.fegin.IPaymentClient;
 import org.springblade.salesPart.corps.mapper.CorpsDescMapper;
 import org.springblade.salesPart.entity.*;
 import org.springblade.salesPart.enums.OrderTypeEnum;
+import org.springblade.salesPart.excel.PjOrderStatisticsExcel;
 import org.springblade.salesPart.goods.mapper.GoodsDescMapper;
 import org.springblade.salesPart.history.mapper.HistoryMapper;
 import org.springblade.salesPart.order.mapper.OrderItemsMapper;
@@ -56,6 +57,7 @@ import org.springblade.salesPart.stock.service.IStockDescService;
 import org.springblade.salesPart.storage.mapper.StorageDescMapper;
 import org.springblade.salesPart.vo.OrderStatistics;
 import org.springblade.salesPart.vo.OrderVO;
+import org.springblade.salesPart.vo.PjOrderStatisticsWeb;
 import org.springblade.system.entity.Dept;
 import org.springblade.system.feign.ISysClient;
 import org.springblade.system.user.entity.User;
@@ -244,6 +246,16 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 		return map;
 	}
 
+	@Override
+	public IPage<PjOrderStatisticsWeb> statisticsPage(IPage<PjOrderStatisticsWeb> page, PjOrderStatisticsWeb order) {
+		return page.setRecords(baseMapper.statisticsPage(page, order));
+	}
+
+	@Override
+	public List<PjOrderStatisticsExcel> statisticsExport(PjOrderStatisticsWeb order) {
+		return baseMapper.statisticsExport(order);
+	}
+
 	/**
 	 * 保存订单信息
 	 *
@@ -280,12 +292,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 				}
 
 				order.setOrdNo((String) billNo.getData());
+				order.setSrcOrdNo((String) billNo.getData());
 				order.setCreateTime(new Date());
 				order.setCreateUser(AuthUtil.getUserId());
 				order.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
 				order.setTenantId(AuthUtil.getTenantId());
 				order.setStatus(OrderTypeEnum.XSLR.getType());
 				order.setBusinessSource(OrderTypeEnum.WEB.getType());
+				order.setActualPaymentStatus(1);
 
 				//根据客户账期计算应结日期
 				if (ObjectUtil.isNotEmpty(corpsDesc.getAccountPeriod()) && ObjectUtils.isNotNull(order.getBusinesDate())) {
@@ -540,9 +554,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 		pjOrder.setStatus(OrderTypeEnum.XSDFH.getType());
 		pjOrder.setXcxStatus(OrderTypeEnum.XSDFH.getType());
 		pjOrder.setGenerateTask(OrderTypeEnum.SCRW.getType());
-		if ("内部销售".equals(pjOrder.getBusinessSource())) {
-			pjOrder.setActualPaymentStatus(1);
-		}
 		baseMapper.updateById(pjOrder);
 		if ("挂账".equals(pjOrder.getReceivableType())) {
 			PjCorpsDesc pjCorpsDesc = corpsDescMapper.selectById(pjOrder.getCustomerId());
@@ -638,7 +649,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 			.eq(PjShip::getBizTypeName, "FHRW"));
 		if (ObjectUtils.isNotNull(pjShip) && (ObjectUtils.isNull(pjShip.getSendTotalNum()) || new BigDecimal("0.00").compareTo(pjShip.getSendTotalNum()) == 0)) {
 			shipMapper.deleteById(pjShip.getId());
-			shipMapper.deleteByTaskId(pjShip.getTaskId());
+			shipMapper.deleteByTaskId(pjShip.getId());
 		} else {
 			throw new RuntimeException("出库已完成,禁止撤销!");
 		}
@@ -1302,9 +1313,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 			.eq(PjShip::getBizTypeName, "SHRW"));
 		if (ObjectUtils.isNotNull(pjShip) && (ObjectUtils.isNull(pjShip.getSendTotalNum()) || new BigDecimal("0.00").compareTo(pjShip.getSendTotalNum()) == 0)) {
 			shipMapper.deleteById(pjShip.getId());
-			shipMapper.deleteByTaskId(pjShip.getTaskId());
+			shipMapper.deleteByTaskId(pjShip.getId());
 		} else {
-			throw new RuntimeException("库已完成,禁止撤销!");
+			throw new RuntimeException("库已完成,禁止撤销!");
 		}
 		//修改销售状态为待发货
 		pjOrder.setStatus(OrderTypeEnum.XSDQR.getType());

+ 8 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/settlement/service/impl/SettlementServiceImpl.java

@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import io.seata.spring.annotation.GlobalTransactional;
 import lombok.AllArgsConstructor;
 import org.springblade.client.feign.ISerialClient;
 import org.springblade.core.secure.utils.AuthUtil;
@@ -36,6 +37,7 @@ import org.springblade.salesPart.settlement.service.ISettlementItemsService;
 import org.springblade.salesPart.settlement.service.ISettlementService;
 import org.springblade.salesPart.vo.SettlementVO;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -75,6 +77,8 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, PjSettl
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
 	public R add(PjSettlement settlement) {
 		if (settlement.getId() == null) {
 			// 获取系统编号
@@ -140,6 +144,8 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, PjSettl
 
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
 	public R collectionAndPayment(PjSettlement settlement) {
 		if (ObjectUtils.isNotNull(settlement.getSettlementItemsList())) {
 			List<Long> ids = settlement.getSettlementItemsList().stream().map(PjSettlementItems::getSrcParentId).collect(Collectors.toList());
@@ -228,6 +234,8 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, PjSettl
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
 	public R revokeCollectionAndPayment(PjSettlement settlement) {
 		if (ObjectUtils.isNotNull(settlement.getSettlementItemsList())) {
 			List<Long> ids = settlement.getSettlementItemsList().stream().map(PjSettlementItems::getSrcParentId).collect(Collectors.toList());