| | |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | @Service |
| | |
| | | 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(" ")); |
| | | } |
| | | } |
| | | |
| | |
| | | //修改行程信息 |
| | | 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); |
| | | } |
| | | } |
| | | //添加消息 |
| | |
| | | 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); |
| | |
| | | |
| | | |
| | | @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){ |
| | |
| | | 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){ |
| | |
| | | //获取红包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()); |
| | |
| | | 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 |
| | |
| | | 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()); |