| | |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.OrderUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.QianYunTongConfig; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.ModifyTravelItineraryRequest; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.QYTUserInfo; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.RegisterViaMobile; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.RegisterViaMobileRequest; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.MerchantCouponListWarpper; |
| | | import com.stylefeng.guns.modular.taxi.dao.OrderTaxiMapper; |
| | |
| | | orderCrossCity.setState(10); |
| | | orderCrossCityMapper.updateById(orderCrossCity); |
| | | |
| | | //关闭订单 |
| | | PaymentRecord query = null; |
| | | if (orderCrossCity.getOrderSource() == 4) { |
| | | query = paymentRecordService.query(1, orderCrossCity.getDriverId(), 2, orderId, 3, orderCrossCity.getPayType(), null); |
| | | if (ToolUtil.isEmpty(query)) { |
| | | query = paymentRecordService.query(1, orderCrossCity.getUserId(), 1, orderId, 3, orderCrossCity.getPayType(), null); |
| | | } |
| | | } else { |
| | | query = paymentRecordService.query(1, orderCrossCity.getUserId(), 1, orderId, 3, orderCrossCity.getPayType(), null); |
| | | } |
| | | if(null != query){ |
| | | PayCancelDataRequest payCancelDataRequest = new PayCancelDataRequest(); |
| | | payCancelDataRequest.setPartnerPayId(orderCrossCity.getTravelId()); |
| | | payCancelDataRequest.setPayId(query.getCode()); |
| | | OrderUtil.payCancel(payCancelDataRequest); |
| | | } |
| | | |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(orderId); |
| | | orderCancel.setOrderType(3); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 证联关单 |
| | | * |
| | | * @param payCancelDataRequest |
| | | */ |
| | | public static void payCancel(PayCancelDataRequest payCancelDataRequest) { |
| | | payCancelDataRequest.setPartnerId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "5401007" : "5400004"); |
| | | |
| | | PayCancelRequest request = new PayCancelRequest(); |
| | | request.setRequstType("POST"); |
| | | request.setBusType(1); |
| | | request.setData(payCancelDataRequest); |
| | | |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/payCancel"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> contentMap = new HashMap<String, Object>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUIDUtil.getRandomCode(); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), qianYunTongConfig.getUserName()); |
| | | contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | contentMap.put("content", new Gson().toJson(request)); |
| | | log.info("【证联关单】请求地址:" + url); |
| | | log.info("【证联关单】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【证联关单】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【证联关单】失败:" + jsonObject.getString("retMsg")); |
| | | throw new RuntimeException("【证联关单】失败:" + jsonObject.getString("retMsg")); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String objectRetCode = object.getString("retCode"); |
| | | if (!"000000".equals(objectRetCode)) { |
| | | log.error("【证联关单】失败:" + object.getString("retMsg")); |
| | | throw new RuntimeException("【证联关单】失败:" + object.getString("retMsg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 订单取消 |
| New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 证联关单 - 业务参数 |
| | | * @author zhibing.pu |
| | | * @Date 2026/7/8 |
| | | */ |
| | | @Data |
| | | public class PayCancelDataRequest { |
| | | /** |
| | | * 支付单标识。传行程单ID |
| | | */ |
| | | private String partnerPayId; |
| | | /** |
| | | * 商户号,由支付中心分配 |
| | | */ |
| | | private String partnerId; |
| | | /** |
| | | * 支付单流水号 |
| | | */ |
| | | private String payId; |
| | | } |
| New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 证联关单 - 请求参数 |
| | | * @author zhibing.pu |
| | | * @Date 2026/7/8 |
| | | */ |
| | | @Data |
| | | public class PayCancelRequest { |
| | | /** |
| | | * 默认传POST |
| | | */ |
| | | private String requstType; |
| | | /** |
| | | * 默认传1 |
| | | */ |
| | | private Integer busType; |
| | | /** |
| | | * 业务参数 |
| | | */ |
| | | private PayCancelDataRequest data; |
| | | } |
| | |
| | | Map<String, Object> m = new HashMap<>(); |
| | | QianYunTongConfig qianYunTongConfig1 = qianYunTongConfig.getQianYunTongConfig(); |
| | | try { |
| | | String fileSuffix = ToolUtil.getFileSuffix(myfile.getOriginalFilename()); |
| | | //判断文件格式为图片 |
| | | if (!fileSuffix.equals("apk")) { |
| | | throw new RuntimeException("文件格式不正确"); |
| | | } |
| | | String pictureName = UUID.randomUUID().toString() + "." + ToolUtil.getFileSuffix(myfile.getOriginalFilename()); |
| | | String bucketName = qianYunTongConfig1.getBucketName(); |
| | | Bucket grjyTest = NCOSSUtil.getBucketInfo(bucketName); |
| | |
| | | model.addAttribute("locationList",locationList); |
| | | model.addAttribute("disabled","disabled"); |
| | | |
| | | Integer type = itLocationService.selectList(new EntityWrapper<TLocation>().eq("siteId", tSite.getId())).get(0).getType(); |
| | | List<TLocation> siteId = itLocationService.selectList(new EntityWrapper<TLocation>().eq("siteId", tSite.getId())); |
| | | Integer type = 1; |
| | | if(null != siteId && siteId.size() > 0){ |
| | | type = siteId.get(0).getType(); |
| | | } |
| | | model.addAttribute("type1", type == 1 ? "block" : "none"); |
| | | model.addAttribute("type2", type == 1 ? "none" : "block"); |
| | | model.addAttribute("checked1", type == 1 ? "checked" : ""); |
| | |
| | | String callback = request.getParameter("callback"); |
| | | QianYunTongConfig qianYunTongConfig1 = qianYunTongConfig.getQianYunTongConfig(); |
| | | try { |
| | | String fileSuffix = ToolUtil.getFileSuffix(picture.getOriginalFilename()); |
| | | //判断文件格式为图片 |
| | | if (!fileSuffix.equals("jpg") && !fileSuffix.equals("jpeg") && !fileSuffix.equals("png") && !fileSuffix.equals("gif")) { |
| | | throw new RuntimeException("文件格式不正确"); |
| | | } |
| | | String pictureName = UUID.randomUUID().toString() + "." + ToolUtil.getFileSuffix(picture.getOriginalFilename()); |
| | | String bucketName = qianYunTongConfig1.getBucketName(); |
| | | Bucket grjyTest = NCOSSUtil.getBucketInfo(bucketName); |
| | |
| | | MultipartFile file = (MultipartFile) multipartRequest.getFile("myfile"); |
| | | QianYunTongConfig qianYunTongConfig1 = qianYunTongConfig.getQianYunTongConfig(); |
| | | if (file.getSize() != 0) { |
| | | String fileSuffix = ToolUtil.getFileSuffix(file.getOriginalFilename()); |
| | | //判断文件格式为图片 |
| | | if (!fileSuffix.equals("jpg") && !fileSuffix.equals("jpeg") && !fileSuffix.equals("png") && !fileSuffix.equals("gif")) { |
| | | throw new RuntimeException("文件格式不正确"); |
| | | } |
| | | |
| | | String pictureName = UUID.randomUUID().toString() + "." + ToolUtil.getFileSuffix(file.getOriginalFilename()); |
| | | String bucketName = qianYunTongConfig1.getBucketName(); |
| | | Bucket grjyTest = NCOSSUtil.getBucketInfo(bucketName); |
| | |
| | | */ |
| | | @RequestMapping("/file") |
| | | public String file(@RequestPart("file") MultipartFile picture) { |
| | | String fileSuffix = ToolUtil.getFileSuffix(picture.getOriginalFilename()); |
| | | //判断文件格式为图片 |
| | | if (!fileSuffix.equals("jpg") && !fileSuffix.equals("jpeg") && !fileSuffix.equals("png") && !fileSuffix.equals("gif")) { |
| | | throw new RuntimeException("文件格式不正确"); |
| | | } |
| | | //获取文件名后缀 |
| | | String suffix = picture.getOriginalFilename().substring(picture.getOriginalFilename().lastIndexOf(".")); |
| | | String pictureName = UUID.randomUUID().toString() + suffix; |
| | |
| | | public String imageUp(@RequestPart("upfile") MultipartFile picture, HttpServletRequest request) { |
| | | String callback = request.getParameter("callback"); |
| | | try { |
| | | String fileSuffix = ToolUtil.getFileSuffix(picture.getOriginalFilename()); |
| | | //判断文件格式为图片 |
| | | if (!fileSuffix.equals("jpg") && !fileSuffix.equals("jpeg") && !fileSuffix.equals("png") && !fileSuffix.equals("gif")) { |
| | | throw new RuntimeException("文件格式不正确"); |
| | | } |
| | | // 上传文件目录 |
| | | String pictureName = UUID.randomUUID().toString() + "." + ToolUtil.getFileSuffix(picture.getOriginalFilename()); |
| | | QianYunTongConfig qianYunTongConfig1 = qianYunTongConfig.getQianYunTongConfig(); |
| | |
| | | } |
| | | //创建订单并拉起支付(这里不需要创建行程单,由三方处理) |
| | | Driver driver = driverService.selectById(orderCrossCity.getDriverId()); |
| | | if(null == orderCrossCity.getIsCreated() || 0 == orderCrossCity.getIsCreated()){ |
| | | String payId = ""; |
| | | if(null == orderCrossCity.getIsCreated() || 0 == orderCrossCity.getIsCreated()){ |
| | | //调用中台创建订单及拉起支付接口 |
| | | TradeOrderCreateData tradeOrderCreateData = new TradeOrderCreateData(); |
| | | tradeOrderCreateData.setTreatShopId(driver.getEmpId().toString()); |
| | |
| | | orderCrossCity.setIsCreated(1); |
| | | orderCrossCity.setTravelId(tradeOrderCreate.getOrderInfo().getOrderId()); |
| | | resultUtil = ResultUtil.success(payInfo.getData().getRedirectUrl()); |
| | | }else{ |
| | | payId = payInfo.getData().getPayId(); |
| | | }else{ |
| | | //拉起支付 |
| | | TradePayOff1Data tradePayOff1Data = new TradePayOff1Data(); |
| | | tradePayOff1Data.setPartnerPayId(orderCrossCity.getTravelId()); |
| | |
| | | return ResultUtil.error(payInfo.getRetMsg()); |
| | | } |
| | | resultUtil = ResultUtil.success(payInfo.getData().getRedirectUrl()); |
| | | payId = payInfo.getData().getPayId(); |
| | | } |
| | | this.updateById(orderCrossCity); |
| | | paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, orderId, 3, 1, orderMoney, "", 1);//添加预支付数据 |
| | | paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, orderId, 3, 1, orderMoney, payId, 1);//添加预支付数据 |
| | | |
| | | //创建定时任务查询订单支付状态 |
| | | ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | |
| | | if("1".equals(status) || "2".equals(status)){ |
| | | PaymentRecord query = paymentRecordService.query(1, null, null, id, 3, null, null); |
| | | payOrderCrossCityCallback(orderCrossCity.getId(), getPaymentInfo1.getPayId(), query.getPayType(), null); |
| | | } |
| | | }else{ |
| | | //关闭订单 |
| | | PaymentRecord query = null; |
| | | if (orderCrossCity.getOrderSource() == 4) { |
| | | query = paymentRecordService.query(1, orderCrossCity.getDriverId(), 2, id, 3, orderCrossCity.getPayType(), null); |
| | | if (ToolUtil.isEmpty(query)) { |
| | | query = paymentRecordService.query(1, orderCrossCity.getUserId(), 1, id, 3, orderCrossCity.getPayType(), null); |
| | | } |
| | | } else { |
| | | query = paymentRecordService.query(1, orderCrossCity.getUserId(), 1, id, 3, orderCrossCity.getPayType(), null); |
| | | } |
| | | if(null != query){ |
| | | PayCancelDataRequest payCancelDataRequest = new PayCancelDataRequest(); |
| | | payCancelDataRequest.setPartnerPayId(orderCrossCity.getTravelId()); |
| | | payCancelDataRequest.setPayId(query.getCode()); |
| | | OrderUtil.payCancel(payCancelDataRequest); |
| | | } |
| | | } |
| | | } |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(orderCrossCity.getUserId()); |
| | |
| | | if(ToolUtil.isEmpty(userInfo.getAppletsOpenId())){ |
| | | return ResultUtil.error("获取微信身份信息失败,无法发起支付"); |
| | | } |
| | | String payId = ""; |
| | | if(null == orderRide.getIsCreated() || 0 == orderRide.getIsCreated()){ |
| | | //调用中台创建订单及拉起支付接口 |
| | | TradeOrderCreateData tradeOrderCreateData = new TradeOrderCreateData(); |
| | |
| | | orderRide.setIsCreated(1); |
| | | orderRide.setZttravelId(tradeOrderCreate.getOrderInfo().getOrderId()); |
| | | info = payInfo.getData().getRedirectUrl(); |
| | | payId = payInfo.getData().getPayId(); |
| | | }else{ |
| | | //拉起支付 |
| | | TradePayOff1Data tradePayOff1Data = new TradePayOff1Data(); |
| | |
| | | return ResultUtil.error(payInfo.getRetMsg()); |
| | | } |
| | | info = payInfo.getData().getRedirectUrl(); |
| | | payId = payInfo.getData().getPayId(); |
| | | } |
| | | orderRideService.updateById(orderRide); |
| | | |
| | |
| | | OrderUtil.modifyTravelItinerary(request1); |
| | | } |
| | | |
| | | |
| | | String payId = ""; |
| | | if(null == orderPrivateCar.getIsCreated() || 0 == orderPrivateCar.getIsCreated()){ |
| | | //调用中台创建订单及拉起支付接口 |
| | | TradeOrderCreateData tradeOrderCreateData = new TradeOrderCreateData(); |
| | |
| | | } |
| | | orderPrivateCar.setIsCreated(1); |
| | | resultUtil = ResultUtil.success(payInfo.getData().getRedirectUrl()); |
| | | payId = payInfo.getData().getPayId(); |
| | | }else{ |
| | | //查询支付信息 |
| | | GetPaymentInfoDataRequest getPaymentInfoDataRequest = new GetPaymentInfoDataRequest(); |
| | |
| | | return ResultUtil.error(payInfo.getRetMsg()); |
| | | } |
| | | resultUtil = ResultUtil.success(payInfo.getData().getRedirectUrl()); |
| | | payId = payInfo.getData().getPayId(); |
| | | } |
| | | paymentRecordService.saveData(1, orderPrivateCar.getUserId(), 1, orderId, 1, 1, orderMoney, "", 1);//添加预支付数据 |
| | | paymentRecordService.saveData(1, orderPrivateCar.getUserId(), 1, orderId, 1, 1, orderMoney, payId, 1);//添加预支付数据 |
| | | |
| | | //创建定时任务查询订单支付状态 |
| | | ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | |
| | | |
| | | |
| | | /** |
| | | * 证联关单 |
| | | * |
| | | * @param payCancelDataRequest |
| | | */ |
| | | public static void payCancel(PayCancelDataRequest payCancelDataRequest) { |
| | | payCancelDataRequest.setPartnerId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "5401007" : "5400004"); |
| | | |
| | | PayCancelRequest request = new PayCancelRequest(); |
| | | request.setRequstType("POST"); |
| | | request.setBusType(1); |
| | | request.setData(payCancelDataRequest); |
| | | |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/payCancel"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> contentMap = new HashMap<String, Object>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUIDUtil.getRandomCode(); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), qianYunTongConfig.getUserName()); |
| | | contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | contentMap.put("content", new Gson().toJson(request)); |
| | | log.info("【证联关单】请求地址:" + url); |
| | | log.info("【证联关单】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【证联关单】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【证联关单】失败:" + jsonObject.getString("retMsg")); |
| | | throw new RuntimeException("【证联关单】失败:" + jsonObject.getString("retMsg")); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String objectRetCode = object.getString("retCode"); |
| | | if (!"000000".equals(objectRetCode)) { |
| | | log.error("【证联关单】失败:" + object.getString("retMsg")); |
| | | throw new RuntimeException("【证联关单】失败:" + object.getString("retMsg")); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 订单取消 |
| | | * @param orderId |
| | | */ |
| New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 证联关单 - 业务参数 |
| | | * @author zhibing.pu |
| | | * @Date 2026/7/8 |
| | | */ |
| | | @Data |
| | | public class PayCancelDataRequest { |
| | | /** |
| | | * 支付单标识。传行程单ID |
| | | */ |
| | | private String partnerPayId; |
| | | /** |
| | | * 商户号,由支付中心分配 |
| | | */ |
| | | private String partnerId; |
| | | /** |
| | | * 支付单流水号 |
| | | */ |
| | | private String payId; |
| | | } |
| New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 证联关单 - 请求参数 |
| | | * @author zhibing.pu |
| | | * @Date 2026/7/8 |
| | | */ |
| | | @Data |
| | | public class PayCancelRequest { |
| | | /** |
| | | * 默认传POST |
| | | */ |
| | | private String requstType; |
| | | /** |
| | | * 默认传1 |
| | | */ |
| | | private Integer busType; |
| | | /** |
| | | * 业务参数 |
| | | */ |
| | | private PayCancelDataRequest data; |
| | | } |
| | |
| | | OrderUtil.modifyTravelItinerary(request1); |
| | | } |
| | | |
| | | |
| | | String payId = ""; |
| | | if(null == orderTaxi.getIsCreated() || 0 == orderTaxi.getIsCreated()){ |
| | | //调用中台创建订单及拉起支付接口 |
| | | TradeOrderCreateData tradeOrderCreateData = new TradeOrderCreateData(); |
| | |
| | | } |
| | | orderTaxi.setIsCreated(1); |
| | | resultUtil = ResultUtil.success(payInfo.getData().getRedirectUrl()); |
| | | payId = payInfo.getData().getPayId(); |
| | | }else{ |
| | | //拉起支付 |
| | | TradePayOff1Data tradePayOff1Data = new TradePayOff1Data(); |
| | |
| | | return ResultUtil.error(payInfo.getRetMsg()); |
| | | } |
| | | resultUtil = ResultUtil.success(payInfo.getData().getRedirectUrl()); |
| | | payId = payInfo.getData().getPayId(); |
| | | } |
| | | |
| | | paymentRecordService.saveData(1, orderTaxi.getUserId(), 1, orderId, 2, 1, orderMoney, "", 1);//添加预支付数据 |
| | | paymentRecordService.saveData(1, orderTaxi.getUserId(), 1, orderId, 2, 1, orderMoney, payId, 1);//添加预支付数据 |
| | | } |
| | | if (payType == 2) {//支付宝支付 |
| | | if (orderMoney == 0) { |