Merge remote-tracking branch 'origin/master'
| | |
| | | if("1".equals(orderType)){ |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | orderPrivateCar.setVoice(fileUrl); |
| | | orderPrivateCar.setVoiceTime(new Date()); |
| | | orderPrivateCarService.updateById(orderPrivateCar); |
| | | } |
| | | if("2".equals(orderType)){ |
| | | OrderTaxi orderTaxi = orderTaxiService.selectById(orderId); |
| | | orderTaxi.setVoice(fileUrl); |
| | | orderTaxi.setVoiceTime(new Date()); |
| | | orderTaxiService.updateById(orderTaxi); |
| | | } |
| | | if("3".equals(orderType)){ |
| | | OrderCrossCity orderCrossCity = orderCrossCityService.selectById(orderId); |
| | | orderCrossCity.setVoice(fileUrl); |
| | | orderCrossCity.setVoiceTime(new Date()); |
| | | orderCrossCityService.updateById(orderCrossCity); |
| | | } |
| | | |
| | | // TODO 顺风车 |
| | | |
| | | } |
| | | PrintWriter out = null; |
| | | try { |
| | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "个人的小程序码(分享码)生成", tags = {"司机端-首页"}, notes = "") |
| | | @ApiOperation(value = "个人的小程序码(分享码)/链接", tags = {"司机端-首页"}, notes = "") |
| | | @GetMapping("/api/driver/person-code") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Driver driver = driverService.selectById(uid); |
| | | String accessToken=null; |
| | | // 获取调用凭证accessToken |
| | | String accessToken = getAccessToken(); |
| | | RestTemplate rest = new RestTemplate(); |
| | | if(ToolUtil.isEmpty(driver.getShareImg())|| ToolUtil.isEmpty(driver.getShareImg())){ |
| | | accessToken = getAccessToken(); |
| | | } |
| | | String img=driver.getShareImg(); |
| | | int index=0; |
| | | |
| | | String imgUrl = ""; |
| | | String url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=" + accessToken; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("path", "pages/home/home?driverId=" + uid); |
| | | param.put("width", 430); //二维码尺寸 |
| | | MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); |
| | | HttpEntity requestEntity = new HttpEntity(param, headers); |
| | | ResponseEntity<byte[]> entity = rest.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]); |
| | | byte[] result = entity.getBody(); |
| | | inputStream = new ByteArrayInputStream(result); |
| | | if(ToolUtil.isEmpty(driver.getShareImg())) { |
| | | index=1; |
| | | RestTemplate rest = new RestTemplate(); |
| | | String imgUrl = ""; |
| | | String url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=" + accessToken; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("path", "pages/home/home?driverId=" + uid); |
| | | param.put("width", 430); //二维码尺寸 |
| | | MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); |
| | | HttpEntity requestEntity = new HttpEntity(param, headers); |
| | | ResponseEntity<byte[]> entity = rest.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]); |
| | | byte[] result = entity.getBody(); |
| | | inputStream = new ByteArrayInputStream(result); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | // 最后上传生成的文件名 |
| | | String finalFileName = System.currentTimeMillis() + "" + new SecureRandom().nextInt(0x0400) + ".jpg"; |
| | | // oss中的文件夹名 |
| | | String objectName = sdf.format(new Date()) + "/" + finalFileName; |
| | | String key = "imgs/management/" + objectName; |
| | | String object = NCOSSUtil.putObject( qianYunTongConfig.getBucketName(), key, inputStream); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | // 最后上传生成的文件名 |
| | | String finalFileName = System.currentTimeMillis() + "" + new SecureRandom().nextInt(0x0400) + ".jpg"; |
| | | // oss中的文件夹名 |
| | | String objectName = sdf.format(new Date()) + "/" + finalFileName; |
| | | String key = "imgs/management/" + objectName; |
| | | String object = NCOSSUtil.putObject(qianYunTongConfig.getBucketName(), key, inputStream); |
| | | System.out.println(object); |
| | | driver.setShareImg(object); |
| | | img= object; |
| | | } |
| | | |
| | | System.out.println(object); |
| | | String urlLink = driver.getShareLink(); |
| | | if(ToolUtil.isEmpty(urlLink)) { |
| | | index=1; |
| | | String url1 = "https://api.weixin.qq.com/wxa/generate_urllink?access_token=" + accessToken; |
| | | Map<String, Object> param1 = new HashMap<>(); |
| | | param1.put("path", "pages/home/home"); |
| | | param1.put("query", "driverId=" + uid); |
| | | |
| | | String url1 ="https://api.weixin.qq.com/wxa/generate_urllink?access_token="+accessToken; |
| | | Map<String, Object> param1 = new HashMap<>(); |
| | | param1.put("path", "pages/home/home"); |
| | | param1.put("query","driverId="+uid); |
| | | HttpRequest post = HttpUtil.createPost(url1); |
| | | // map转json |
| | | String jsonString = JSON.toJSONString(param1); |
| | | post.body(jsonString); |
| | | HttpResponse execute = post.execute(); |
| | | String body = execute.body(); |
| | | urlLink = JSONObject.parseObject(body).get("url_link").toString(); |
| | | driver.setShareLink(urlLink); |
| | | } |
| | | |
| | | HttpRequest post = HttpUtil.createPost(url1); |
| | | // map转json |
| | | String jsonString = JSON.toJSONString(param1); |
| | | post.body(jsonString); |
| | | HttpResponse execute = post.execute(); |
| | | String body = execute.body(); |
| | | String urlLink = JSONObject.parseObject(body).get("url_link").toString(); |
| | | |
| | | if(index==1){ |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | HashMap<String, String> stringStringHashMap = new HashMap<>(); |
| | | stringStringHashMap.put("url_link",urlLink); |
| | | stringStringHashMap.put("img",object); |
| | | stringStringHashMap.put("img",img); |
| | | |
| | | |
| | | // inputStream = new ByteArrayInputStream(result); |
| | |
| | | |
| | | |
| | | private String voice; |
| | | private Date voiceTime; |
| | | |
| | | public Date getVoiceTime() { |
| | | return voiceTime; |
| | | } |
| | | |
| | | public void setVoiceTime(Date voiceTime) { |
| | | this.voiceTime = voiceTime; |
| | | } |
| | | |
| | | public String getVoice() { |
| | | return voice; |
| | |
| | | @TableField("voice") |
| | | private String voice; |
| | | |
| | | private Date voiceTime; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 预估里程(米) |
| | | */ |
| | |
| | | // 推广司机id |
| | | private Integer promotionDriverId; |
| | | |
| | | |
| | | public Date getVoiceTime() { |
| | | return voiceTime; |
| | | } |
| | | |
| | | public void setVoiceTime(Date voiceTime) { |
| | | this.voiceTime = voiceTime; |
| | | } |
| | | |
| | | public String getVoice() { |
| | | return voice; |
| | | } |
| | |
| | | if(orderPrivateCar.getState() != 1 && orderPrivateCar.getState() != 11){ |
| | | return ResultUtil.error("手速有点慢哦,订单已被抢啦!"); |
| | | } |
| | | |
| | | Integer oldDriverId = null; |
| | | if(orderPrivateCar.getState()==11){ |
| | | oldDriverId= orderPrivateCar.getDriverId(); |
| | | } |
| | | |
| | | Driver driver = driverService.selectById(uid); |
| | | if(orderPrivateCar.getType() == 3){ |
| | | //批量订单 |
| | |
| | | } |
| | | |
| | | //推送相关代码------------------start---------------- |
| | | Integer finalOldDriverId = oldDriverId; |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState()); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState()); |
| | | if(orderPrivateCar.getType() == 2){ |
| | | pushUtil.pushFerryOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, 2); |
| | | if(finalOldDriverId !=null){ |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState()); |
| | | pushUtil.pushOrderReassign(orderPrivateCar.getUserId(),1 , orderPrivateCar.getId(), 1); |
| | | pushUtil.pushOrderReassign(finalOldDriverId,2, orderPrivateCar.getId(), 1); |
| | | }else { |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState()); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState()); |
| | | if(orderPrivateCar.getType() == 2){ |
| | | pushUtil.pushFerryOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, 2); |
| | | } |
| | | } |
| | | |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | @ApiModelProperty("区代码") |
| | | private String areaCode; |
| | | |
| | | @ApiModelProperty("分享图片") |
| | | private String shareImg; |
| | | |
| | | @ApiModelProperty("分享链接") |
| | | private String shareLink; |
| | | |
| | | public String getShareImg() { |
| | | return shareImg; |
| | | } |
| | | |
| | | public void setShareImg(String shareImg) { |
| | | this.shareImg = shareImg; |
| | | } |
| | | |
| | | public String getShareLink() { |
| | | return shareLink; |
| | | } |
| | | |
| | | public void setShareLink(String shareLink) { |
| | | this.shareLink = shareLink; |
| | | } |
| | | |
| | | public String getProvince() { |
| | | return province; |
| | | } |
| | |
| | | reassign.setPayTime(new Date()); |
| | | reassignMapper.updateById(reassign); |
| | | |
| | | Double balance = driver.getBalance(); |
| | | Double laveBusinessMoney = driver.getLaveBusinessMoney(); |
| | | Double laveActivityMoney = driver.getLaveActivityMoney(); |
| | | if(null == balance || balance < aDouble){ |
| | | throw new SystemException("账户余额不足"); |
| | | } |
| | | if(null != laveBusinessMoney && laveBusinessMoney.compareTo(aDouble) >= 0){ |
| | | driver.setLaveBusinessMoney(new BigDecimal(laveBusinessMoney).subtract(new BigDecimal(aDouble)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | }else if(null != laveActivityMoney && laveActivityMoney.compareTo(aDouble) >= 0){ |
| | | driver.setLaveActivityMoney(new BigDecimal(laveActivityMoney).subtract(new BigDecimal(aDouble)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | } |
| | | driver.setBalance(new BigDecimal(balance).subtract(new BigDecimal(aDouble)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | // Double balance = driver.getBalance(); |
| | | // Double laveBusinessMoney = driver.getLaveBusinessMoney(); |
| | | // Double laveActivityMoney = driver.getLaveActivityMoney(); |
| | | // if(null == balance || balance < aDouble){ |
| | | // throw new SystemException("账户余额不足"); |
| | | // } |
| | | // if(null != laveBusinessMoney && laveBusinessMoney.compareTo(aDouble) >= 0){ |
| | | // driver.setLaveBusinessMoney(new BigDecimal(laveBusinessMoney).subtract(new BigDecimal(aDouble)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // }else if(null != laveActivityMoney && laveActivityMoney.compareTo(aDouble) >= 0){ |
| | | // driver.setLaveActivityMoney(new BigDecimal(laveActivityMoney).subtract(new BigDecimal(aDouble)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // } |
| | | // driver.setBalance(new BigDecimal(balance).subtract(new BigDecimal(aDouble)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // driverService.updateById(driver); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "司机改派支付", aDouble, 2, 1, 2, reassign.getOrderType(), reassign.getOrderId()); |
| | | // transactionDetailsService.saveData(uid, "司机改派支付", aDouble, 2, 1, 2, reassign.getOrderType(), reassign.getOrderId()); |
| | | |
| | | |
| | | //修改改派通知状态 |
| | |
| | | orderPrivateCarService.updateById(orderPrivateCar); |
| | | |
| | | //添加已收入明细 |
| | | incomeService.saveData(1, orderPrivateCar.getCompanyId(), 4, orderPrivateCar.getId(), 1, reassign.getMoney()); |
| | | // incomeService.saveData(1, orderPrivateCar.getCompanyId(), 4, orderPrivateCar.getId(), 1, reassign.getMoney()); |
| | | // qyt 改派直接推送 |
| | | pushOrderPrivate(orderPrivateCar,uid); |
| | | break; |
| | |
| | | orderTaxiService.updateById(orderTaxi); |
| | | |
| | | //添加已收入明细 |
| | | incomeService.saveData(1, orderTaxi.getCompanyId(), 4, orderTaxi.getId(), 2, reassign.getMoney()); |
| | | // incomeService.saveData(1, orderTaxi.getCompanyId(), 4, orderTaxi.getId(), 2, reassign.getMoney()); |
| | | |
| | | // qyt 改派直接推送 |
| | | pushOrderTaxi(orderTaxi,uid); |
| | |
| | | |
| | | private String voice; |
| | | |
| | | |
| | | private Date voiceTime; |
| | | |
| | | public Date getVoiceTime() { |
| | | return voiceTime; |
| | | } |
| | | |
| | | public void setVoiceTime(Date voiceTime) { |
| | | this.voiceTime = voiceTime; |
| | | } |
| | | |
| | | public String getVoice() { |
| | | return voice; |
| | | } |
| | |
| | | @Override |
| | | public synchronized ResultUtil grabOrder(Integer orderId, Integer uid) throws Exception { |
| | | OrderPrivateCar orderPrivateCar1 = orderPrivateCarService.selectById(orderId); |
| | | if(null != orderPrivateCar1 && orderPrivateCar1.getType() == 3 && orderPrivateCar1.getState() != 1){ |
| | | if(null != orderPrivateCar1 && orderPrivateCar1.getType() == 3 && orderPrivateCar1.getState() != 1&& orderPrivateCar1.getState() != 11){ |
| | | return ResultUtil.error("订单已被抢了"); |
| | | } |
| | | OrderTaxi orderTaxi = null; |
| | | if(null != orderPrivateCar1 && orderPrivateCar1.getType() == 3 && orderPrivateCar1.getState() == 1){ |
| | | if(null != orderPrivateCar1 && orderPrivateCar1.getType() == 3 && orderPrivateCar1.getState() == 1&& orderPrivateCar1.getState() == 11){ |
| | | orderPrivateCarService.deleteById(orderId); |
| | | OrderTaxi orderTaxi1 = setOrderTaxi(orderPrivateCar1); |
| | | this.insert(orderTaxi1); |
| | |
| | | if(orderTaxi.getState() == 10){ |
| | | return ResultUtil.error("订单已取消"); |
| | | } |
| | | if(orderTaxi.getState() != 1){ |
| | | if(orderTaxi.getState() != 1 && orderTaxi.getState() != 11 ){ |
| | | return ResultUtil.error("手速有点慢哦,订单已被抢啦!"); |
| | | } |
| | | |
| | | Integer oldDriverId = null; |
| | | if(orderTaxi.getState()==11){ |
| | | oldDriverId= orderTaxi.getDriverId(); |
| | | } |
| | | Driver driver = driverService.selectById(uid); |
| | | orderTaxi.setDriverId(uid); |
| | |
| | | |
| | | //推送相关代码------------------start---------------- |
| | | OrderTaxi finalOrderTaxi = orderTaxi; |
| | | Integer finalOldDriverId = oldDriverId; |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, finalOrderTaxi.getUserId(), finalOrderTaxi.getId(), 2, finalOrderTaxi.getState()); |
| | | pushUtil.pushOrderState(2, finalOrderTaxi.getDriverId(), finalOrderTaxi.getId(), 2, finalOrderTaxi.getState()); |
| | | if(finalOrderTaxi.getType() == 2){ |
| | | pushUtil.pushFerryOrderState(1, finalOrderTaxi.getUserId(), finalOrderTaxi.getId(), 2, 2); |
| | | System.err.println("----------------------------------推送摆渡订单-----------------------------"); |
| | | if(finalOldDriverId !=null){ |
| | | // 推送3个 1推送原司机 2推送新司机 3推送用户 |
| | | pushUtil.pushOrderState(2, finalOrderTaxi.getDriverId(), finalOrderTaxi.getId(), 2, finalOrderTaxi.getState()); |
| | | pushUtil.pushOrderReassign(finalOrderTaxi.getUserId(),1 , finalOrderTaxi.getId(), 2); |
| | | pushUtil.pushOrderReassign(finalOldDriverId,2, finalOrderTaxi.getId(), 2); |
| | | |
| | | }else { |
| | | pushUtil.pushOrderState(1, finalOrderTaxi.getUserId(), finalOrderTaxi.getId(), 2, finalOrderTaxi.getState()); |
| | | pushUtil.pushOrderState(2, finalOrderTaxi.getDriverId(), finalOrderTaxi.getId(), 2, finalOrderTaxi.getState()); |
| | | if(finalOrderTaxi.getType() == 2){ |
| | | pushUtil.pushFerryOrderState(1, finalOrderTaxi.getUserId(), finalOrderTaxi.getId(), 2, 2); |
| | | System.err.println("----------------------------------推送摆渡订单-----------------------------"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | }).start(); |
| | | |