haungfuli 3 年 前
コミット
ba805c23c5

+ 30 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/OrderInfoServiceImpl.java

@@ -771,6 +771,36 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
                     orderInfo1.setOrderStatusKey(StatusEnum.PLATFORM_REJECT_UNLOAD.getFlag());
                     orderInfo1.setCargoOwnerStatus(StatusEnum.PLATFORM_REJECT_UNLOAD.getName());
                     orderInfo1.setCargoOwnerStatusKey(StatusEnum.PLATFORM_REJECT_UNLOAD.getFlag());
+                    //非垫付订单
+                    if ("0".equals(orderInfo1.getFreightAdvance())) {
+                        //查询费用信息
+                        FreightInfo freightInfo = freightInfoService.selectOne(new EntityWrapper<FreightInfo>()
+                                .eq("order_id",orderInfo1.getId()).eq("delete_flag","0"));
+                        //尾款
+                        Double weikuan = freightInfo.getActualFreight() - freightInfo.getPrepaidFreight();
+                        //尾款+服务费
+                        Double zong = weikuan + freightInfo.getOwnerServiceCharge();
+                        if (orderInfo1.getCompId() != null && !orderInfo1.getCompId().isEmpty()) {
+                            //货主是公司
+                            HyCompanyInfo hyCompanyInfo = companyInfoService.selectById(orderInfo1.getCompId());
+                            //将货主冻结金额解冻
+                            Double d = hyCompanyInfo.getAccountBalance();
+                            Double d1 = hyCompanyInfo.getFrozenAmount();
+                            hyCompanyInfo.setAccountBalance(d+zong);
+                            hyCompanyInfo.setFrozenAmount(d1-zong);
+                            companyInfoService.updateById(hyCompanyInfo);
+                        } else {
+                            //货主是个人
+                            HyCargoOwnerInfo hyCargoOwnerInfo = cargoOwnerInfoService.selectOne(new EntityWrapper<HyCargoOwnerInfo>()
+                                    .eq("common_id", orderInfo1.getCargoCommonId()).eq("delete_flag", "0"));
+                            //将货主冻结金额解冻
+                            Double d = hyCargoOwnerInfo.getAccountBalance();
+                            Double d1 = hyCargoOwnerInfo.getFrozenAmount();
+                            hyCargoOwnerInfo.setAccountBalance(d+zong);
+                            hyCargoOwnerInfo.setFrozenAmount(d1-zong);
+                            cargoOwnerInfoService.updateById(hyCargoOwnerInfo);
+                        }
+                    }
                 }
             }
             this.updateById(orderInfo1);