Pu Zhibing
2025-03-17 31929207a91ad4d215f11401b17446cf09eefd2c
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
@@ -59,6 +59,7 @@
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Service
@@ -788,9 +789,10 @@
    public ResultUtil addCancle(Integer id, String reason, String remark, Integer uid, Double lon, Double lat, String address, Integer language) throws Exception {
        if(ToolUtil.isNotEmpty(remark)){
            if(ToolUtil.isNotEmpty(remark)){
                remark = remark.toLowerCase();
                List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null);
                for(SensitiveWords s : sensitiveWords){
                    remark = remark.replaceAll(s.getContent(), "***");
                for(SensitiveWords s : sensitiveWords) {
                    remark = remark.replaceAll(s.getContent().toLowerCase(), "***");
                }
            }
        }
@@ -901,15 +903,21 @@
        
        //修改行程信息
        if(orderPrivateCar.getState() == 10 || orderPrivateCar.getState() == 12){
            boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", null, null, orderPrivateCar.getTripId(), null, null, null, null);
            Car car = carService.selectById(orderPrivateCar.getCarId());
            boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, orderPrivateCar.getTripId(), null, null, null, null);
            if(!updateTrip){
                for (int i = 0; i < 5; i++) {
                    updateTrip = fleetEngineUtil.updateTrip("CANCELED", null, null, orderPrivateCar.getTripId(), null, null, null, null);
                    updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, orderPrivateCar.getTripId(), null, null, null, null);
                    if(updateTrip){
                        orderPrivateCar.setIsover(1);
                        this.updateById(orderPrivateCar);
                        break;
                    }
                    Thread.sleep(3000L);
                }
            }else{
                orderPrivateCar.setIsover(1);
                this.updateById(orderPrivateCar);
            }
        }
        //添加消息
@@ -1015,11 +1023,7 @@
                    ChinaMobileUtil.midAxbUnBindSend(orderPrivateCar.getBindId(),orderPrivateCar.getTelX());
                }
    
                if(5 == orderPrivateCar.getOldState()){
                    orderPrivateCar.setState(6);
                }else{
                    orderPrivateCar.setState(10);
                }
                orderPrivateCar.setState(10);
                orderPrivateCar.setTelX("");
                orderPrivateCar.setBindId("");
                this.updateById(orderPrivateCar);
@@ -1257,7 +1261,7 @@
    @Override
    @Transactional
    @Transactional(rollbackFor = Exception.class)
    public ResultUtil payPrivateCarOrder(Integer payType, Integer bankCardId, Integer orderId, Integer couponId, Integer redDeduction, Integer type, Integer language) throws Exception {
        OrderPrivateCar orderPrivateCar = this.selectById(orderId);
        if(orderPrivateCar.getState() == 8 || orderPrivateCar.getState() == 9){
@@ -1322,10 +1326,9 @@
        if(null != redDeduction && 1 == redDeduction && null == orderPrivateCar.getRedPacketId()){
            RedEnvelopePaymentSettings redEnvelopePaymentSettings = redEnvelopePaymentSettingsService.getRedEnvelopePaymentSettings();
            if(null != redEnvelopePaymentSettings){
                Double total = userRedPacketRecordService.queryRemainingAmount(uid);
                List<UserRedPacketRecord> userRedPacketRecords = userRedPacketRecordService.selectList(new EntityWrapper<UserRedPacketRecord>().eq("userId", uid)
                        .eq("state", 1).eq("companyId", orderPrivateCar.getCompanyId()).gt("remainingAmount", 0).orderBy("insertTime", false));
                Double total = userRedPacketRecords.stream().mapToDouble(UserRedPacketRecord::getRemainingAmount).sum();
                BigDecimal deductionRatio = redEnvelopePaymentSettings.getDeductionRatio();
                BigDecimal multiply1 = orderMoney.multiply(deductionRatio.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_EVEN);
                if(total > 0 && multiply1.doubleValue() > 0 && total.compareTo(multiply1.doubleValue()) >= 0){
@@ -1335,12 +1338,10 @@
                    //获取红包id
                    JSONArray jsonArray = new JSONArray();
                    for (UserRedPacketRecord userRedPacketRecord : userRedPacketRecords) {
                        if(multiply1.compareTo(BigDecimal.ZERO) == 0){
                            break;
                        }
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("id", userRedPacketRecord.getId());
                        BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount());
                        if(multiply1.compareTo(remainingAmount) >= 0){
                            userRedPacketRecord.setRemainingAmount(0D);
                            userRedPacketRecord.setEndTime(new Date());
@@ -1353,14 +1354,14 @@
                            jsonObject.put("money", multiply1.setScale(2, RoundingMode.HALF_EVEN));
                            jsonArray.add(jsonObject);
                            multiply1 = BigDecimal.ZERO;
                            break;
                        }
                    }
                    if(userRedPacketRecords.size() > 0){
                        userRedPacketRecordService.updateBatchById(userRedPacketRecords);
                    }
                    orderPrivateCar.setRedPacketId(jsonArray.toJSONString());
                }
                if(total > 0 && total.compareTo(multiply1.doubleValue()) < 0){
                }else if(total > 0 && total.compareTo(multiply1.doubleValue()) < 0){
                    orderPrivateCar.setRedPacketMoney(total);
                    orderMoney = orderMoney.subtract(new BigDecimal(total)).setScale(2, RoundingMode.HALF_EVEN);
                    //获取红包id
@@ -2694,11 +2695,7 @@
        if(null != query){
            //添加交易明细
            transactionDetailsService.saveData(orderPrivateCar.getUserId(), "取消订单", query.getAmount(), 2, 1, 1, 1, query.getOrderId());
            if(5 == orderPrivateCar.getOldState()){
                orderPrivateCar.setState(6);
            }else{
                orderPrivateCar.setState(10);
            }
            orderPrivateCar.setState(10);
            //解除小号绑定
            if(orderPrivateCar.getBindId() != null){
                ChinaMobileUtil.midAxbUnBindSend(orderPrivateCar.getBindId(),orderPrivateCar.getTelX());