| | |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.CheckoutRequest; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.PayoutResponse; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.Results; |
| | | import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.jsoup.nodes.FormElement; |
| | | import org.jsoup.select.Elements; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileOutputStream; |
| | | import java.io.FileWriter; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | |
| | | @Value("${spring.mail.template-path}") |
| | | private String templatePath; |
| | | |
| | | @Autowired |
| | | private TEmailService emailService; |
| | | |
| | | private static List<Integer> orderIds = new ArrayList<>(); |
| | | |
| | | @Autowired |
| | | private IPhoneService phoneService; |
| | | |
| | | |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil queryLogisticsUnitPrice(Integer type, String startLonLat, String endAddress, Integer uid, Integer language) throws Exception { |
| | | FindPlaceFromTextVo findplacefromtext = GoogleMapUtil.textsearch(endAddress); |
| | | if(null == findplacefromtext){ |
| | | return ResultUtil.error(language == 1 ? "收货地址有误,无法查询具体地址信息" : language == 2 ? "The delivery address is incorrect, and the specific address information cannot be queried" : "L’adresse de livraison est incorrecte, impossible de vérifier l’adresse spécifique"); |
| | | } |
| | | Double lng = findplacefromtext.getLng(); |
| | | Double lat = findplacefromtext.getLat(); |
| | | public ResultUtil queryLogisticsUnitPrice(Integer type, String startLonLat, String endLonLat, String endAddress, Integer uid, Integer language) throws Exception { |
| | | String[] split = endLonLat.split(","); |
| | | Double lng = Double.valueOf(split[0]); |
| | | Double lat = Double.valueOf(split[1]); |
| | | ResultUtil<Map<String, Double>> price = this.getPrice1(type, startLonLat.split(",")[0], startLonLat.split(",")[1], lng.toString(), lat.toString(), language); |
| | | if(price.getCode() != 200){ |
| | | return price; |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil queryPayMoney(Integer number, Integer type, String startLonLat, String endAddress, Integer language) throws Exception{ |
| | | FindPlaceFromTextVo findplacefromtext = GoogleMapUtil.textsearch(endAddress); |
| | | if(null == findplacefromtext){ |
| | | return ResultUtil.error(language == 1 ? "收货地址有误,无法查询具体地址信息" : language == 2 ? "The delivery address is incorrect, and the specific address information cannot be queried" : "L’adresse de livraison est incorrecte, impossible de vérifier l’adresse spécifique"); |
| | | } |
| | | Double lng = findplacefromtext.getLng(); |
| | | Double lat = findplacefromtext.getLat(); |
| | | public ResultUtil queryPayMoney(Integer number, Integer type, String startLonLat, String endLonLat, String endAddress, Integer language) throws Exception{ |
| | | String[] split = endLonLat.split(","); |
| | | Double lng = Double.valueOf(split[0]); |
| | | Double lat = Double.valueOf(split[1]); |
| | | ResultUtil<Map<String, Double>> price = this.getPrice1(type, startLonLat.split(",")[0], startLonLat.split(",")[1], lng.toString(), lat.toString(), language); |
| | | if(price.getCode() == 200 && type == 5){ |
| | | Map<String, Double> data = price.getData(); |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil smallLogistics(Integer type, Integer cargoType, Integer cargoNumber, String remark, String placementLon, String placementLat, String startLon, String startLat, String startAddress, String recipient, |
| | | String recipientPhone, String endAddress, Integer urgent, Double tipMoney, Date travelTime, Integer orderSource, Integer uid, Integer language) throws Exception { |
| | | String recipientPhone, String endLonLat, String endAddress, Integer urgent, Double tipMoney, Date travelTime, Integer orderSource, Integer uid, Integer language) throws Exception { |
| | | startAddress = startAddress.replaceAll("& #40;", "("); |
| | | startAddress = startAddress.replaceAll("& #41;", ")"); |
| | | endAddress = endAddress.replaceAll("& #40;", "("); |
| | |
| | | OrderLogistics orderLogistics = new OrderLogistics(); |
| | | Company query = companyCityService.query1(placementLon, placementLat); |
| | | if(null == query){ |
| | | return ResultUtil.error(language == 1 ? "该地点暂无企业服务" : language == 2 ? "No corporate services are available at this location" : "Aucun service d’entreprise n’est disponible pour cet emplacement"); |
| | | return ResultUtil.error(language == 1 ? "该地点暂无企业服务" : language == 2 ? "No service yet at this area" : "Pas encore de service dans cette zone"); |
| | | } |
| | | orderLogistics.setCompanyId(query.getId()); |
| | | orderLogistics.setType(type); |
| | |
| | | orderLogistics.setPlacementLat(Double.valueOf(placementLat)); |
| | | ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(Double.valueOf(placementLat), Double.valueOf(placementLon)); |
| | | if(null == reverseGeocode){ |
| | | return ResultUtil.error(language == 1 ? "解析地址出错" : language == 2 ? "Resolve address error" : "Erreur dans la résolution de l’adresse"); |
| | | return ResultUtil.error(language == 1 ? "解析地址出错" : language == 2 ? "Address resolution error" : "Erreur de résolution d’adresse"); |
| | | } |
| | | |
| | | String address = reverseGeocode.getAddress(); |
| | |
| | | orderLogistics.setStartLon(Double.valueOf(startLon)); |
| | | orderLogistics.setStartLat(Double.valueOf(startLat)); |
| | | orderLogistics.setStartAddress(startAddress); |
| | | FindPlaceFromTextVo findplacefromtext = GoogleMapUtil.textsearch(endAddress); |
| | | if(null == findplacefromtext){ |
| | | return ResultUtil.error(language == 1 ? "收货地址有误,无法查询具体地址信息" : language == 2 ? "The delivery address is incorrect, and the specific address information cannot be queried" : "L’adresse de livraison est incorrecte, impossible de vérifier l’adresse spécifique"); |
| | | } |
| | | Double lng = findplacefromtext.getLng(); |
| | | Double lat = findplacefromtext.getLat(); |
| | | |
| | | String[] split = endLonLat.split(","); |
| | | Double lng = Double.valueOf(split[0]); |
| | | Double lat = Double.valueOf(split[1]); |
| | | orderLogistics.setEndLon(lng); |
| | | orderLogistics.setEndLat(lat); |
| | | orderLogistics.setEndAddress(endAddress); |
| | |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您的市内包裹订单已下单成功,我们正在为您指派司机,请稍后!" : |
| | | language == 2 ? "Your parcel order has been successfully placed, we are assigning a driver for you, please wait!" |
| | | : "Votre commande de colis a bien été passée, nous vous assignons un chauffeur, veuillez patienter!", orderLogistics.getUserId(), 1); |
| | | language == 2 ? "You've placed the delivery order successfully, we are assigning you a driver, please wait." |
| | | : "Vous avez passé la commande de livraison avec succès, nous vous attribuons un chauffeur, veuillez patienter.", orderLogistics.getUserId(), 1); |
| | | |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setId(orderLogistics.getId()); |
| | |
| | | Company query = companyCityService.query1(startLon, startLat); |
| | | if(null == query){ |
| | | return ResultUtil.error(language == 1 ? "预约取货点暂无企业服务" : language == 2 ? |
| | | "There is no enterprise service at the reservation pickup point" : "Prise de rendez-vous point de collecte pas encore disponible pour les entreprises"); |
| | | "No service yet at the reserved pickup point." : "Les points de ramassage prévus ne sont pas disponibles pour le moment."); |
| | | } |
| | | Double price1 = 0D; |
| | | Double price2 = 0D; |
| | |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(startLat), Double.valueOf(startLon), Double.valueOf(endLat), Double.valueOf(endLon)); |
| | | if(null == distancematrix){ |
| | | return ResultUtil.error(language == 1 ? "计算距离出错" : language == 2 ? "Error in distance calculation" : "Erreur de calcul des distances"); |
| | | return ResultUtil.error(language == 1 ? "计算距离出错" : language == 2 ? "Errors in computing distance" : "Erreurs dans le calcul de la distance"); |
| | | } |
| | | if(distancematrix.getDistance() == 0){ |
| | | return ResultUtil.error(language == 1 ? "未获取到有效的距离" : language == 2 ? "A valid distance was not obtained" : "La distance effective n’est pas acquise"); |
| | | return ResultUtil.error(language == 1 ? "未获取到有效的距离" : language == 2 ? "Not obtaining available distance" : "Ne pas obtenir la distance disponible"); |
| | | } |
| | | String content = String.valueOf(query1.get("content")); |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | |
| | | price1 = jsonObject.getDouble("num11"); |
| | | } |
| | | if(dist.compareTo(jsonObject.getDouble("num10")) > 0){ |
| | | return ResultUtil.error(language == 1 ? "超出可服务范围" : language == 2 ? "Out of service range" : "Au-delà du service disponible"); |
| | | return ResultUtil.error(language == 1 ? "超出可服务范围" : language == 2 ? "Beyond service range" : "Au-delà de la portée de service"); |
| | | } |
| | | }else{ |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null); |
| | |
| | | PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0); |
| | | //获取空闲司机 |
| | | List<Driver> list = driverService.queryIdleDriver(orderLogistics.getType(), null, orderLogistics.getStartLon(), orderLogistics.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | System.err.println("【" + orderLogistics.getId() + "】空闲司机:" + JSON.toJSONString(list)); |
| | | if(list.size() > 0){ |
| | | double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 |
| | | int lastIndex = Double.valueOf(list.size() * driverProportion).intValue();//计算占比转成整数(下标截取) |
| | |
| | | public ResultUtil payLogisticsOrder(Integer payType, Integer bankCardId, Integer orderId, Integer type, Integer language) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | if(orderLogistics.getState() != 7){ |
| | | return ResultUtil.error(language == 1 ? "订单已完成支付,不允许重复支付" : language == 2 ? "The order has been paid, no double payment is allowed" : "La commande a été payée, aucun paiement en double n’est autorisé", ""); |
| | | return ResultUtil.error(language == 1 ? "订单已完成支付,不允许重复支付" : language == 2 ? "The order has been paid, recurring payments is not allowed." : "La commande a été payée, les paiements récurrents ne sont pas autorisés.", ""); |
| | | } |
| | | Integer uid = orderLogistics.getUserId(); |
| | | Double orderMoney = orderLogistics.getOrderMoney(); |
| | |
| | | |
| | | 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()); |
| | |
| | | orderLogistics.setPayType(3); |
| | | orderLogistics.setPayMoney(orderMoney); |
| | | |
| | | |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/receiptLogistics.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy年MM月dd日"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd HH:mm"); |
| | | if(1 == language){ |
| | | document.getElementById("english").remove(); |
| | | document.getElementById("french").remove(); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(sdf2.format(orderLogistics.getTravelTime()) + ",您在I-GO1个订单消费GHS " + orderLogistics.getPayMoney()); |
| | | Element xcf_chinese = document.getElementById("xcf_chinese"); |
| | | xcf_chinese.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_chinese = document.getElementById("xj_chinese"); |
| | | xj_chinese.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_chinese = document.getElementById("pay_type_chinese"); |
| | | pay_type_chinese.text("余额"); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_chinese = document.getElementById("start_address_chinese"); |
| | | start_address_chinese.text(orderLogistics.getStartAddress()); |
| | | Element end_address_chinese = document.getElementById("end_address_chinese"); |
| | | end_address_chinese.text(orderLogistics.getEndAddress()); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("french").remove(); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(sdf2.format(orderLogistics.getTravelTime()) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip "); |
| | | Element xcf_english = document.getElementById("xcf_english"); |
| | | xcf_english.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_english = document.getElementById("xj_english"); |
| | | xj_english.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_english = document.getElementById("pay_type_english"); |
| | | pay_type_english.text("balance"); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_english = document.getElementById("start_address_english"); |
| | | start_address_english.text(orderLogistics.getStartAddress()); |
| | | Element end_address_english = document.getElementById("end_address_english"); |
| | | end_address_english.text(orderLogistics.getEndAddress()); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("english").remove(); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text(sdf2.format(orderLogistics.getTravelTime()) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le "); |
| | | Element xcf_french = document.getElementById("xcf_french"); |
| | | xcf_french.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_french = document.getElementById("xj_french"); |
| | | xj_french.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_french = document.getElementById("pay_type_french"); |
| | | pay_type_french.text("Le solde"); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_french = document.getElementById("start_address_french"); |
| | | start_address_french.text(orderLogistics.getStartAddress()); |
| | | Element end_address_french = document.getElementById("end_address_french"); |
| | | end_address_french.text(orderLogistics.getEndAddress()); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "包裹收据" : language == 2 ? "Parcel receipt" : "Réception de colis", document.html()); |
| | | } |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | | @Override |
| | |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0); |
| | | } |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单支付,谢谢使用!" : language == 2 |
| | | ? "You have successfully completed the parcel order payment, thank you for using!" : |
| | | "Vous avez terminé avec succès le paiement de la commande de colis, merci de l’utiliser!", uid, 1); |
| | | ? "You've paid for the delivery order successfully, thank you for using I-GO" : |
| | | "Vous avez payé la commande de livraison avec succès, merci d’utiliser I-GO", uid, 1); |
| | | this.pushOrder(orderLogistics);//推单 |
| | | } |
| | | |
| | |
| | | orderLogistics.setPayType(4); |
| | | orderLogistics.setPayMoney(orderMoney); |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/receiptLogistics.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy年MM月dd日"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd HH:mm"); |
| | | if(1 == language){ |
| | | document.getElementById("english").remove(); |
| | | document.getElementById("french").remove(); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(sdf2.format(orderLogistics.getTravelTime()) + ",您在I-GO1个订单消费GHS " + orderLogistics.getPayMoney()); |
| | | Element xcf_chinese = document.getElementById("xcf_chinese"); |
| | | xcf_chinese.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_chinese = document.getElementById("xj_chinese"); |
| | | xj_chinese.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_chinese = document.getElementById("pay_type_chinese"); |
| | | pay_type_chinese.text("现金"); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_chinese = document.getElementById("start_address_chinese"); |
| | | start_address_chinese.text(orderLogistics.getStartAddress()); |
| | | Element end_address_chinese = document.getElementById("end_address_chinese"); |
| | | end_address_chinese.text(orderLogistics.getEndAddress()); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("french").remove(); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(sdf2.format(orderLogistics.getTravelTime()) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip "); |
| | | Element xcf_english = document.getElementById("xcf_english"); |
| | | xcf_english.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_english = document.getElementById("xj_english"); |
| | | xj_english.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_english = document.getElementById("pay_type_english"); |
| | | pay_type_english.text("cash"); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_english = document.getElementById("start_address_english"); |
| | | start_address_english.text(orderLogistics.getStartAddress()); |
| | | Element end_address_english = document.getElementById("end_address_english"); |
| | | end_address_english.text(orderLogistics.getEndAddress()); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("english").remove(); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text(sdf2.format(orderLogistics.getTravelTime()) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le "); |
| | | Element xcf_french = document.getElementById("xcf_french"); |
| | | xcf_french.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_french = document.getElementById("xj_french"); |
| | | xj_french.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_french = document.getElementById("pay_type_french"); |
| | | pay_type_french.text("espèces"); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_french = document.getElementById("start_address_french"); |
| | | start_address_french.text(orderLogistics.getStartAddress()); |
| | | Element end_address_french = document.getElementById("end_address_french"); |
| | | end_address_french.text(orderLogistics.getEndAddress()); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "包裹收据" : language == 2 ? "Parcel receipt" : "Réception de colis", document.html()); |
| | | } |
| | | |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | | @Override |
| | |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单支付,谢谢使用!" : language == 2 |
| | | ? "You have successfully completed the parcel order payment, thank you for using!" : |
| | | "Vous avez terminé avec succès le paiement de la commande de colis, merci de l’utiliser!", uid, 1); |
| | | ? "You've paid for the delivery order successfully, thank you for using I-GO" : |
| | | "Vous avez payé la commande de livraison avec succès, merci d’utiliser I-GO", uid, 1); |
| | | |
| | | this.pushOrder(orderLogistics);//推单 |
| | | } |
| | |
| | | |
| | | 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()); |
| | |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单差价支付,谢谢使用!" : language == 2 |
| | | ? "You have successfully completed the difference payment of parcel order, thank you for using!" |
| | | : "Vous avez complété avec succès le paiement de la différence de commande de colis, merci de l’utiliser!", uid, 1); |
| | | ? "You've paid for the difference of delivery order successfully, thank you for using I-GO" |
| | | : "Vous avez payé la différence de commande de livraison avec succès, merci d’utiliser I-GO", uid, 1); |
| | | } |
| | | |
| | | if(payType == 4){//现金支付 |
| | |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单差价支付,谢谢使用!" : language == 2 |
| | | ? "You have successfully completed the difference payment of parcel order, thank you for using!" |
| | | : "Vous avez complété avec succès le paiement de la différence de commande de colis, merci de l’utiliser!", uid, 1); |
| | | ? "You've paid for the difference of delivery order successfully, thank you for using I-GO" |
| | | : "Vous avez payé la différence de commande de livraison avec succès, merci d’utiliser I-GO", uid, 1); |
| | | } |
| | | |
| | | |
| | |
| | | query.setCode(order_id); |
| | | paymentRecordService.updateById(query); |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/receiptLogistics.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd HH:mm"); |
| | | if(1 == language){ |
| | | document.getElementById("english").remove(); |
| | | document.getElementById("french").remove(); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(sdf.format(orderLogistics.getTravelTime()) + ",您在I-GO1个订单消费GHS " + orderLogistics.getPayMoney()); |
| | | Element xcf_chinese = document.getElementById("xcf_chinese"); |
| | | xcf_chinese.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_chinese = document.getElementById("xj_chinese"); |
| | | xj_chinese.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_chinese = document.getElementById("pay_type_chinese"); |
| | | pay_type_chinese.text("余额"); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_chinese = document.getElementById("start_address_chinese"); |
| | | start_address_chinese.text(orderLogistics.getStartAddress()); |
| | | Element end_address_chinese = document.getElementById("end_address_chinese"); |
| | | end_address_chinese.text(orderLogistics.getEndAddress()); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("french").remove(); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(sdf.format(orderLogistics.getTravelTime()) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip "); |
| | | Element xcf_english = document.getElementById("xcf_english"); |
| | | xcf_english.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_english = document.getElementById("xj_english"); |
| | | xj_english.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_english = document.getElementById("pay_type_english"); |
| | | pay_type_english.text("balance"); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_english = document.getElementById("start_address_english"); |
| | | start_address_english.text(orderLogistics.getStartAddress()); |
| | | Element end_address_english = document.getElementById("end_address_english"); |
| | | end_address_english.text(orderLogistics.getEndAddress()); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("english").remove(); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text(sdf.format(orderLogistics.getTravelTime()) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le "); |
| | | Element xcf_french = document.getElementById("xcf_french"); |
| | | xcf_french.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_french = document.getElementById("xj_french"); |
| | | xj_french.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_french = document.getElementById("pay_type_french"); |
| | | pay_type_french.text("Le solde"); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_french = document.getElementById("start_address_french"); |
| | | start_address_french.text(orderLogistics.getStartAddress()); |
| | | Element end_address_french = document.getElementById("end_address_french"); |
| | | end_address_french.text(orderLogistics.getEndAddress()); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "市内小件物流收据" : language == 2 ? "Delivery receipt for small parts in the city" : "Réception logistique de petites pièces dans la ville", document.html()); |
| | | } |
| | | |
| | | |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | | @Override |
| | |
| | | |
| | | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单支付,谢谢使用!" : language == 2 |
| | | ? "You have successfully completed the parcel order payment, thank you for using!" : |
| | | "Vous avez terminé avec succès le paiement de la commande de colis, merci de l’utiliser!", orderLogistics.getUserId(), 1); |
| | | ? "You've paid for the delivery order successfully, thank you for using I-GO" : |
| | | "Vous avez payé la commande de livraison avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1); |
| | | |
| | | this.pushOrder(orderLogistics);//推单 |
| | | }else{ |
| | |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单差价支付,谢谢使用!" : language == 2 |
| | | ? "You have successfully completed the difference payment of parcel order, thank you for using!" |
| | | : "Vous avez complété avec succès le paiement de la différence de commande de colis, merci de l’utiliser!", orderLogistics.getUserId(), 1); |
| | | ? "You've paid for the difference of delivery order successfully, thank you for using I-GO" |
| | | : "Vous avez payé la différence de commande de livraison avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1); |
| | | }else{ |
| | | System.err.println("预支付数据异常(orderId = " + id + ")"); |
| | | } |
| | |
| | | public List<Map<String, Object>> queryMyOrderList(Integer uid, Integer pageNum, Integer size, Integer language) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> maps = orderLogisticsMapper.queryMyOrderList(uid, pageNum, size, language); |
| | | for (Map<String, Object> map : maps) { |
| | | 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.conversionFormat(language, time)); |
| | | } |
| | | Integer orderId = Integer.valueOf(String.valueOf(map.get("orderId"))); |
| | | Integer state = Integer.valueOf(String.valueOf(map.get("state"))); |
| | | if(state == 6){ |
| | | map.put("receipt", "http://182.160.16.251:81/files/html/parcel_receipt_" + orderId + ".html"); |
| | | }else{ |
| | | map.put("receipt", ""); |
| | | } |
| | | } |
| | | return maps; |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryMyTravelRecord(Integer uid) { |
| | | return orderLogisticsMapper.queryMyTravelRecord(uid); |
| | | public List<Map<String, Object>> queryMyTravelRecord(Integer language, Integer uid) { |
| | | List<Map<String, Object>> list = orderLogisticsMapper.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; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> queryInvoiceOrder(Integer type, Date startTime, Date endTime, Double startMoney, Double endMoney, Integer uid, Integer orderType) throws Exception { |
| | | public List<Map<String, Object>> queryInvoiceOrder(Integer language, Integer type, Date startTime, Date endTime, Double startMoney, Double endMoney, Integer uid, Integer orderType) throws Exception { |
| | | startTime = dateUtil.getStartOrEndDate(startTime, "start"); |
| | | endTime = dateUtil.getStartOrEndDate(endTime, "end"); |
| | | return orderLogisticsMapper.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); |
| | | List<Map<String, Object>> list = orderLogisticsMapper.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); |
| | | for (Map<String, Object> map : list) { |
| | | map.put("orderName", language == 1 ? "包裹订单" : language == 2 ? "Delivery" : "Livraison"); |
| | | if(null != map.get("time")){ |
| | | String time = map.get("time").toString(); |
| | | map.put("time", DateUtil.conversionFormat(language, time)); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | |
| | | OrderLogistics orderLogistics = this.selectById(id); |
| | | Integer integer = null; |
| | | if(null == orderLogistics){ |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,订单信息有误" : language == 2 ? "Failed to cancel the order, the order information is incorrect" : "Échec de l'annulation de la commande, les informations de la commande sont incorrectes"); |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,订单信息有误" : language == 2 ? "Failed to cancel order, order-information error." : "Échec de l’annulation de la commande, erreur d’information de commande."); |
| | | } |
| | | if(orderLogistics.getState() > 5 && orderLogistics.getState() != 7 && orderLogistics.getState() != 11){ |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,不合法的操作" : language == 2 ? "Cancel order failed, illegal operation" : "Échec de l'annulation de la commande, opération illégale"); |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,不合法的操作" : language == 2 ? "Failed to cancel order, illegal operation." : "Échec de l’annulation de la commande, opération illégale."); |
| | | } |
| | | |
| | | if(orderLogistics.getState() == 7){ |
| | |
| | | this.updateById(orderLogistics); |
| | | //调用回退接口 |
| | | PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 1, 2); |
| | | if(null == query){ |
| | | return ResultUtil.error("支付数据异常,无法完成退款"); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String payerTransactionID = sdf.format(new Date()) + orderCancel.getId(); |
| | |
| | | this.updateById(orderLogistics); |
| | | integer = orderCancel.getId(); |
| | | //调用回退接口 |
| | | PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 1, 2); |
| | | PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 2, 2); |
| | | if(null == query){ |
| | | return ResultUtil.error("支付数据异常,无法完成退款"); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String payerTransactionID = sdf.format(new Date()) + orderCancel.getId(); |
| | |
| | | } |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功取消包裹订单,谢谢使用!" : language == 2 ? "You have successfully cancelled your parcel order, thank you for using!" |
| | | : "Vous avez annulé avec succès votre commande de colis, merci de l’utiliser!", orderLogistics.getUserId(), 1); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功取消包裹订单,谢谢使用!" : language == 2 ? "You've cancelled the delivery order successfully, thank you for using I-GO " |
| | | : "Vous avez annulé la commande de livraison avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", integer); |
| | | return ResultUtil.success(map); |
| | |
| | | } |
| | | |
| | | @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 = orderLogisticsMapper.queryOrderInfo(orderId); |
| | | if(null != map.get("travelTime")){ |
| | | String travelTime = map.get("travelTime").toString(); |
| | | map.put("travelTime", DateUtil.conversionFormat1(language, travelTime)); |
| | | } |
| | | Integer state = Integer.valueOf(String.valueOf(map.get("state"))); |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | if(null != map.get("reassignNotice") && Integer.valueOf(String.valueOf(map.get("reassignNotice"))) == 2){//改派完成,重新获取了新的司机数据,开始修改数据防止继续调用 |
| | | orderLogistics.setReassignNotice(0); |
| | | this.updateById(orderLogistics); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("state"))) == 11){ |
| | | if(state == 11){ |
| | | map.put("state", map.get("oldState")); |
| | | } |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(map.get("startLon").toString(), map.get("startLat").toString()); |
| | |
| | | String driverId = redisUtil.getValue("DEVICE_" + map.get("driverId")); |
| | | map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1); |
| | | map.put("orderType", orderLogistics.getType()); |
| | | if(state == 6){ |
| | | map.put("receipt", "http://182.160.16.251:81/files/html/parcel_receipt_" + orderId + ".html"); |
| | | }else{ |
| | | map.put("receipt", ""); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | @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 { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon(uid, orderLogistics.getCompanyId(), 1, 4, orderLogistics.getOrderMoney(), pageNum, size); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(uid, orderLogistics.getCompanyId(), 1, 0, orderLogistics.getOrderMoney(), pageNum, size); |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon(language, uid, orderLogistics.getCompanyId(), 1, 4, orderLogistics.getOrderMoney(), pageNum, size); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(language, uid, orderLogistics.getCompanyId(), 1, 0, orderLogistics.getOrderMoney(), pageNum, size); |
| | | list.addAll(list1); |
| | | return list; |
| | | } |