package com.stylefeng.guns.modular.api;
|
|
import com.stylefeng.guns.modular.system.service.ITaxiCardService;
|
import com.stylefeng.guns.modular.system.service.IUserInfoService;
|
import com.stylefeng.guns.modular.system.util.ResultUtil;
|
import com.stylefeng.guns.modular.system.warpper.TaxiCardWapper;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.servlet.http.HttpServletRequest;
|
import java.util.List;
|
|
/**
|
* 打车卡
|
* @author pzb
|
* @Date 2022/1/28 11:34
|
*/
|
@RestController
|
@RequestMapping("/api/taxiCard")
|
public class TaxiCardController {
|
|
@Autowired
|
private ITaxiCardService taxiCardService;
|
|
@Autowired
|
private IUserInfoService userInfoService;
|
|
|
|
|
|
@ResponseBody
|
@PostMapping("/getTaxiCardList")
|
@ApiOperation(value = "1.0-获取购买打车卡列表", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-小件物流"})
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "订单类型(1=专车/快车,2=出租车,3=机场专线,7=景区直通车,8=公务出行)", name = "orderType", required = true, dataType = "int"),
|
@ApiImplicitParam(value = "当前定位经度", name = "lon", required = true, dataType = "string"),
|
@ApiImplicitParam(value = "当前定位纬度", name = "lat", required = true, dataType = "string"),
|
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
|
})
|
public ResultUtil<List<TaxiCardWapper>> getTaxiCardList(Integer orderType, String lon, String lat, HttpServletRequest request){
|
try {
|
Integer uid = userInfoService.getUserIdFormRedis(request);
|
if(null == uid){
|
return ResultUtil.tokenErr();
|
}
|
return taxiCardService.getTaxiCardList(uid, orderType, lon, lat);
|
}catch (Exception e){
|
e.printStackTrace();
|
return ResultUtil.runErr();
|
}
|
}
|
|
|
|
@ResponseBody
|
@PostMapping("/getTaxiCardInfo")
|
@ApiOperation(value = "1.0-获取打车卡详情", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-小件物流"})
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "打车卡id", name = "id", required = true, dataType = "int"),
|
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
|
})
|
public ResultUtil<TaxiCardWapper> getTaxiCardInfo(Integer id){
|
try {
|
TaxiCardWapper taxiCardInfo = taxiCardService.getTaxiCardInfo(id);
|
return ResultUtil.success(taxiCardInfo);
|
}catch (Exception e){
|
e.printStackTrace();
|
return ResultUtil.runErr();
|
}
|
}
|
|
@ResponseBody
|
@PostMapping("/payTaxiCard")
|
@ApiOperation(value = "1.0-购买出行卡", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-小件物流"})
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "打车卡id", name = "id", required = true, dataType = "int"),
|
@ApiImplicitParam(value = "支付方式(1=微信,2=支付宝,3=其他)", name = "payType", required = true, dataType = "int"),
|
@ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = true, dataType = "int"),
|
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
|
})
|
public ResultUtil payTaxiCard(Integer id, Integer payType, Integer type, HttpServletRequest request){
|
try {
|
Integer uid = userInfoService.getUserIdFormRedis(request);
|
if(null == uid){
|
return ResultUtil.tokenErr();
|
}
|
return taxiCardService.payTaxiCard(uid, id, payType, type);
|
}catch (Exception e){
|
e.printStackTrace();
|
return ResultUtil.runErr();
|
}
|
}
|
|
|
|
|
@ResponseBody
|
@PostMapping("/getMyTaxiCardList")
|
@ApiOperation(value = "1.0-获取我的出行卡列表", tags = {"用户端-个人中心"})
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "订单类型(1=专车/快车,2=出租车,3=机场专线,7=景区直通车,8=公务出行)", name = "orderType", required = true, dataType = "int"),
|
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
|
})
|
public ResultUtil<List<TaxiCardWapper>> getMyTaxiCardList(Integer orderType, HttpServletRequest request){
|
try {
|
Integer uid = userInfoService.getUserIdFormRedis(request);
|
if(null == uid){
|
return ResultUtil.tokenErr();
|
}
|
List<TaxiCardWapper> myTaxiCardList = taxiCardService.getMyTaxiCardList(uid, orderType);
|
return ResultUtil.success(myTaxiCardList);
|
}catch (Exception e){
|
e.printStackTrace();
|
return ResultUtil.runErr();
|
}
|
}
|
|
|
@ResponseBody
|
@PostMapping("/getMyTaxiCardInfo")
|
@ApiOperation(value = "1.0-获取我的出行卡详情", tags = {"用户端-个人中心"})
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "出行卡id", name = "id", required = true, dataType = "int"),
|
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
|
})
|
public ResultUtil<TaxiCardWapper> getMyTaxiCardInfo(Integer id){
|
try {
|
TaxiCardWapper myTaxiCardInfo = taxiCardService.getMyTaxiCardInfo(id);
|
return ResultUtil.success(myTaxiCardInfo);
|
}catch (Exception e){
|
e.printStackTrace();
|
return ResultUtil.runErr();
|
}
|
}
|
}
|