| | |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @Transactional(isolation = Isolation.READ_UNCOMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
| | |
| | | public synchronized ResultUtil<BaseWarpper> taxiOrder(OrderTaxi orderTaxi, Integer uid) throws Exception { |
| | | //定义用户所属公司 |
| | | UserInfo userInfo1 = userInfoService.selectById(uid); |
| | | Company query = companyCityService.query1(String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat())); |
| | | Company query = companyCityService.query1(orderTaxi.getUserId(), String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat())); |
| | | if(null == query){ |
| | | return ResultUtil.error("出发点暂未开通"); |
| | | } |
| | |
| | | //调用移动的小号接口 |
| | | Map<String, String> geocode1 = gdMapGeocodingUtil.geocode(orderTaxi.getStartLon().toString(), orderTaxi.getStartLat().toString()); |
| | | Region region = regionMapper.query(geocode1.get("districtCode")); |
| | | Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderTaxi.getPassengersPhone(), driver.getPhone(), Integer.valueOf(region.getCitycode().substring(1))); |
| | | if(String.valueOf(map.get("code")).equals("200")){ |
| | | orderTaxi.setTelX(map.get("telX")); |
| | | orderTaxi.setBindId(map.get("bindId")); |
| | | } |
| | | // Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderTaxi.getPassengersPhone(), driver.getPhone(), Integer.valueOf(region.getCitycode().substring(1))); |
| | | // if(String.valueOf(map.get("code")).equals("200")){ |
| | | // orderTaxi.setTelX(map.get("telX")); |
| | | // orderTaxi.setBindId(map.get("bindId")); |
| | | // } |
| | | |
| | | driver.setState(3); |
| | | driverService.updateById(driver); |
| | |
| | | public void run() { |
| | | if(orderTaxi.getState() == 2){ |
| | | //推送司机订单状态 |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0, "", "user"); |
| | | |
| | | pushUtil.pushDriverPosition(orderTaxi.getId(), 2); |
| | | } |
| | | } |
| | | }).start(); |
| | |
| | | return ResultUtil.error("获取数据失败,订单信息有误"); |
| | | } |
| | | double amount = 0; |
| | | CancleOrder query = cancleOrderService.query(orderTaxi.getOrderType(), 2, orderTaxi.getCompanyId()); |
| | | if(null != orderTaxi.getDriverId() && |
| | | (orderTaxi.getSnatchOrderTime().getTime() + query.getMinuteNum() * 60 * 1000) < new Date().getTime()){//收费的情况 |
| | | if(null != query){ |
| | | amount += query.getMoney(); |
| | | } |
| | | } |
| | | // CancleOrder query = cancleOrderService.query(orderTaxi.getOrderType(), 2, orderTaxi.getCompanyId()); |
| | | // if(null != orderTaxi.getDriverId() && |
| | | // (orderTaxi.getSnatchOrderTime().getTime() + query.getMinuteNum() * 60 * 1000) < new Date().getTime()){//收费的情况 |
| | | // if(null != query){ |
| | | // amount += query.getMoney(); |
| | | // } |
| | | // } |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setAmount(amount); |
| | | return ResultUtil.success(baseWarpper); |
| | |
| | | public ResultUtil addCancle(Integer id, String reason, String remark, Integer uid) 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(), "***"); |
| | | } |
| | | } |
| | | } |
| | |
| | | if(null == orderTaxi){ |
| | | return ResultUtil.error("取消订单失败,订单信息有误"); |
| | | } |
| | | if(orderTaxi.getState() > 5 && orderTaxi.getState() != 11){ |
| | | if(orderTaxi.getState() > 5 && orderTaxi.getState() != 12){ |
| | | return ResultUtil.error("取消订单失败,不合法的操作"); |
| | | } |
| | | if(null == orderTaxi.getDriverId()){//没有接单的情况 |
| | |
| | | this.updateById(orderTaxi); |
| | | } |
| | | }else { |
| | | CancleOrder query = cancleOrderService.query(orderTaxi.getOrderType(), 2, orderTaxi.getCompanyId()); |
| | | if (null != query) { |
| | | if ((orderTaxi.getSnatchOrderTime().getTime() + query.getMinuteNum() * 60 * 1000) < System.currentTimeMillis() && query.getMoney().compareTo(0D) > 0) {//收费的情况 |
| | | orderTaxi.setState(12); |
| | | this.updateById(orderTaxi); |
| | | integer = orderCancelService.saveData(id, 2, reason, remark, null, query.getMoney(), 1, 1, uid); |
| | | } else { |
| | | integer = orderCancelService.saveData(id, 2, reason, remark, null, null, 2, 1, uid); |
| | | |
| | | orderTaxi.setState(10); |
| | | this.updateById(orderTaxi); |
| | | } |
| | | this.deleteTask(id);//删除定时任务 |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | System.err.println("推送取消操作---------------------"); |
| | | } |
| | | }).start(); |
| | | |
| | | //修改司机为空闲 |
| | | Driver driver = driverService.selectById(orderTaxi.getDriverId()); |
| | | driver.setState(2); |
| | | driverService.updateById(driver); |
| | | }else{ |
| | | return ResultUtil.error("请完善后台取消规则设置"); |
| | | } |
| | | // CancleOrder query = cancleOrderService.query(orderTaxi.getOrderType(), 2, orderTaxi.getCompanyId()); |
| | | // if (null != query) { |
| | | // if ((orderTaxi.getSnatchOrderTime().getTime() + query.getMinuteNum() * 60 * 1000) < System.currentTimeMillis() && query.getMoney().compareTo(0D) > 0) {//收费的情况 |
| | | // orderTaxi.setState(12); |
| | | // this.updateById(orderTaxi); |
| | | // integer = orderCancelService.saveData(id, 2, reason, remark, null, query.getMoney(), 1, 1, uid); |
| | | // } else { |
| | | // integer = orderCancelService.saveData(id, 2, reason, remark, null, null, 2, 1, uid); |
| | | // |
| | | // orderTaxi.setState(10); |
| | | // this.updateById(orderTaxi); |
| | | // } |
| | | // this.deleteTask(id);//删除定时任务 |
| | | // |
| | | // new Thread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | // System.err.println("推送取消操作---------------------"); |
| | | // } |
| | | // }).start(); |
| | | // |
| | | // //修改司机为空闲 |
| | | // Driver driver = driverService.selectById(orderTaxi.getDriverId()); |
| | | // driver.setState(2); |
| | | // driverService.updateById(driver); |
| | | // }else{ |
| | | // return ResultUtil.error("请完善后台取消规则设置"); |
| | | // } |
| | | |
| | | } |
| | | |
| | |
| | | ResultUtil resultUtil = ResultUtil.success(""); |
| | | |
| | | if(null == orderTaxi){ |
| | | return ResultUtil.error((language == 1 ? "订单信息有误" : language == 2 ? "Incorrect order information" : "Informations de commande incorrectes"), ""); |
| | | return ResultUtil.error((language == 1 ? "订单信息有误" : language == 2 ? "Order-information error" : "Erreur d’information de commande"), ""); |
| | | } |
| | | if(orderTaxi.getState() != 12){ |
| | | return ResultUtil.error((language == 1 ? "订单取消失败" : language == 2 ? "Order cancellation failure" : "Annulation de commande échouée"), ""); |
| | | return ResultUtil.error((language == 1 ? "订单取消失败" : language == 2 ? "Failed to cancel order" : "Échec de l’annulation de la commande"), ""); |
| | | } |
| | | OrderCancel orderCancel = null; |
| | | if(null == cancleId){ |
| | |
| | | orderCancel = orderCancelService.selectById(cancleId); |
| | | } |
| | | |
| | | CancleOrder query = cancleOrderService.query(orderTaxi.getOrderType(), 2, orderTaxi.getCompanyId()); |
| | | if(null != query){ |
| | | if(payType == 1){//微信支付 |
| | | orderCancel.setPayType(1); |
| | | orderCancelService.updateById(orderCancel); |
| | | resultUtil = payMoneyUtil.weixinpay("订单取消",id +"",id + "_2_fei",query.getMoney()+"","/base/wxCancelOrderTaxi","JSAPI",userInfo.getAppletsOpenId()); |
| | | } |
| | | if(payType == 2){//支付宝支付 |
| | | orderCancel.setPayType(2); |
| | | orderCancelService.updateById(orderCancel); |
| | | resultUtil = payMoneyUtil.alipay("订单取消","订单取消",id + ",2",query.getMoney()+"","/base/aliCancelOrderTaxi"); |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){ |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde de compte insuffisant"); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "取消订单", query.getMoney(), 2, 1, 1, 2, id); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | //解除小号绑定 |
| | | if(orderTaxi.getBindId() != null){ |
| | | chinaMobileUtil.midAxbUnBindSend(orderTaxi.getBindId(),orderTaxi.getTelX()); |
| | | } |
| | | |
| | | orderTaxi.setState(10); |
| | | orderTaxi.setTelX(""); |
| | | orderTaxi.setBindId(""); |
| | | this.updateById(orderTaxi); |
| | | |
| | | orderCancel.setState(2); |
| | | orderCancel.setPayType(3); |
| | | orderCancelService.updateById(orderCancel); |
| | | |
| | | //添加已收入明细 |
| | | incomeService.saveData(1, orderTaxi.getCompanyId(), 3, orderTaxi.getId(), 2, query.getMoney()); |
| | | |
| | | this.deleteTask(id);//删除定时任务 |
| | | |
| | | // new Thread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | // } |
| | | // }).start(); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, "您已使用余额成功支付取消订单费用,谢谢使用!", orderTaxi.getUserId(), 1); |
| | | } |
| | | } |
| | | // CancleOrder query = cancleOrderService.query(orderTaxi.getOrderType(), 2, orderTaxi.getCompanyId()); |
| | | // if(null != query){ |
| | | // if(payType == 1){//微信支付 |
| | | // orderCancel.setPayType(1); |
| | | // orderCancelService.updateById(orderCancel); |
| | | // resultUtil = payMoneyUtil.weixinpay("订单取消",id +"",id + "_2_fei",query.getMoney()+"","/base/wxCancelOrderTaxi","JSAPI",userInfo.getAppletsOpenId()); |
| | | // } |
| | | // if(payType == 2){//支付宝支付 |
| | | // orderCancel.setPayType(2); |
| | | // orderCancelService.updateById(orderCancel); |
| | | // resultUtil = payMoneyUtil.alipay("订单取消","订单取消",id + ",2",query.getMoney()+"","/base/aliCancelOrderTaxi"); |
| | | // } |
| | | // if(payType == 3){//余额支付 |
| | | // if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){ |
| | | // return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient balance" : "Solde insuffisant"); |
| | | // } |
| | | // |
| | | // userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // //添加交易明细 |
| | | // transactionDetailsService.saveData(uid, "取消订单", query.getMoney(), 2, 1, 1, 2, id); |
| | | // userInfoService.updateById(userInfo); |
| | | // |
| | | // //解除小号绑定 |
| | | // if(orderTaxi.getBindId() != null){ |
| | | // chinaMobileUtil.midAxbUnBindSend(orderTaxi.getBindId(),orderTaxi.getTelX()); |
| | | // } |
| | | // |
| | | // orderTaxi.setState(10); |
| | | // orderTaxi.setTelX(""); |
| | | // orderTaxi.setBindId(""); |
| | | // this.updateById(orderTaxi); |
| | | // |
| | | // orderCancel.setState(2); |
| | | // orderCancel.setPayType(3); |
| | | // orderCancelService.updateById(orderCancel); |
| | | // |
| | | // //添加已收入明细 |
| | | // incomeService.saveData(1, orderTaxi.getCompanyId(), 3, orderTaxi.getId(), 2, query.getMoney()); |
| | | // |
| | | // this.deleteTask(id);//删除定时任务 |
| | | // |
| | | //// new Thread(new Runnable() { |
| | | //// @Override |
| | | //// public void run() { |
| | | //// pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | //// } |
| | | //// }).start(); |
| | | // |
| | | // //添加消息 |
| | | // systemNoticeService.addSystemNotice(1, "您已使用余额成功支付取消订单费用,谢谢使用!", orderTaxi.getUserId(), 1); |
| | | // } |
| | | // } |
| | | return resultUtil; |
| | | } |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryCoupon(Integer orderId, Integer uid, Integer pageNum, Integer size) throws Exception { |
| | | public List<Map<String, Object>> queryCoupon(Integer language, Integer orderId, Integer uid, Integer pageNum, Integer size) throws Exception { |
| | | OrderTaxi orderTaxi = this.selectById(orderId); |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon(uid, orderTaxi.getCompanyId(), 1, 2, orderTaxi.getOrderMoney(), pageNum, size); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(uid, orderTaxi.getCompanyId(), 1, 0, orderTaxi.getOrderMoney(), pageNum, size); |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon(language, uid, orderTaxi.getCompanyId(), 1, 2, orderTaxi.getOrderMoney(), pageNum, size); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(language, uid, orderTaxi.getCompanyId(), 1, 0, orderTaxi.getOrderMoney(), pageNum, size); |
| | | list.addAll(list1); |
| | | return list; |
| | | } |
| | |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){ |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde de compte insuffisant"); |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient balance" : "Solde insuffisant"); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0, "", "user"); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0, "", "user"); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0, "", "user"); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0, "", "user"); |
| | | } |
| | | }).start(); |
| | | return ResultUtil.success(); |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryMyOrderList(Integer uid, Integer pageNum, Integer size) throws Exception { |
| | | public List<Map<String, Object>> queryMyOrderList(Integer language, Integer uid, Integer pageNum, Integer size) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> maps = orderTaxiMapper.queryMyOrderList(uid, pageNum, size); |
| | | for(Map<String, Object> map : maps){ |
| | | if(Integer.valueOf(String.valueOf(map.get("state"))) == 11){ |
| | | map.put("state", map.get("oldState")); |
| | | } |
| | | if(null != map.get("orderTime")){ |
| | | String orderTime = map.get("orderTime").toString(); |
| | | map.put("orderTime", DateUtil.conversionFormat(language, orderTime)); |
| | | } |
| | | if(null != map.get("time")){ |
| | | String time = map.get("time").toString(); |
| | | map.put("time", DateUtil.conversionFormat1(language, time)); |
| | | } |
| | | } |
| | | return maps; |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryMyTravelRecord(Integer uid) throws Exception { |
| | | return orderTaxiMapper.queryMyTravelRecord(uid); |
| | | public List<Map<String, Object>> queryMyTravelRecord(Integer language, Integer uid) throws Exception { |
| | | List<Map<String, Object>> list = orderTaxiMapper.queryMyTravelRecord(uid); |
| | | for (Map<String, Object> map : list) { |
| | | if(null != map.get("time")){ |
| | | String time = map.get("time").toString(); |
| | | map.put("time", DateUtil.conversionFormat(language, time)); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryRedEnvelope(Integer uid) throws Exception { |
| | | return orderTaxiMapper.queryRedEnvelope(uid); |
| | | public List<Map<String, Object>> queryRedEnvelope(Integer language, Integer uid) throws Exception { |
| | | List<Map<String, Object>> list = orderTaxiMapper.queryRedEnvelope(uid); |
| | | for (Map<String, Object> map : list) { |
| | | if(null != map.get("time")){ |
| | | String time = map.get("time").toString(); |
| | | map.put("time", DateUtil.conversionFormat(language, time)); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryInvoiceOrder(Integer type, Date startTime, Date endTime, Double startMoney, |
| | | public List<Map<String, Object>> queryInvoiceOrder(Integer language, Integer type, Date startTime, Date endTime, Double startMoney, |
| | | Double endMoney, Integer uid) throws Exception { |
| | | startTime = dateUtil.getStartOrEndDate(startTime, "start"); |
| | | endTime = dateUtil.getStartOrEndDate(endTime, "end"); |
| | | return orderTaxiMapper.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | List<Map<String, Object>> list = orderTaxiMapper.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | for (Map<String, Object> map : list) { |
| | | if(null != map.get("time")){ |
| | | String time = map.get("time").toString(); |
| | | map.put("time", DateUtil.conversionFormat(language, time)); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> queryOrderInfo(Integer orderId) throws Exception{ |
| | | public Map<String, Object> queryOrderInfo(Integer language, Integer orderId) throws Exception{ |
| | | Map<String, Object> map = orderTaxiMapper.queryOrderInfo(orderId); |
| | | if(null != map && null != map.get("reassignNotice") && Integer.valueOf(String.valueOf(map.get("reassignNotice"))) == 2){//改派完成,重新获取了新的司机数据,开始修改数据防止继续调用 |
| | | OrderTaxi orderTaxi = this.selectById(orderId); |
| | |
| | | String driverId = redisUtil.getValue("DEVICE_" + map.get("driverId")); |
| | | map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1); |
| | | map.put("orderType", 2); |
| | | |
| | | if(null != map.get("insertTime")){ |
| | | String insertTime = map.get("insertTime").toString(); |
| | | map.put("insertTime", DateUtil.conversionFormat(language, insertTime)); |
| | | } |
| | | if(null != map.get("travelTime")){ |
| | | String travelTime = map.get("travelTime").toString(); |
| | | map.put("travelTime", DateUtil.conversionFormat1(language, travelTime)); |
| | | } |
| | | if(null != map.get("arriveTime")){ |
| | | String arriveTime = map.get("arriveTime").toString(); |
| | | map.put("arriveTime", DateUtil.conversionFormat(language, arriveTime)); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | |
| | | }else{//随机金额 |
| | | Double startMoney = Double.valueOf(String.valueOf(query.get("startMoney"))); |
| | | Double endMoney = Double.valueOf(String.valueOf(query.get("endMoney"))); |
| | | int i = new BigDecimal(endMoney).subtract(new BigDecimal(startMoney)).intValue(); |
| | | Random random = new Random(); |
| | | int num = random.nextInt(i); |
| | | money = new BigDecimal(startMoney).add(new BigDecimal(num)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | money = new BigDecimal(startMoney + (Math.random() * (endMoney - startMoney))).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | } |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | |
| | | //添加临时红包数据 |
| | | UserRedPacketRecord userRedPacketRecord = new UserRedPacketRecord(); |
| | | userRedPacketRecord.setMoney(money); |
| | | userRedPacketRecord.setRemainingAmount(money); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date()); |
| | | calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) + Integer.valueOf(String.valueOf(query.get("effective")))); |
| | | userRedPacketRecord.setExpirationTime(calendar.getTime()); |
| | | userRedPacketRecord.setInsertTime(new Date()); |
| | | userRedPacketRecord.setCompanyId(Integer.valueOf(String.valueOf(query.get("companyId")))); |
| | | userRedPacketRecord.setState(0); |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0, "", "user"); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0, "", "user"); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | | } |
| | | Company query = companyCityService.query1(String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat()));//获取起点所属分公司 |
| | | Company query = companyCityService.query1(orderTaxi.getUserId(), String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat()));//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 2, query.getId());//获取需要推送的次数 |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | PushOrder pushOrder = pushOrderService.querys(i, 2, query.getId()).get(0); |
| | |
| | | if(bo){ |
| | | continue; |
| | | } |
| | | pushUtil.pushOrderState(2, driver.getId(), orderTaxi.getId(), 2, orderTaxi.getState(), pushOrder.getPushTime()); |
| | | pushUtil.pushOrderState(2, driver.getId(), orderTaxi.getId(), 2, orderTaxi.getState(), pushOrder.getPushTime(), "", "user"); |
| | | } |
| | | } |
| | | Thread.sleep(pushOrder.getPushTime() * 1000);//设置等待时间 |