jiaosong
2023-10-25 b4e33810cb2f425db6065bf04b615b1a1a584e27
server/services/src/main/java/com/doumee/service/business/impl/GoodsorderServiceImpl.java
@@ -395,6 +395,8 @@
    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
    @Override
    public void closeGoodsorder( Goodsorder goodsorder ,int type ) {
//
        List<MemberRides> memberRides = getMemberRidesForClose(goodsorder.getId());
        //默认结算为押金金额
        BigDecimal closeMoney = new BigDecimal(0.00);
@@ -425,6 +427,8 @@
        if(Constants.REFUND_TYPE.PLAT_FORCE.getKey() == type){
            //如果是强制结算
            update.setCloseType(Constants.ONE);
            LoginUserInfo principal = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
            update.setEditor(principal.getId());
        }else  if(Constants.REFUND_TYPE.NORMAL.getKey() == type){
            //如果是自行結算
            update.setCloseType(Constants.ZERO);
@@ -442,6 +446,7 @@
            refundDTO.setTotalAmount(goodsorder.getMoney());
            refundDTO.setMemberId(goodsorder.getMemberId());
            refundDTO.setReason(Constants.REFUND_TYPE.get(type).getName());
            refundDTO.setCreator(update.getEditor());
            refundDTO.setType(type);
            Refund refund = wxMiniUtilService.wxRefund(refundDTO);
            update.setCloseId(refund.getId());
@@ -530,7 +535,7 @@
        BigDecimal refundMoney = total == null?new BigDecimal(0):Constants.formatDecimalNum(total.getMoney());
        //可退剩余 单位元
        BigDecimal canBalance =Constants.translateMoney(Constants.formatDecimalNum(goodsorder.getMoney()).subtract(refundMoney));
        if(canBalance.compareTo(money) > Constants.ZERO){
        if(canBalance.compareTo(money) >= Constants.ZERO){
            RefundDTO refundDTO = new RefundDTO();
            refundDTO.setOrderId(orderId);
            refundDTO.setCanBalance(canBalance);
@@ -566,7 +571,7 @@
        BigDecimal reduce =  total!=null?Constants.formatDecimalNum(total.getMoney()):new BigDecimal(0);
        goodsorderCanBanlanceDTO.setHasRefundMoney(Constants.translateMoney(reduce));
        BigDecimal subtract = Constants.translateMoney(goodsorder.getMoney()).subtract(goodsorderCanBanlanceDTO.getCloseMoney()).subtract(goodsorderCanBanlanceDTO.getHasRefundMoney());
        BigDecimal subtract = Constants.translateMoney(goodsorder.getMoney()).subtract(goodsorderCanBanlanceDTO.getHasRefundMoney());
        goodsorderCanBanlanceDTO.setCanBanlanceMoney(subtract.compareTo(new BigDecimal("0")) > 0 ? subtract : new BigDecimal("0"));
        return goodsorderCanBanlanceDTO;
    }
@@ -597,17 +602,17 @@
                if(Constants.formatIntegerNum(goodsorder.getStatus()) == Constants.GOODSORDER_STATUS.CLOSE.getKey()){
                    //已结算
                    model.setClosedNum(model.getClosedNum()+goodsorder.getCountNum());
                    model.setClosedMoney(Constants.translateMoney(model.getClosedMoney().add(Constants.formatDecimalNum(goodsorder.getCloseMoney()))));
                    model.setClosedMoney(model.getClosedMoney().add(Constants.translateMoney(goodsorder.getCloseMoney())));
                    model.setPayNum(model.getPayNum()+goodsorder.getCountNum());
                    model.setPayMoney(Constants.translateMoney(model.getPayMoney().add(Constants.formatDecimalNum(goodsorder.getMoney()))));
                    model.setPayMoney(model.getPayMoney().add(Constants.translateMoney(goodsorder.getMoney())));
                }else  if(Constants.formatIntegerNum(goodsorder.getStatus()) == Constants.GOODSORDER_STATUS.HAVING_PAY.getKey()){
                    //已支付未结算
                    model.setUnClosedNum(model.getUnClosedNum()+goodsorder.getCountNum());
                    model.setUnClosedMoney(Constants.translateMoney(model.getUnClosedMoney().add(Constants.formatDecimalNum(goodsorder.getMoney()))));
                    model.setUnClosedMoney(model.getUnClosedMoney().add(Constants.translateMoney(goodsorder.getMoney())));
                    model.setPayNum(model.getPayNum()+goodsorder.getCountNum());
                    model.setPayMoney(Constants.translateMoney(model.getPayMoney().add(Constants.formatDecimalNum(goodsorder.getMoney()))));
                    model.setPayMoney(model.getPayMoney().add(Constants.translateMoney(goodsorder.getMoney())));
                }
            }
        QueryWrapper<Refund> queryWrapper2 = new QueryWrapper<>();