| | |
| | | package com.stylefeng.guns.modular.crossCity.server.impl; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, "您的跨城订单已下单成功!", orderCrossCity.getUserId(), 1); |
| | | |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setId(orderCrossCity.getId()); |
| | | //生成小程序二维码,用于司机展示让用户跳转到小程序完成订单支付 |
| | | String qrcode = ""; |
| | | String appletPath = "pages/home/home"; |
| | | InputStream inputStream = weChatUtil.getwxacodeunlimit(appletPath, "", "release"); |
| | | if (inputStream != null) { |
| | | File file = FileUtil.writeFromStream(inputStream, new File(filePath + "/" + UUID.randomUUID().toString() + ".png")); |
| | | HttpRequest post = HttpUtil.createPost(adminUrl + "/upload/image"); |
| | | post.form("file", file); |
| | | HttpResponse execute = post.execute(); |
| | | int status = execute.getStatus(); |
| | | if(200 != status){ |
| | | throw new RuntimeException("上传图片异常"); |
| | | } |
| | | driver.setQrCode(execute.body()); |
| | | driverService.updateById(driver); |
| | | qrcode = driver.getQrCode(); |
| | | } |
| | | baseWarpper.setContent(qrcode); |
| | | // baseWarpper.setContent(""); |
| | | // //生成小程序二维码,用于司机展示让用户跳转到小程序完成订单支付 |
| | | // String appletPath = "pages/home/home"; |
| | | // InputStream inputStream = weChatUtil.getwxacodeunlimit(appletPath, "", "release"); |
| | | // if (inputStream != null) { |
| | | // File file = FileUtil.writeFromStream(inputStream, new File(filePath + "/" + UUID.randomUUID().toString() + ".png")); |
| | | // HttpRequest post = HttpUtil.createPost(adminUrl + "/upload/image"); |
| | | // post.form("file", file); |
| | | // HttpResponse execute = post.execute(); |
| | | // int status = execute.getStatus(); |
| | | // if(200 != status){ |
| | | // throw new RuntimeException("上传图片异常"); |
| | | // } |
| | | // JSONObject jsonObject = JSON.parseObject(execute.body()); |
| | | // Integer code = jsonObject.getInteger("code"); |
| | | // if(200 == code){ |
| | | // baseWarpper.setContent(jsonObject.getString("data")); |
| | | // } |
| | | // } |
| | | |
| | | //创建定时任务,取消订单30分钟 |
| | | TimerTask timerTask = new TimerTask() { |