userName 1 год назад
Родитель
Сommit
3ada6879e0

+ 1 - 1
xingyun-api/src/main/java/com/lframework/xingyun/api/XingYunApiApplication.java

@@ -24,7 +24,7 @@ public class XingYunApiApplication {
24 24
 
25 25
   public static void main(String[] args) {
26 26
 
27
-    SpringApplication.run(XingYunApiApplication.class, args);
27
+        SpringApplication.run(XingYunApiApplication.class, args);
28 28
   }
29 29
 
30 30
   /**

+ 1 - 1
xingyun-api/src/main/resources/application.yml

@@ -103,7 +103,7 @@ jugg:
103 103
     #  cacheName2: 7200
104 104
   #开启多租户
105 105
   tenant:
106
-    enabled: true
106
+    enabled: false
107 107
   #开启websocket
108 108
   ws:
109 109
     enabled: true

+ 5 - 2
xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleOrderController.java

@@ -219,9 +219,9 @@ public class SaleOrderController extends DefaultBaseController {
219 219
    * 创建订单
220 220
    */
221 221
   @ApiOperation("创建订单")
222
-  @HasPermission({"sale:order:add"})
222
+//  @HasPermission({"sale:order:add"})
223 223
   @PostMapping
224
-  public InvokeResult<String> create(@RequestBody @Valid CreateSaleOrderVo vo) {
224
+  public InvokeResult<String> create(@RequestBody   CreateSaleOrderVo vo) {
225 225
 
226 226
     vo.validate();
227 227
 
@@ -230,6 +230,9 @@ public class SaleOrderController extends DefaultBaseController {
230 230
     return InvokeResultBuilder.success(id);
231 231
   }
232 232
 
233
+
234
+
235
+
233 236
   /**
234 237
    * 修改订单
235 238
    */

+ 1 - 1
xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/SaleOrderExportModel.java

@@ -167,7 +167,7 @@ public class SaleOrderExportModel extends BaseBo<SaleOrder> implements ExcelMode
167 167
             this.setSalerName(saler.getName());
168 168
         }
169 169
         this.setTotalNum(dto.getTotalNum());
170
-        this.setGiftNum(dto.getTotalGiftNum());
170
+      //  this.setGiftNum(dto.getTotalGiftNum());
171 171
         this.setTotalAmount(dto.getTotalAmount());
172 172
         this.setDescription(dto.getDescription());
173 173
         this.setCreateTime(DateUtil.toDate(dto.getCreateTime()));

+ 54 - 54
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderServiceImpl.java

@@ -580,12 +580,12 @@ public class SaleOrderServiceImpl extends BaseMpServiceImpl<SaleOrderMapper, Sal
580 580
     }
581 581
 
582 582
     order.setScId(vo.getScId());
583
-    order.setPlanId(vo.getPlanId());
584
-    Customer customer = customerService.findById(vo.getCustomerId());
585
-    if (customer == null) {
586
-      throw new InputErrorException("客户不存在!");
587
-    }
588
-    order.setCustomerId(vo.getCustomerId());
583
+  //  order.setPlanId(vo.getPlanId());
584
+//    Customer customer = customerService.findById(vo.getCustomerId());
585
+//    if (customer == null) {
586
+//      throw new InputErrorException("客户不存在!");
587
+//    }
588
+  //  order.setCustomerId(vo.getCustomerId());
589 589
 
590 590
     if (!StringUtil.isBlank(vo.getSalerId())) {
591 591
       UserDto saler = userService.findById(vo.getSalerId());
@@ -628,71 +628,71 @@ public class SaleOrderServiceImpl extends BaseMpServiceImpl<SaleOrderMapper, Sal
628 628
 
629 629
       orderDetail.setProductId(productVo.getProductId());
630 630
       orderDetail.setOrderNum(productVo.getOrderNum());
631
-      orderDetail.setOriPrice(productVo.getOriPrice());
632
-      orderDetail.setDiscountRate(productVo.getDiscountRate());
633
-      orderDetail.setTaxPrice(productVo.getTaxPrice());
634
-      orderDetail.setIsGift(isGift);
635
-      orderDetail.setTaxRate(product.getSaleTaxRate());
631
+     // orderDetail.setOriPrice(productVo.getOriPrice());
632
+   //   orderDetail.setDiscountRate(productVo.getDiscountRate());
633
+    //  orderDetail.setTaxPrice(productVo.getTaxPrice());
634
+    //  orderDetail.setIsGift(isGift);
635
+     // orderDetail.setTaxRate(product.getSaleTaxRate());
636 636
       orderDetail.setDescription(
637 637
           StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR
638 638
               : productVo.getDescription());
639 639
       orderDetail.setOrderNo(orderNo);
640 640
 
641
-      saleOrderDetailService.save(orderDetail);
642
-
643
-      // 这里处理组合商品
644
-      if (product.getProductType() == ProductType.BUNDLE) {
645
-        List<ProductBundle> productBundles = productBundleService.getByMainProductId(
646
-            product.getId());
647
-        // 构建指标项
648
-        Map<Object, Number> bundleWeight = new HashMap<>(productBundles.size());
649
-        for (ProductBundle productBundle : productBundles) {
650
-          bundleWeight.put(productBundle.getProductId(),
651
-              NumberUtil.mul(productBundle.getSalePrice(), productBundle.getBundleNum()));
652
-        }
653
-        Map<Object, Number> splitPriceMap = SplitNumberUtil.split(orderDetail.getTaxPrice(),
654
-            bundleWeight, 2);
655
-        List<SaleOrderDetailBundle> saleOrderDetailBundles = productBundles.stream()
656
-            .map(productBundle -> {
657
-              Product bundle = productService.findById(productBundle.getProductId());
658
-              SaleOrderDetailBundle saleOrderDetailBundle = new SaleOrderDetailBundle();
659
-              saleOrderDetailBundle.setId(IdUtil.getId());
660
-              saleOrderDetailBundle.setOrderId(order.getId());
661
-              saleOrderDetailBundle.setDetailId(orderDetail.getId());
662
-              saleOrderDetailBundle.setMainProductId(product.getId());
663
-              saleOrderDetailBundle.setOrderNum(orderDetail.getOrderNum());
664
-              saleOrderDetailBundle.setProductId(productBundle.getProductId());
665
-              saleOrderDetailBundle.setProductOrderNum(
666
-                  NumberUtil.mul(orderDetail.getOrderNum(), productBundle.getBundleNum())
667
-                      .intValue());
668
-              saleOrderDetailBundle.setProductOriPrice(productBundle.getSalePrice());
669
-              // 这里会有尾差
670
-              saleOrderDetailBundle.setProductTaxPrice(NumberUtil.getNumber(NumberUtil.div(
671
-                  BigDecimal.valueOf(
672
-                      splitPriceMap.get(productBundle.getProductId()).doubleValue()), productBundle.getBundleNum()), 2));
673
-              saleOrderDetailBundle.setProductTaxRate(bundle.getSaleTaxRate());
674
-
675
-              return saleOrderDetailBundle;
676
-            }).collect(Collectors.toList());
677
-
678
-        saleOrderDetailBundleService.saveBatch(saleOrderDetailBundles);
679
-      }
641
+   boolean rrr=   saleOrderDetailService.save(orderDetail);
642
+
643
+//      // 这里处理组合商品
644
+//      if (product.getProductType() == ProductType.BUNDLE) {
645
+//        List<ProductBundle> productBundles = productBundleService.getByMainProductId(
646
+//            product.getId());
647
+//        // 构建指标项
648
+//        Map<Object, Number> bundleWeight = new HashMap<>(productBundles.size());
649
+//        for (ProductBundle productBundle : productBundles) {
650
+//          bundleWeight.put(productBundle.getProductId(),
651
+//              NumberUtil.mul(productBundle.getSalePrice(), productBundle.getBundleNum()));
652
+//        }
653
+//        Map<Object, Number> splitPriceMap = SplitNumberUtil.split(orderDetail.getTaxPrice(),
654
+//            bundleWeight, 2);
655
+//        List<SaleOrderDetailBundle> saleOrderDetailBundles = productBundles.stream()
656
+//            .map(productBundle -> {
657
+//              Product bundle = productService.findById(productBundle.getProductId());
658
+//              SaleOrderDetailBundle saleOrderDetailBundle = new SaleOrderDetailBundle();
659
+//              saleOrderDetailBundle.setId(IdUtil.getId());
660
+//              saleOrderDetailBundle.setOrderId(order.getId());
661
+//              saleOrderDetailBundle.setDetailId(orderDetail.getId());
662
+//              saleOrderDetailBundle.setMainProductId(product.getId());
663
+//              saleOrderDetailBundle.setOrderNum(orderDetail.getOrderNum());
664
+//              saleOrderDetailBundle.setProductId(productBundle.getProductId());
665
+//              saleOrderDetailBundle.setProductOrderNum(
666
+//                  NumberUtil.mul(orderDetail.getOrderNum(), productBundle.getBundleNum())
667
+//                      .intValue());
668
+//              saleOrderDetailBundle.setProductOriPrice(productBundle.getSalePrice());
669
+//              // 这里会有尾差
670
+//              saleOrderDetailBundle.setProductTaxPrice(NumberUtil.getNumber(NumberUtil.div(
671
+//                  BigDecimal.valueOf(
672
+//                      splitPriceMap.get(productBundle.getProductId()).doubleValue()), productBundle.getBundleNum()), 2));
673
+//              saleOrderDetailBundle.setProductTaxRate(bundle.getSaleTaxRate());
674
+//
675
+//              return saleOrderDetailBundle;
676
+//            }).collect(Collectors.toList());
677
+//
678
+//        saleOrderDetailBundleService.saveBatch(saleOrderDetailBundles);
679
+//      }
680 680
       orderNo++;
681 681
     }
682 682
     order.setTotalNum(totalNum);
683
-    order.setTotalGiftNum(giftNum);
684
-    order.setTotalAmount(totalAmount);
683
+  //  order.setTotalGiftNum(giftNum);
684
+  //  order.setTotalAmount(totalAmount);
685 685
     order.setDescription(
686 686
         StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription());
687 687
 
688
-    orderPayTypeService.create(order.getId(), vo.getPayTypes());
688
+   // orderPayTypeService.create(order.getId(), vo.getPayTypes());
689 689
   }
690 690
 
691 691
   private void sendApprovePassEvent(SaleOrder order) {
692 692
 
693 693
     ApprovePassSaleOrderEvent event = new ApprovePassSaleOrderEvent(this);
694 694
     event.setId(order.getId());
695
-    event.setTotalAmount(order.getTotalAmount());
695
+   // event.setTotalAmount(order.getTotalAmount());
696 696
     event.setApproveTime(order.getApproveTime());
697 697
     event.setCreateUser(order.getCreateById());
698 698
     ApplicationUtil.publishEvent(event);

+ 41 - 41
xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/CreateSaleOrderVo.java

@@ -23,9 +23,9 @@ public class CreateSaleOrderVo implements BaseVo, Serializable {
23 23
   /**
24 24
    * 仓库ID
25 25
    */
26
-  @ApiModelProperty(value = "销售计划ID")
27
-
28
-  private String planId;
26
+//  @ApiModelProperty(value = "销售计划ID")
27
+//
28
+//  private String planId;
29 29
 
30 30
 
31 31
   /**
@@ -39,7 +39,7 @@ public class CreateSaleOrderVo implements BaseVo, Serializable {
39 39
    * 客户ID
40 40
    */
41 41
   @ApiModelProperty(value = "客户ID", required = true)
42
-  @NotBlank(message = "客户ID不能为空!")
42
+//  @NotBlank(message = "客户ID不能为空!")
43 43
   private String customerId;
44 44
 
45 45
   /**
@@ -56,12 +56,12 @@ public class CreateSaleOrderVo implements BaseVo, Serializable {
56 56
   @NotEmpty(message = "商品不能为空!")
57 57
   private List<SaleProductVo> products;
58 58
 
59
-  /**
60
-   * 支付方式
61
-   */
62
-  @ApiModelProperty("约定支付")
63
-  @Valid
64
-  private List<OrderPayTypeVo> payTypes;
59
+//  /**
60
+//   * 支付方式
61
+//   */
62
+//  @ApiModelProperty("约定支付")
63
+////  @Valid
64
+//  private List<OrderPayTypeVo> payTypes;
65 65
 
66 66
   /**
67 67
    * 备注
@@ -85,40 +85,40 @@ public class CreateSaleOrderVo implements BaseVo, Serializable {
85 85
       if (product.getOrderNum() <= 0) {
86 86
         throw new InputErrorException("第" + orderNo + "行商品销售数量必须大于0!");
87 87
       }
88
-
89
-      if (product.getOriPrice() == null) {
90
-        throw new InputErrorException("第" + orderNo + "行商品参考销售价不能为空!");
91
-      }
92
-
93
-      if (product.getTaxPrice() == null) {
94
-        throw new InputErrorException("第" + orderNo + "行商品价格不能为空!");
95
-      }
96
-
97
-      if (product.getTaxPrice().doubleValue() < 0D) {
98
-        throw new InputErrorException("第" + orderNo + "行商品价格不允许小于0!");
99
-      }
100
-
101
-      if (!NumberUtil.equal(product.getOriPrice(), 0D)) {
102
-        // 由 根据原价和折扣率校验现价 更改为 根据原价、现价计算折扣率,即:不以传入的折扣率为准
103
-        BigDecimal discountRate = NumberUtil.getNumber(
104
-            NumberUtil.mul(NumberUtil.div(product.getTaxPrice(), product.getOriPrice()), 100), 2);
105
-        product.setDiscountRate(discountRate);
106
-      } else {
107
-        //如果原价为0,折扣率固定为100
108
-        product.setDiscountRate(BigDecimal.valueOf(100));
109
-      }
88
+//
89
+//      if (product.getOriPrice() == null) {
90
+//        throw new InputErrorException("第" + orderNo + "行商品参考销售价不能为空!");
91
+//      }
92
+//
93
+//      if (product.getTaxPrice() == null) {
94
+//        throw new InputErrorException("第" + orderNo + "行商品价格不能为空!");
95
+//      }
96
+//
97
+//      if (product.getTaxPrice().doubleValue() < 0D) {
98
+//        throw new InputErrorException("第" + orderNo + "行商品价格不允许小于0!");
99
+//      }
100
+
101
+//      if (!NumberUtil.equal(product.getOriPrice(), 0D)) {
102
+//        // 由 根据原价和折扣率校验现价 更改为 根据原价、现价计算折扣率,即:不以传入的折扣率为准
103
+//        BigDecimal discountRate = NumberUtil.getNumber(
104
+//            NumberUtil.mul(NumberUtil.div(product.getTaxPrice(), product.getOriPrice()), 100), 2);
105
+//        product.setDiscountRate(discountRate);
106
+//      } else {
107
+//        //如果原价为0,折扣率固定为100
108
+//        product.setDiscountRate(BigDecimal.valueOf(100));
109
+//      }
110 110
 
111 111
       orderNo++;
112 112
     }
113 113
 
114
-    BigDecimal totalAmount = this.products.stream()
115
-        .map(t -> NumberUtil.mul(t.getOrderNum(), t.getTaxPrice())).reduce(NumberUtil::add)
116
-        .orElse(BigDecimal.ZERO);
117
-    BigDecimal payTypeAmount = CollectionUtil.isEmpty(this.payTypes) ? BigDecimal.ZERO
118
-        : this.payTypes.stream().map(OrderPayTypeVo::getPayAmount).reduce(NumberUtil::add)
119
-            .orElse(BigDecimal.ZERO);
120
-    if (!NumberUtil.equal(totalAmount, payTypeAmount)) {
121
-      throw new InputErrorException("所有支付方式的支付金额不等于含税总金额,请检查!");
122
-    }
114
+//    BigDecimal totalAmount = this.products.stream()
115
+//        .map(t -> NumberUtil.mul(t.getOrderNum(), t.getTaxPrice())).reduce(NumberUtil::add)
116
+//        .orElse(BigDecimal.ZERO);
117
+//    BigDecimal payTypeAmount = CollectionUtil.isEmpty(this.payTypes) ? BigDecimal.ZERO
118
+//        : this.payTypes.stream().map(OrderPayTypeVo::getPayAmount).reduce(NumberUtil::add)
119
+//            .orElse(BigDecimal.ZERO);
120
+//    if (!NumberUtil.equal(totalAmount, payTypeAmount)) {
121
+//      throw new InputErrorException("所有支付方式的支付金额不等于含税总金额,请检查!");
122
+//    }
123 123
   }
124 124
 }