2 Commity 7bcc5ab874 ... 8e0b35e800

Autor SHA1 Wiadomość Data
  pangqijun 8e0b35e800 Merge remote-tracking branch 'origin/dev' into dev 3 miesięcy temu
  pangqijun 4ed02cd640 fix: 下单计算金额bug 3 miesięcy temu

+ 1 - 1
src/main/java/org/springblade/modules/api/controller/WxPayController.java

@@ -419,7 +419,7 @@ public class WxPayController extends BladeController {
                 .setOut_trade_no(orderNo)
                 .setTime_expire(timeExpire)
                 .setNotify_url(wxPayV3Bean.getDomain().concat(NOTIFY_URL))
-                .setAmount(new Amount().setTotal((int) (order.getPaymentAmount().doubleValue() * 100)));
+                .setAmount(new Amount().setTotal(order.getPaymentAmount().multiply(BigDecimal.valueOf(100)).intValue()));
         if (StrUtil.isNotBlank(openid)) {
             Payer payer = new Payer();
             payer.setOpenid(openid);

+ 38 - 38
src/main/java/org/springblade/modules/finance/service/impl/AfterSalesServiceImpl.java

@@ -127,51 +127,51 @@ public class AfterSalesServiceImpl extends ServiceImpl<AfterSalesMapper, AfterSa
 	@Transactional
 	@Override
 	public void submit(AfterSalesRequest request) {
-		Order order = orderService.getById(request.getOrderId());
-		Assert.notNull(order, "订单数据不存在");
+        Order order = orderService.getById(request.getOrderId());
+        Assert.notNull(order, "订单数据不存在");
 
-		order.setIsAftersales(YesOrNoEnum.YES.getValue());
-		orderService.updateById(order);
+        order.setIsAftersales(YesOrNoEnum.YES.getValue());
+        orderService.updateById(order);
 //		OrderGroupon orderGroupon = orderGrouponService.lambdaQuery().eq(OrderGroupon::getOrderId, request.getOrderId()).one();
 //		Assert.notNull(orderGroupon, "orderGroupon数据不存在");
 //		Groupon groupon = grouponService.getById(orderGroupon.getGrouponId());
 //		Assert.notNull(orderGroupon, "groupon数据不存在");
 
-		int afterSalesDays = Integer.parseInt(ParamCache.getValueDefault(CacheBizConstant.ORDER_AFTER_SALES_DAYS, "3"));
-		// 校验是否能申请售后
-		Calendar calendar = Calendar.getInstance();
-		calendar.setTime(order.getCreateTime());
-		calendar.add(Calendar.DAY_OF_MONTH,afterSalesDays);
-		Date time = calendar.getTime();
+        int afterSalesDays = Integer.parseInt(ParamCache.getValueDefault(CacheBizConstant.ORDER_AFTER_SALES_DAYS, "3"));
+        // 校验是否能申请售后
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(order.getCreateTime());
+        calendar.add(Calendar.DAY_OF_MONTH,afterSalesDays);
+        Date time = calendar.getTime();
 //		LocalDateTime time = groupon.getTakeStartTime().plusDays(afterSalesDays);
-		if (time.compareTo(new Date()) <= 0) {
-			throw new ServiceException("已过售后期");
-		}
-
-		// 校验商品是否已经申请过售后
-		List<Long> goodsIds = request.getAfterGoodsList().stream().map(OrderGoods::getGoodsId).collect(Collectors.toList());
-		List<OrderGoods> list = orderGoodsService.lambdaQuery()
-				.eq(OrderGoods::getOrderId,request.getOrderId())
-				.in(OrderGoods::getGoodsId, goodsIds).list();
-		for (OrderGoods orderGoods : list) {
-			if (YesOrNoEnum.YES.getValue().equals(orderGoods.getIsAfterSales())) {
-				throw new ServiceException("商品【"+orderGoods.getGoodsName()+"】已申请过售后");
-			}
-			orderGoods.setIsAfterSales(YesOrNoEnum.YES.getValue());
-		}
-		// 更新售后状态
-		orderGoodsService.updateBatchById(list);
-		AfterSales afterSales = init();
-		afterSales.setOrderId(request.getOrderId());
-		afterSales.setType(request.getAfterSalesType());
-		afterSales.setReason(request.getReason());
-		afterSales.setReasonId(request.getReasonId());
-		afterSales.setAfterSaleDescribe(request.getAfterSaleDescribe());
-		afterSales.setImgListStr(JSON.toJSONString(request.getImages()));
-		afterSales.setIsArrived(YesOrNoEnum.NO.getValue());
-		afterSales.setUserId(AuthUtil.getUserId());
-		afterSales.setReturnGoodsNum(request.getAfterGoodsList().get(0).getRefundGoodsNum());
-		this.save(afterSales);
+        if (time.compareTo(new Date()) <= 0) {
+            throw new ServiceException("已过售后期");
+        }
+
+        // 校验商品是否已经申请过售后
+        List<Long> goodsIds = request.getAfterGoodsList().stream().map(OrderGoods::getGoodsId).collect(Collectors.toList());
+        List<OrderGoods> list = orderGoodsService.lambdaQuery()
+                .eq(OrderGoods::getOrderId,request.getOrderId())
+                .in(OrderGoods::getGoodsId, goodsIds).list();
+        for (OrderGoods orderGoods : list) {
+            if (YesOrNoEnum.YES.getValue().equals(orderGoods.getIsAfterSales())) {
+                throw new ServiceException("商品【"+orderGoods.getGoodsName()+"】已申请过售后");
+            }
+            orderGoods.setIsAfterSales(YesOrNoEnum.YES.getValue());
+        }
+        // 更新售后状态
+        orderGoodsService.updateBatchById(list);
+        AfterSales afterSales = init();
+        afterSales.setOrderId(request.getOrderId());
+        afterSales.setType(request.getAfterSalesType());
+        afterSales.setReason(request.getReason());
+        afterSales.setReasonId(request.getReasonId());
+        afterSales.setAfterSaleDescribe(request.getAfterSaleDescribe());
+        afterSales.setImgListStr(JSON.toJSONString(request.getImages()));
+        afterSales.setIsArrived(YesOrNoEnum.NO.getValue());
+        afterSales.setUserId(AuthUtil.getUserId());
+        afterSales.setReturnGoodsNum(request.getAfterGoodsList().get(0).getRefundGoodsNum());
+        this.save(afterSales);
 	}
 
 	@Override