| | |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogisticsSpread; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsSpreadService; |
| | | import com.stylefeng.guns.modular.system.dao.CarMapper; |
| | | import com.stylefeng.guns.modular.system.dao.RegionMapper; |
| | | import com.stylefeng.guns.modular.system.model.Company; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.Region; |
| | | import com.stylefeng.guns.modular.system.service.ICompanyService; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.service.IIncomeService; |
| | | import com.stylefeng.guns.modular.system.service.ISystemNoticeService; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Autowired |
| | | private ALiSendSms aLiSendSms; |
| | | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | @Autowired |
| | | private CarMapper carMapper; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | this.updateById(orderLogistics); |
| | | |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(driver.getCompanyId()); |
| | | Double speMoney = orderLogistics.getType() == 4 ? company.getSameLogisticsMoney() : company.getCrossLogisticsMoney(); |
| | | BigDecimal d = null;//企业收入 |
| | | BigDecimal c = null;//司机收入 |
| | | if(company.getIsSpeFixedOrProportional() == 2){//固定 |
| | | d = new BigDecimal(speMoney); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d);//只有出行金额参与抽成,其余归属司机 |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | Double price = orderLogistics.getTravelMoney(); |
| | | d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | incomeService.saveData(1, orderLogistics.getCompanyId(), 2, orderLogistics.getId(), orderLogistics.getType(), d.doubleValue()); |
| | | incomeService.saveData(2, orderLogistics.getDriverId(), 2, orderLogistics.getId(), orderLogistics.getType(), c.doubleValue()); |
| | | 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.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | // //添加已收入明细 |
| | | // Company company = companyService.selectById(driver.getCompanyId()); |
| | | // Double speMoney = orderLogistics.getType() == 4 ? company.getSameLogisticsMoney() : company.getCrossLogisticsMoney(); |
| | | // BigDecimal d = null;//企业收入 |
| | | // BigDecimal c = null;//司机收入 |
| | | // if(company.getIsSpeFixedOrProportional() == 2){//固定 |
| | | // d = new BigDecimal(speMoney); |
| | | // c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d);//只有出行金额参与抽成,其余归属司机 |
| | | // } |
| | | // if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | // Double price = orderLogistics.getTravelMoney(); |
| | | // d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | // c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | // } |
| | | // incomeService.saveData(1, orderLogistics.getCompanyId(), 2, orderLogistics.getId(), orderLogistics.getType(), d.doubleValue()); |
| | | // incomeService.saveData(2, orderLogistics.getDriverId(), 2, orderLogistics.getId(), orderLogistics.getType(), c.doubleValue()); |
| | | // 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.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // driverService.updateById(driver); |
| | | |
| | | |
| | | |
| | |
| | | orderLogistics.setGetoffTime(new Date()); |
| | | orderLogistics.setEndServiceTime(new Date()); |
| | | orderLogistics.setState(6); |
| | | |
| | | |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderLogistics.getCompanyId()); |
| | | Double speMoney = orderLogistics.getType() == 4 ? company.getSameLogisticsMoney() : company.getSameLogisticsMoney(); |
| | | BigDecimal d = null; |
| | | BigDecimal c = null; |
| | | if(company.getIsSameLogisticsFixedOrProportional() == 2){//固定 |
| | | d = new BigDecimal(speMoney); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | if(company.getIsSameLogisticsFixedOrProportional() == 1){//比例 |
| | | d = new BigDecimal(orderLogistics.getOrderMoney()).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | incomeService.saveData(1, orderLogistics.getCompanyId(), 2, orderLogistics.getId(), orderLogistics.getType(), d.doubleValue()); |
| | | incomeService.saveData(2, orderLogistics.getDriverId(), 2, orderLogistics.getId(), orderLogistics.getType(), c.doubleValue()); |
| | | Driver driver = driverService.selectById(orderLogistics.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.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | transactionDetailsService.saveData(orderLogistics.getDriverId(), "小件物流补差价", c.doubleValue(), 1, 1, 2, 4, orderLogistics.getId()); |
| | | transactionDetailsService.saveData(orderLogistics.getDriverId(), "软件使用费", orderLogistics.getOrderMoney()-c.doubleValue(), 2, 2, 6, 4, orderLogistics.getId()); |
| | | driverService.updateById(driver); |
| | | break; |
| | | } |
| | | this.updateById(orderLogistics); |
| | |
| | | public void sendVerificationCode(Integer orderId) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | String random = ""; |
| | | for(int i = 0; i < 6; i++){ |
| | | for(int i = 0; i < 4; i++){ |
| | | random += Double.valueOf(Math.random() * 10).intValue(); |
| | | } |
| | | orderLogistics.setPickUpCode(random); |
| | | this.updateById(orderLogistics); |
| | | Integer driverId = orderLogistics.getDriverId(); |
| | | Driver driver = driverService.selectById(driverId); |
| | | Integer carId = driver.getCarId(); |
| | | Car car = carMapper.selectById(carId); |
| | | //发送短信 |
| | | aLiSendSms.sendSms(orderLogistics.getRecipientPhone(), "SMS_482775061", "{\"code\":\"" + random + "\"}"); |
| | | SMSUtil.send(orderLogistics.getRecipientPhone(), "您好!您的小件物流订单已被车辆"+car.getCarLicensePlate()+"接单,司机电话:"+driver.getPhone()+",取件码为"+random+",请在取货是出示取件码。", "2431012324056"); |
| | | // aLiSendSms.sendSms(orderLogistics.getRecipientPhone(), "SMS_482775061", "{\"code\":\"" + random + "\"}"); |
| | | } |
| | | |
| | | @Override |