From d7d4f057abd6f659f48f657b0f3b9eaba8519003 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期五, 21 七月 2023 09:01:14 +0800 Subject: [PATCH] 更新接口 --- DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java | 77 ++++++++++++++++++++++++-------------- 1 files changed, 48 insertions(+), 29 deletions(-) diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java index c6b4277..98ceb7d 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java @@ -10,14 +10,8 @@ import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsSpreadService; import com.stylefeng.guns.modular.system.dao.RegionMapper; import com.stylefeng.guns.modular.system.dao.UserInfoMapper; -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.model.UserInfo; -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.jsoup.Jsoup; @@ -83,6 +77,12 @@ @Value("${spring.mail.template-path}") private String templatePath; + @Autowired + private IPaymentRecordService paymentRecordService; + + @Autowired + private ITransactionDetailsService transactionDetailsService; + @@ -95,8 +95,8 @@ * @throws Exception */ @Override - public Map<String, Object> queryPushOrder(Integer orderId) throws Exception { - return orderLogisticsMapper.queryPushOrder(orderId); + public Map<String, Object> queryPushOrder(Integer orderId, Integer language) throws Exception { + return orderLogisticsMapper.queryPushOrder(orderId, language); } @@ -108,13 +108,13 @@ * @throws Exception */ @Override - public synchronized ResultUtil grabOrder(Integer orderId, Integer uid) throws Exception { + public synchronized ResultUtil grabOrder(Integer orderId, Integer uid, Integer language) throws Exception { OrderLogistics orderLogistics = this.selectById(orderId); if(orderLogistics.getState() == 10){ - return ResultUtil.error("订单已取消"); + return ResultUtil.error(language == 1 ? "订单已取消" : language == 2 ? "Order cancelled" : "Commande annulée"); } if(orderLogistics.getState() != 1){ - return ResultUtil.error("手速有点慢哦,订单已被抢啦!"); + return ResultUtil.error(language == 1 ? "手速有点慢哦,订单已被抢啦" : language == 2 ? "A little slow. The order's been taken" : "La main est un peu lente oh l’ordre a été volé"); } Driver driver = driverService.selectById(uid); orderLogistics.setDriverId(uid); @@ -180,7 +180,7 @@ }).start(); systemNoticeService.addSystemNotice(2, "您已成功抢得小件物流订单,请及时联系客户!", orderLogistics.getDriverId()); - systemNoticeService.addSystemNotice(1, "您的订单已指派给" + driver.getName().substring(0, 1) + "师傅,请保持电话畅通!", orderLogistics.getUserId()); + systemNoticeService.addSystemNotice(1, "您的订单已指派给" + driver.getLastName().substring(0, 1) + "师傅,请保持电话畅通!", orderLogistics.getUserId()); return ResultUtil.success(); } @@ -209,18 +209,18 @@ * @throws Exception */ @Override - public ResultUtil process(Integer orderId, Integer state, Double lon, Double lat, String address) throws Exception { + public ResultUtil process(Integer orderId, Integer state, Double lon, Double lat, String address, Integer language) throws Exception { OrderLogistics orderLogistics = this.selectById(orderId); switch (state){ case 3://出发前往预约点 orderLogistics.setState(3); orderLogistics.setSetOutTime(new Date()); - systemNoticeService.addSystemNotice(1, "司机已出发,请耐心等待", orderLogistics.getUserId()); + systemNoticeService.addSystemNotice(1, language == 1 ? "司机已出发,请耐心等待" : language == 2 ? "The driver has left, please wait patiently" : "Le chauffeur est parti, soyez patient", orderLogistics.getUserId()); break; case 4://到达预约点,等待客户上车 orderLogistics.setState(4); orderLogistics.setArriveTime(new Date()); - systemNoticeService.addSystemNotice(1, "司机已到达您设置的预约地点。", orderLogistics.getUserId()); + systemNoticeService.addSystemNotice(1, language == 1 ? "司机已到达您设置的预约地点。" : language == 2 ? "The driver has arrived at the reservation you set" : "e chauffeur est arrivé au lieu de rendez-vous que vous avez défini", orderLogistics.getUserId()); break; case 5://开始服务 orderLogistics.setBoardingLon(lon); @@ -263,10 +263,10 @@ * @throws Exception */ @Override - public ResultUtil fillInPickUpCode(Integer orderId, String pickUpCode) throws Exception { + public ResultUtil fillInPickUpCode(Integer orderId, String pickUpCode, Integer language) throws Exception { OrderLogistics orderLogistics = this.selectById(orderId); if(!"1246".equals(pickUpCode) && !orderLogistics.getPickUpCode().equals(pickUpCode)){ - return ResultUtil.error("验证失败"); + return ResultUtil.error(language == 1 ? "验证失败" : language == 2 ? "Verification failure" : "Échec de vérification"); } orderLogistics.setState(9); this.updateById(orderLogistics); @@ -282,11 +282,11 @@ * @throws Exception */ @Override - public ResultUtil makeUpTheDifference(Integer orderId, Double difference) throws Exception { + public ResultUtil makeUpTheDifference(Integer orderId, Double difference, Integer language) throws Exception { OrderLogisticsSpread query = orderLogisticsSpreadService.query(orderId); OrderLogistics orderLogistics = this.selectById(orderId); if(orderLogistics.getState() != 4 && orderLogistics.getState() != 8){ - return ResultUtil.error("不允许设置差价"); + return ResultUtil.error(language == 1 ? "不允许设置差价" : language == 2 ? "Price difference is not allowed" : "Les spreads ne sont pas autorisés"); } if(query != null){ query.setPrice(difference); @@ -310,8 +310,8 @@ } @Override - public List<Map<String, Object>> queryOrderList(Integer driverId) throws Exception { - return orderLogisticsMapper.queryOrderList(driverId); + public List<Map<String, Object>> queryOrderList(Integer driverId, Integer language) throws Exception { + return orderLogisticsMapper.queryOrderList(driverId, language); } /** @@ -322,8 +322,8 @@ * @throws Exception */ @Override - public List<Map<String, Object>> queryMyAllOrder(Integer state, Integer uid) throws Exception { - return orderLogisticsMapper.queryMyAllOrder(state, uid); + public List<Map<String, Object>> queryMyAllOrder(Integer state, Integer uid, Integer language) throws Exception { + return orderLogisticsMapper.queryMyAllOrder(state, uid, language); } @@ -335,13 +335,13 @@ * @throws Exception */ @Override - public synchronized ResultUtil grabOrder_(Integer orderId, Integer uid) throws Exception { + public synchronized ResultUtil grabOrder_(Integer orderId, Integer uid, Integer language) throws Exception { OrderLogistics orderLogistics = this.selectById(orderId); if(orderLogistics.getState() == 10){ - return ResultUtil.error("订单已取消"); + return ResultUtil.error(language == 1 ? "订单已取消" : language == 2 ? "Order cancelled" : "Commande annulée"); } if(orderLogistics.getState() != 1){ - return ResultUtil.error("手速有点慢哦,订单已被抢啦!"); + return ResultUtil.error(language == 1 ? "手速有点慢哦,订单已被抢啦!" : language == 2 ? "Hand speed is a little slow oh, the order has been robbed!" : "La main est un peu lente oh, l’ordre a été volé!"); } Driver driver = driverService.selectById(uid); orderLogistics.setDriverId(uid); @@ -398,7 +398,7 @@ }).start(); systemNoticeService.addSystemNotice(2, "您已成功抢得出租车订单,请及时联系客户!", orderLogistics.getDriverId()); - systemNoticeService.addSystemNotice(1, "您的订单已指派给" + driver.getName().substring(0, 1) + "师傅,请保持电话畅通!", orderLogistics.getUserId()); + systemNoticeService.addSystemNotice(1, "您的订单已指派给" + driver.getLastName().substring(0, 1) + "师傅,请保持电话畅通!", orderLogistics.getUserId()); return ResultUtil.success(); } @@ -480,4 +480,23 @@ } } + + + @Override + public void payOrderLogisticsCallback(Integer id, String order_id, Integer language) throws Exception { + OrderLogistics orderLogistics = this.selectById(id); + PaymentRecord query = paymentRecordService.query(1, null, 2, Integer.valueOf(id), orderLogistics.getType(), null, 1); + if(null != query){ + //添加交易明细 + transactionDetailsService.saveData(orderLogistics.getDriverId(), language == 1 ? "现金收款代付" : language == 2 ? "Cash collection on behalf of payment" : "Paiement en espèces", query.getAmount(), 2, 1, 2, orderLogistics.getType(), id); + orderLogistics.setDriverPay(2); + this.updateById(orderLogistics); + + query.setState(2); + query.setCode(order_id); + paymentRecordService.updateById(query); + }else{ + System.err.println("预支付数据异常(orderId = " + id + ")"); + } + } } -- Gitblit v1.7.1