| | |
| | | import com.stylefeng.guns.modular.system.model.OrderPosition; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @throws Exception |
| | | */ |
| | | List<OrderCrossCity> taskMidAxbUnBindSend() throws Exception; |
| | | |
| | | |
| | | ResultUtil cancleOrder(Integer orderId) throws Exception; |
| | | } |
| | |
| | | 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.*; |
| | |
| | | private CarServiceImpl carServiceImpl; |
| | | @Autowired |
| | | private ICompanyService companyService; |
| | | |
| | | @Autowired |
| | | private WeChatUtil weChatUtil; |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | @Value("${qyt.admin_url}") |
| | | private String adminUrl; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | 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); |
| | | |
| | | //创建定时任务,取消订单30分钟 |
| | | TimerTask timerTask = new TimerTask() { |
| | |
| | | size++; |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil cancleOrder(Integer orderId) throws Exception { |
| | | OrderCrossCity orderCrossCity = orderCrossCityMapper.selectById(orderId); |
| | | if(orderCrossCity.getState() == 7 && orderCrossCity.getPayMoney() == null){ |
| | | orderCrossCity.setState(10); |
| | | orderCrossCityMapper.updateById(orderCrossCity); |
| | | |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(orderId); |
| | | orderCancel.setOrderType(3); |
| | | orderCancel.setReason("用户未及时付款,系统自动取消订单"); |
| | | orderCancel.setRemark("用户未及时付款,系统自动取消订单"); |
| | | orderCancel.setState(2); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancel.setUserType(2); |
| | | orderCancelService.insert(orderCancel); |
| | | |
| | | //修改司机座位 |
| | | LineShiftDriver lineShiftDriver = lineShiftDriverMapper.selectById(orderCrossCity.getLineShiftDriverId()); |
| | | lineShiftDriver.setLaveSeat(lineShiftDriver.getLaveSeat() + orderCrossCity.getPeopleNumber()); |
| | | lineShiftDriver.setLaveSeatNumber(lineShiftDriver.getLaveSeatNumber() + (orderCrossCity.getTravelMode() == 1 ? "," : "") + orderCrossCity.getSeatNumber()); |
| | | lineShiftDriverMapper.updateById(lineShiftDriver); |
| | | |
| | | //修改司机为空闲 |
| | | List<OrderCrossCity> orderCrossCities = orderCrossCityMapper.queryByDriverId(orderCrossCity.getDriverId(), 2, 3, 4, 5, 11); |
| | | if(orderCrossCities.size() == 0){ |
| | | Driver driver = driverService.selectById(orderCrossCity.getDriverId()); |
| | | driver.setState(2); |
| | | driverService.updateById(driver); |
| | | } |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil confirmFees(Integer orderId, Integer type, Double parkingFee, Double crossingFee) throws Exception; |
| | | |
| | | ResultUtil cancleOrder(Integer orderId) throws Exception; |
| | | |
| | | ResultUtil updatePeopleNum(Integer orderId, Integer peopleNum) throws Exception; |
| | | |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil confirmFees(Integer orderId, Integer orderType, Integer type, Double travelFee, Double parkingFee, Double crossingFee) throws Exception; |
| | | |
| | | |
| | | ResultUtil cancleOrder(Integer orderId, Integer orderType) throws Exception; |
| | | |
| | | |
| | | |
| | | ResultUtil updatePeopleNum(Integer orderId, Integer peopleNum) throws Exception; |
| | | |
| | | |
| | |
| | | return orderPrivateCarService.cancleOrder(orderId); |
| | | case 2://出租 |
| | | break; |
| | | case 3://城际(没有此流程) |
| | | break; |
| | | case 3:// |
| | | return orderCrossCityService.cancleOrder(orderId); |
| | | case 4:// |
| | | break; |
| | | case 5: |
| | |
| | | public ResultUtil updatePeopleNum(Integer orderId, Integer peopleNum) throws Exception { |
| | | return orderPrivateCarService.updatePeopleNum(orderId,peopleNum); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil confirmFees1(Integer orderId, Integer orderType, Integer type, Double travelFee, String additionalFee) throws Exception { |
| | | switch (orderType){ |
| | |
| | | @ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "小程序支付成功跳转路径", name = "path", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "设备当前IP地址", name = "ip", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "支付角色(1=乘客,2=司机)", name = "role", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "jscode", name = "jscode", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil payTaxiOrder1(Integer payType, Integer orderId, Integer orderType, Integer objectId, Integer objectType, Integer type, String path, String ip, HttpServletRequest request) { |
| | | public ResultUtil payTaxiOrder1(Integer payType, Integer orderId, Integer orderType, Integer objectId, Integer objectType, Integer type, |
| | | String path, String ip, Integer role, String jscode, HttpServletRequest request) { |
| | | System.out.println(objectType); |
| | | System.out.println(objectId); |
| | | try { |
| | |
| | | case 2: |
| | | return orderTaxiService.payTaxiOrder1(payType, orderId, objectId, objectType, type, path, ip); |
| | | case 3: |
| | | ResultUtil resultUtil = orderCrossCityService.payCrossCityOrder1(payType, orderId, objectId, objectType, type, path, ip); |
| | | ResultUtil resultUtil = orderCrossCityService.payCrossCityOrder1(payType, orderId, objectId, objectType, type, path, ip, role, jscode); |
| | | |
| | | orderCrossCityService.promotion(orderId); |
| | | |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil payCrossCityOrder1(Integer payType, Integer orderId, Integer objectId, Integer objectType, Integer type, String path, String ip)throws Exception; |
| | | ResultUtil payCrossCityOrder1(Integer payType, Integer orderId, Integer objectId, Integer objectType, Integer type, String path, String ip, Integer role, String jscode)throws Exception; |
| | | |
| | | |
| | | |
| | |
| | | @Autowired |
| | | private ICompanyService iCompanyService; |
| | | |
| | | @Autowired |
| | | private WeChatUtil weChatUtil; |
| | | |
| | | |
| | | /** |
| | | * 计算支付金额 |
| | |
| | | |
| | | @Override |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | | public ResultUtil payCrossCityOrder1(Integer payType, Integer orderId, Integer objectId, Integer objectType, Integer type, String path, String ip) throws Exception { |
| | | public ResultUtil payCrossCityOrder1(Integer payType, Integer orderId, Integer objectId, Integer objectType, Integer type, String path, String ip, Integer role, String jscode) throws Exception { |
| | | OrderCrossCity orderCrossCity = this.selectById(orderId); |
| | | Integer uid = orderCrossCity.getUserId(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | String appletsOpenId = userInfo.getAppletsOpenId(); |
| | | //司机端发起的支付 |
| | | if(null != role && 2 == role){ |
| | | Driver driver = driverService.selectById(orderCrossCity.getDriverId()); |
| | | appletsOpenId = driver.getAppletsOpenId(); |
| | | if(ToolUtil.isNotEmpty(appletsOpenId)){ |
| | | Map<String, String> stringMap = weChatUtil.code2Session(jscode); |
| | | appletsOpenId = stringMap.get("openid"); |
| | | driver.setAppletsOpenId(appletsOpenId); |
| | | driverService.updateById(driver); |
| | | } |
| | | } |
| | | if (orderCrossCity.getState() != 7) { |
| | | return ResultUtil.error("订单已完成支付,不允许重复支付", ""); |
| | | } |
| | | Integer uid = orderCrossCity.getUserId(); |
| | | Double orderMoney = orderCrossCity.getOrderMoney(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(new Object()); |
| | | orderCrossCity.setCouponMoney(0D);//初始化历史数据 |
| | | orderCrossCity.setCouponId(null); |
| | |
| | | |
| | | List<GoodsInfoRequest> goodsInfo = new ArrayList<>(); |
| | | GoodsInfoRequest goodsInfoRequest = new GoodsInfoRequest(); |
| | | goodsInfoRequest.setSubOpenId(userInfo.getAppletsOpenId()); |
| | | goodsInfoRequest.setSubOpenId(appletsOpenId); |
| | | if(0 == orderCrossCity.getRecoveryOrder()){ |
| | | goodsInfoRequest.setProfitSharing("1"); |
| | | |
| | |
| | | tradePayOff1Data.setOrderDesc("完成订单"); |
| | | List<GoodsInfoRequest> goodsInfo = new ArrayList<>(); |
| | | GoodsInfoRequest goodsInfoRequest = new GoodsInfoRequest(); |
| | | goodsInfoRequest.setSubOpenId(userInfo.getAppletsOpenId()); |
| | | goodsInfoRequest.setSubOpenId(appletsOpenId); |
| | | if(0 == orderCrossCity.getRecoveryOrder()){ |
| | | goodsInfoRequest.setProfitSharing("1"); |
| | | }else{ |
| | |
| | | this.updateAllColumnById(orderCrossCity); |
| | | return resultUtil; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | double a = 1.189999995; |
| | | double v = new BigDecimal(a).setScale(2, RoundingMode.HALF_UP).doubleValue(); |
| | | System.out.println(v); |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private AppOrderController appOrderController; |