Pu Zhibing
2025-03-12 b701b92c8af86026b2536c65ec9161037e88a8d9
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
@@ -789,9 +790,20 @@
        if(ToolUtil.isNotEmpty(remark)){
            if(ToolUtil.isNotEmpty(remark)){
                List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null);
                List<String> list = Arrays.asList(remark.split(" "));
                for(SensitiveWords s : sensitiveWords){
                    remark = remark.replaceAll(s.getContent(), "***");
                    List<String> str = new ArrayList<>();
                    String lowerCase = s.getContent().toLowerCase();
                    for (String s1 : list) {
                        if(lowerCase.equals(s1.toLowerCase())){
                            str.add("***");
                        }else{
                            str.add(s1);
                        }
                    }
                    list = str;
                }
                remark = list.stream().collect(Collectors.joining(" "));
            }
        }
@@ -902,15 +914,20 @@
        //修改行程信息
        if(orderPrivateCar.getState() == 10 || orderPrivateCar.getState() == 12){
            Car car = carService.selectById(orderPrivateCar.getCarId());
            boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", car.getVehicleId(), null, orderPrivateCar.getTripId(), null, null, null, null);
            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", car.getVehicleId(), 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);
            }
        }
        //添加消息
@@ -1016,11 +1033,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);
@@ -1258,7 +1271,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){
@@ -1323,10 +1336,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){
@@ -1336,12 +1348,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());
@@ -1354,14 +1364,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
@@ -2695,11 +2705,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());