| | |
| | | import org.jsoup.nodes.Element; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.File; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IBankCardService bankCardService; |
| | | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | @Value("${spring.mail.template-path}") |
| | | private String templatePath; |
| | |
| | | if(phone.indexOf("233") < 0){ |
| | | phone = "233" + phone; |
| | | } |
| | | switch (phoneOperator){ |
| | | case "MTN": |
| | | phoneOperator = "GH-MTN-B2C"; |
| | | break; |
| | | case "TIGO": |
| | | phoneOperator = "GH-TIGO-B2C"; |
| | | break; |
| | | case "VODAFONE": |
| | | phoneOperator = "GH-VODAFONE-B2C"; |
| | | break; |
| | | case "AIRTEL": |
| | | phoneOperator = "GH-AIRTEL-B2C"; |
| | | break; |
| | | } |
| | | return userInfoService.captchaLogin(phoneOperator, phone, code, registIp, lat, lng,null,null,null,language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | if(phone.indexOf("233") < 0){ |
| | | phone = "233" + phone; |
| | | } |
| | | switch (phoneOperator){ |
| | | case "MTN": |
| | | phoneOperator = "GH-MTN-B2C"; |
| | | break; |
| | | case "TIGO": |
| | | phoneOperator = "GH-TIGO-B2C"; |
| | | break; |
| | | case "VODAFONE": |
| | | phoneOperator = "GH-VODAFONE-B2C"; |
| | | break; |
| | | case "AIRTEL": |
| | | phoneOperator = "GH-AIRTEL-B2C"; |
| | | break; |
| | | } |
| | | return userInfoService.captchaLogin(phoneOperator, phone, code, uid, type, userType, language); |
| | | }catch (Exception e){ |
| | |
| | | } |
| | | if(phone.indexOf("233") < 0){ |
| | | phone = "233" + phone; |
| | | } |
| | | switch (phoneOperator){ |
| | | case "MTN": |
| | | phoneOperator = "GH-MTN-B2C"; |
| | | break; |
| | | case "TIGO": |
| | | phoneOperator = "GH-TIGO-B2C"; |
| | | break; |
| | | case "VODAFONE": |
| | | phoneOperator = "GH-VODAFONE-B2C"; |
| | | break; |
| | | case "AIRTEL": |
| | | phoneOperator = "GH-AIRTEL-B2C"; |
| | | break; |
| | | } |
| | | return userInfoService.bindingPhone(uid, phoneOperator, phone, code, language); |
| | | }catch (Exception e){ |
| | |
| | | } |
| | | if(phone.indexOf("233") < 0){ |
| | | phone = "233" + phone; |
| | | } |
| | | switch (phoneOperator){ |
| | | case "MTN": |
| | | phoneOperator = "GH-MTN-B2C"; |
| | | break; |
| | | case "TIGO": |
| | | phoneOperator = "GH-TIGO-B2C"; |
| | | break; |
| | | case "VODAFONE": |
| | | phoneOperator = "GH-VODAFONE-B2C"; |
| | | break; |
| | | case "AIRTEL": |
| | | phoneOperator = "GH-AIRTEL-B2C"; |
| | | break; |
| | | } |
| | | return userInfoService.updatePhone(code, phoneOperator, phone, uid, language); |
| | | }catch (Exception e){ |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/user/queryOrderLicensePlate") |
| | | @ApiOperation(value = "获取报失也车牌等信息", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城出行,4=同城小件物流,5=跨城小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil queryOrderLicensePlate(Integer orderType, Integer orderId){ |
| | | try { |
| | | Map<String, Object> map = orderService.queryOrderLicensePlate(orderType, orderId); |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("/base/user/image") |
| | | public String image(@RequestPart("file") MultipartFile file) { |
| | | try { |
| | | String pictureName = OBSUploadUtil.inputStreamUpload(file); |
| | | return pictureName; |
| | | } catch (IOException e1) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/user/queryBankCardList") |
| | | @ApiOperation(value = "获取银行卡列表【1.1】", tags = {"用户端-个人中心"}, notes = "") |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 下载pdf |
| | | * @param orderId |
| | | * @param orderType |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/base/order/uploadReceiptPdf") |
| | | public void uploadReceiptPdf(Integer orderId, Integer orderType, HttpServletResponse response){ |
| | | FileInputStream fileInputStream = null; |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | if(orderType == 1){ |
| | | fileInputStream = new FileInputStream(new File("/usr/local/nginx/html/files/pdf/ride_receipt_" + orderId + ".pdf")); |
| | | } |
| | | if(orderType == 4){ |
| | | fileInputStream = new FileInputStream(new File("/usr/local/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf")); |
| | | } |
| | | BufferedInputStream bf = new BufferedInputStream(fileInputStream); |
| | | outputStream = response.getOutputStream(); |
| | | response.setContentType(MediaType.APPLICATION_PDF_VALUE); |
| | | response.setHeader("content-Disposition","attachment;filename=" + (orderId + "_" + orderType + ".pdf")); |
| | | byte[] b = new byte[bf.available() + 1000]; |
| | | int i; |
| | | while((i=bf.read(b))!=-1){ |
| | | outputStream.write(b,0, i); |
| | | } |
| | | outputStream.flush(); |
| | | outputStream.close(); |
| | | fileInputStream.close(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | }finally { |
| | | try { |
| | | if(null != outputStream){ |
| | | outputStream.close(); |
| | | } |
| | | if(null != fileInputStream){ |
| | | fileInputStream.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |