| | |
| | | import com.stylefeng.guns.core.util.ExcelExportUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.controller.util.PushUtil; |
| | | import com.stylefeng.guns.modular.system.controller.util.TextToSpeechUtil; |
| | | import com.stylefeng.guns.modular.system.dao.OrderCancelMapper; |
| | | import com.stylefeng.guns.modular.system.dao.TSystemPriceMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | |
| | | orderPrivateCar = this.setMoney(orderPrivateCar, 0D, 0D);//计算费用 |
| | | //添加已收入明细 |
| | | TCompany company = companyService.selectById(orderPrivateCar.getCompanyId()); |
| | | TDriver tDriver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | Double taxi = company.getSpeMoney().doubleValue(); |
| | | BigDecimal d = null;//企业收入 |
| | | BigDecimal c = null;//司机收入 |
| | |
| | | driver.setFrozenMoney(driver.getFrozenMoney().add(c)); |
| | | driverService.updateById(driver); |
| | | }else{ |
| | | |
| | | TDriver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | driver.setFrozenMoney(driver.getFrozenMoney().subtract(c)); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | // if (orderPrivateCar.getIsFrozen() == 1){ |
| | | // // 冻结订单需要给司机播报一个语音内容 |
| | | // Integer language1 = tDriver.getLanguage(); |
| | | // String text = ""; |
| | | // switch (language1){ |
| | | // case 1: |
| | | // text = "" ; |
| | | // break; |
| | | // case 2: |
| | | // text = ""; |
| | | // break; |
| | | // case 3: |
| | | // text = ""; |
| | | // break; |
| | | // } |
| | | // TOrderPrivateCar finalOrderPrivateCar = orderPrivateCar; |
| | | // String audioUrl = ""; |
| | | // try { |
| | | // audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, "pushOrder" + orderPrivateCar.getDriverId() + ".mp3"); |
| | | // } catch (Exception e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // //定时任务删除语音文件 |
| | | // new Timer().schedule(new TimerTask() { |
| | | // @Override |
| | | // public void run() { |
| | | // Process process = null; |
| | | // try { |
| | | // process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/pushOrder" + finalOrderPrivateCar.getDriverId() + ".mp3"); |
| | | // } catch (IOException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // if (process != null) { |
| | | // process.destroy(); |
| | | // } |
| | | // } |
| | | // }, 30000); |
| | | // |
| | | // String finalAudioUrl = audioUrl; |
| | | // |
| | | // new Thread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // pushUtil.pushOrderState(2, finalOrderPrivateCar.getDriverId(), finalOrderPrivateCar.getId(), 1, 2, 0, finalAudioUrl); |
| | | // } |
| | | // }).start(); |
| | | // } |
| | | orderPrivateCar.setIsFrozen(orderPrivateCar.getIsFrozen()==1?2:1); |
| | | orderPrivateCar.setState(7); |
| | | tOrderPrivateCarService.updateAllColumnById(orderPrivateCar); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | @Resource |
| | | private TSystemPriceMapper systemPriceMapper; |
| | | public TOrderPrivateCar setMoney(TOrderPrivateCar orderPrivateCar, Double parkingFee, Double crossingFee) throws Exception { |