| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.google.api.client.http.UrlEncodedParser; |
| | | import com.stylefeng.guns.core.util.MD5Util; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.CharteredCar.server.IOrderCharteredCarService; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.OrderPosition; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.dao.UserActivityDiscount1Mapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.*; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import com.stylefeng.guns.modular.taxi.model.TransactionDetails; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang.StringEscapeUtils; |
| | | import org.apache.http.client.utils.URLEncodedUtils; |
| | | import org.bouncycastle.util.encoders.UrlBase64Encoder; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.URLDecoder; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class OrderController { |
| | | |
| | | private Logger log = LoggerFactory.getLogger(OrderController.class); |
| | | |
| | | @Autowired |
| | | private IOrderTaxiService orderTaxiService; |
| | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | /*@Autowired |
| | | private ICBCPayUtil icbcPayUtil;*/ |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | |
| | | @Autowired |
| | | private IPaymentRecordService paymentRecordService; |
| | | |
| | | @Autowired |
| | | private IOrderCancelService orderCancelService; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private IRedEnvelopePaymentSettingsService redEnvelopePaymentSettingsService; |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | @Autowired |
| | | private IUserRedPacketRecordService userRedPacketRecordService; |
| | | |
| | | @Resource |
| | | private UserActivityDiscount1Mapper userActivityDiscount1Mapper; |
| | | |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取正在进行中的订单 |
| | | * 获取正在sudo rm -rf的订单 |
| | | * @param request |
| | | * @return |
| | | */ |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<OrderStatusWarpper>> queryServingOrder(HttpServletRequest request){ |
| | | public ResultUtil<List<OrderStatusWarpper>> queryServingOrder(Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | userInfo.setLanguage(language); |
| | | userInfoService.updateById(userInfo); |
| | | List<OrderStatusWarpper> data = new ArrayList<>(); |
| | | List<OrderPrivateCar> orderPrivateCars = orderPrivateCarService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12); |
| | | for(OrderPrivateCar orderPrivateCar : orderPrivateCars){ |
| | |
| | | orderStatusWarpper.setOrderId(orderPrivateCar.getId()); |
| | | orderStatusWarpper.setOrderType(1); |
| | | orderStatusWarpper.setState(orderPrivateCar.getState()); |
| | | orderStatusWarpper.setTripId(orderPrivateCar.getTripId()); |
| | | data.add(orderStatusWarpper); |
| | | } |
| | | List<OrderTaxi> list = orderTaxiService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12); |
| | |
| | | orderStatusWarpper.setOrderId(orderTaxi.getId()); |
| | | orderStatusWarpper.setOrderType(2); |
| | | orderStatusWarpper.setState(orderTaxi.getState()); |
| | | // orderStatusWarpper.setTripId(orderTaxi.getTripId()); |
| | | data.add(orderStatusWarpper); |
| | | } |
| | | List<OrderCrossCity> orderCrossCities = orderCrossCityService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12); |
| | |
| | | orderStatusWarpper.setOrderId(orderCrossCity.getId()); |
| | | orderStatusWarpper.setOrderType(3); |
| | | orderStatusWarpper.setState(orderCrossCity.getState()); |
| | | // orderStatusWarpper.setTripId(orderPrivateCar.getTripId()); |
| | | data.add(orderStatusWarpper); |
| | | } |
| | | List<OrderLogistics> orderLogistics = orderLogisticsService.selectList(new EntityWrapper<OrderLogistics>().eq("userId", uid) |
| | | .in("state", Arrays.asList(1, 2, 3, 4, 5, 6, 7, 11, 12)).eq("isDelete", 1)); |
| | | for(OrderLogistics orderLogistics1 : orderLogistics){ |
| | | if(orderLogistics1.getState() == 11){ |
| | | orderLogistics1.setState(orderLogistics1.getOldState()); |
| | | } |
| | | OrderStatusWarpper orderStatusWarpper = new OrderStatusWarpper(); |
| | | orderStatusWarpper.setOrderId(orderLogistics1.getId()); |
| | | orderStatusWarpper.setOrderType(4); |
| | | orderStatusWarpper.setState(orderLogistics1.getState()); |
| | | orderStatusWarpper.setTripId(orderLogistics1.getTripId()); |
| | | data.add(orderStatusWarpper); |
| | | } |
| | | return ResultUtil.success(data); |
| | |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<OrderWarpper>> queryMyOrderList(Integer type, Integer pageNum, Integer size, HttpServletRequest request){ |
| | | public ResultUtil<List<OrderWarpper>> queryMyOrderList(Integer type, Integer pageNum, Integer size, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | userInfo.setLanguage(language); |
| | | userInfoService.updateById(userInfo); |
| | | List<Map<String, Object>> list = null; |
| | | switch (type){ |
| | | case 1: |
| | | list = orderPrivateCarService.queryMyOrderList(uid, pageNum, size); |
| | | list = orderPrivateCarService.queryMyOrderList(language, uid, pageNum, size); |
| | | break; |
| | | case 2: |
| | | list = orderTaxiService.queryMyOrderList(uid, pageNum, size); |
| | | list = orderTaxiService.queryMyOrderList(language, uid, pageNum, size); |
| | | break; |
| | | case 3: |
| | | list = orderCrossCityService.queryMyOrderList(uid, pageNum, size); |
| | | list = orderCrossCityService.queryMyOrderList(language, uid, pageNum, size); |
| | | break; |
| | | case 4: |
| | | list = orderLogisticsService.queryMyOrderList(uid, pageNum, size); |
| | | list = orderLogisticsService.queryMyOrderList(uid, pageNum, size, language); |
| | | break; |
| | | case 5: |
| | | list = orderCharteredCarService.queryMyOrderList(uid, pageNum, size); |
| | | list = orderCharteredCarService.queryMyOrderList(language, uid, pageNum, size); |
| | | break; |
| | | } |
| | | return ResultUtil.success(OrderWarpper.getOrderWarpper(list)); |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryMyTravelRecord") |
| | | @ApiOperation(value = "获取消费记录", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "获取消费记录【2.0】", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码(首页1)", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<TravelRecordWarpper>> queryMyTravelRecord(Integer pageNum, Integer size, Integer language, HttpServletRequest request){ |
| | | public ResultUtil<List<TravelRecordListWarpper>> queryMyTravelRecord(Integer pageNum, Integer size, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | String name = language == 1 ? "专车订单" : language == 2 ? "Private car order" : "Commande de voiture exclusive"; |
| | | String name = language == 1 ? "打车" : language == 2 ? "Ride" : "Course"; |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> maps = orderCancelService.queryCancel(uid, 2); |
| | | List<Map<String, Object>> maps = orderCancelService.queryCancel(language, uid, 2); |
| | | for (Map<String, Object> map : maps) { |
| | | Integer orderType = Integer.valueOf(map.get("orderType").toString()); |
| | | if(1 == orderType){ |
| | | map.put("name", language == 1 ? "专车订单取消" : language == 2 ? "Private car order cancelled" : "Annulation de commande de voiture exclusive"); |
| | | map.put("name", language == 1 ? "打车订单取消" : language == 2 ? "Ride order cancelled" : "Commande de course annulée"); |
| | | } |
| | | if(4 == orderType){ |
| | | map.put("name", language == 1 ? "市内小件物流订单取消" : language == 2 ? "The small parts logistics order in the city has been cancelled" : "Annulation de commande pour la logistique de petites pièces dans la ville"); |
| | | map.put("name", language == 1 ? "包裹订单取消" : language == 2 ? "Delivery order cancelled" : "Commande de livraison annulée"); |
| | | } |
| | | } |
| | | List<Map<String, Object>> list = orderPrivateCarService.queryMyTravelRecord(uid);//专车 |
| | | List<Map<String, Object>> list = orderPrivateCarService.queryMyTravelRecord(language, uid);//专车 |
| | | for (Map<String, Object> map : list) { |
| | | map.put("name", name); |
| | | } |
| | | name = language == 1 ? "市内小件物流" : language == 2 ? "Small parts logistics in the city" : "Logistique de petites pièces dans la ville"; |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryMyTravelRecord(uid);//小件物流 |
| | | name = language == 1 ? "包裹" : language == 2 ? "Delivery" : "Livraison"; |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryMyTravelRecord(language, uid);//小件物流 |
| | | for (Map<String, Object> map : list3) { |
| | | map.put("name", name); |
| | | } |
| | | List<TransactionDetails> transactionDetails = transactionDetailsService.selectList(new EntityWrapper<TransactionDetails>().eq("state", 1) |
| | | .eq("type", 1).eq("userType", 1).eq("userId", uid).eq("orderType", 3).like("remark", "%跨城订单取消退款%")); |
| | | List<Map<String, Object>> list4 = new ArrayList<>(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | for(TransactionDetails transactionDetails1 : transactionDetails){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("money", transactionDetails1.getMoney()); |
| | | map.put("time", sdf.format(transactionDetails1.getInsertTime())); |
| | | map.put("name", "跨城订单取消退款"); |
| | | map.put("insertTime", Double.valueOf(transactionDetails1.getInsertTime().getTime() / 1000).intValue()); |
| | | list4.add(map); |
| | | } |
| | | // List<TransactionDetails> transactionDetails = transactionDetailsService.selectList(new EntityWrapper<TransactionDetails>().eq("state", 1) |
| | | // .eq("type", 1).eq("userType", 1).eq("userId", uid).eq("orderType", 3).like("remark", "%跨城订单取消退款%")); |
| | | // List<Map<String, Object>> list4 = new ArrayList<>(); |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | // for(TransactionDetails transactionDetails1 : transactionDetails){ |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("money", transactionDetails1.getMoney()); |
| | | // map.put("time", DateUtil.conversionFormat(language, sdf.format(transactionDetails1.getInsertTime()))); |
| | | // map.put("name", "跨城订单取消退款"); |
| | | // map.put("insertTime", Double.valueOf(transactionDetails1.getInsertTime().getTime() / 1000).intValue()); |
| | | // list4.add(map); |
| | | // } |
| | | list.addAll(maps); |
| | | // list.addAll(list1); |
| | | // list.addAll(list2); |
| | | list.addAll(list3); |
| | | // list.addAll(list4); |
| | | |
| | | List<TravelRecordWarpper> orderWarpper = TravelRecordWarpper.getTravelRecordWarpper(list); |
| | | |
| | | List<TravelRecordListWarpper> orderWarpper = TravelRecordListWarpper.getTravelRecordWarpper(list); |
| | | |
| | | double sum = orderWarpper.stream().mapToDouble(TravelRecordListWarpper::getMoney).sum(); |
| | | |
| | | //分页 |
| | | if(orderWarpper.size() >= (pageNum + 1) * size){ |
| | | orderWarpper = orderWarpper.subList(pageNum, pageNum + size); |
| | |
| | | }else{ |
| | | orderWarpper = new ArrayList<>(); |
| | | } |
| | | orderWarpper.forEach(s->{ |
| | | s.setTotal(sum); |
| | | }); |
| | | return ResultUtil.success(orderWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<OrderWarpper>> queryInvoiceOrder(Integer type, Integer orderType, Date startTime, |
| | | public ResultUtil<List<OrderWarpper>> queryInvoiceOrder(Integer language, Integer type, Integer orderType, Date startTime, |
| | | Date endTime, Double startMoney, Double endMoney, |
| | | Integer pageNum, Integer size, HttpServletRequest request){ |
| | | pageNum = (pageNum - 1) * size; |
| | |
| | | if(null != orderType){ |
| | | switch (orderType){ |
| | | case 1://专车 |
| | | list = orderPrivateCarService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | list = orderPrivateCarService.queryInvoiceOrder(language, type, startTime, endTime, startMoney, endMoney, uid); |
| | | break; |
| | | // case 2://出租车 |
| | | // list = orderTaxiService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | |
| | | // list = orderCrossCityService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | // break; |
| | | case 4://同城小件物流 |
| | | list = orderLogisticsService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); |
| | | list = orderLogisticsService.queryInvoiceOrder(language, type, startTime, endTime, startMoney, endMoney, uid, orderType); |
| | | break; |
| | | // case 5://跨城小件物流 |
| | | // list = orderLogisticsService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); |
| | |
| | | } |
| | | }else{ |
| | | //专车 |
| | | List<Map<String, Object>> maps = orderPrivateCarService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | List<Map<String, Object>> maps = orderPrivateCarService.queryInvoiceOrder(language, type, startTime, endTime, startMoney, endMoney, uid); |
| | | list.addAll(maps); |
| | | // //出租车 |
| | | // List<Map<String, Object>> list1 = orderTaxiService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | |
| | | // List<Map<String, Object>> list2 = orderCrossCityService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | // list.addAll(list2); |
| | | //同城小件物流 |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryInvoiceOrder(language, type, startTime, endTime, startMoney, endMoney, uid, orderType); |
| | | list.addAll(list3); |
| | | // //跨城小件物流 |
| | | // List<Map<String, Object>> list4 = orderLogisticsService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryOrderInfo") |
| | | @ApiOperation(value = "获取服务中的详情数据【1.0】", tags = {"用户端-服务中"}, notes = "") |
| | | @ApiOperation(value = "获取服务中的详情数据【2.0】", tags = {"用户端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=同城小件,5=跨城小件)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<OrderInfoWarpper> queryOrderInfo(Integer orderId, Integer orderType){ |
| | | public ResultUtil<OrderInfoWarpper> queryOrderInfo(Integer orderId, Integer orderType, Integer language){ |
| | | try { |
| | | Map<String, Object> map = null; |
| | | switch (orderType){ |
| | | case 1://专车 |
| | | map = orderPrivateCarService.queryOrderInfo(orderId); |
| | | map = orderPrivateCarService.queryOrderInfo(language, orderId); |
| | | break; |
| | | case 2://出租车 |
| | | map = orderTaxiService.queryOrderInfo(orderId); |
| | | map = orderTaxiService.queryOrderInfo(language, orderId); |
| | | break; |
| | | case 3://跨城 |
| | | map = orderCrossCityService.queryOrderInfo(orderId); |
| | | map = orderCrossCityService.queryOrderInfo(language, orderId); |
| | | break; |
| | | case 4://同城小件 |
| | | map = orderLogisticsService.queryOrderInfo(orderId); |
| | | map = orderLogisticsService.queryOrderInfo(language, orderId); |
| | | break; |
| | | case 5://跨城小件 |
| | | map = orderLogisticsService.queryOrderInfo(orderId); |
| | | map = orderLogisticsService.queryOrderInfo(language, orderId); |
| | | break; |
| | | } |
| | | if(map.get("telX") != null){ |
| | | map.put("driverPhone", map.get("telX")); |
| | | } |
| | | OrderInfoWarpper orderInfoWarpper = OrderInfoWarpper.getOrderInfoWarpper(map); |
| | | File file = new File(filePath + orderId + "_1.txt"); |
| | | |
| | | File file = new File(filePath + orderId + "_" + orderType + ".txt"); |
| | | if(file.exists()){ |
| | | //读取文件(字符流) |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8")); |
| | |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=同城小件,5=跨城小件)", name = "orderType", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil<OrderInfoWarpper> queryOrderInfo_(Integer orderId, Integer orderType){ |
| | | public ResultUtil<OrderInfoWarpper> queryOrderInfo_(Integer orderId, Integer orderType, Integer language){ |
| | | try { |
| | | Map<String, Object> map = null; |
| | | switch (orderType){ |
| | | case 1://专车 |
| | | map = orderPrivateCarService.queryOrderInfo(orderId); |
| | | map = orderPrivateCarService.queryOrderInfo(language, orderId); |
| | | break; |
| | | case 2://出租车 |
| | | map = orderTaxiService.queryOrderInfo(orderId); |
| | | map = orderTaxiService.queryOrderInfo(language, orderId); |
| | | break; |
| | | case 3://跨城 |
| | | map = orderCrossCityService.queryOrderInfo(orderId); |
| | | map = orderCrossCityService.queryOrderInfo(language, orderId); |
| | | break; |
| | | case 4://同城小件 |
| | | map = orderLogisticsService.queryOrderInfo(orderId); |
| | | map = orderLogisticsService.queryOrderInfo(language, orderId); |
| | | break; |
| | | case 5://跨城小件 |
| | | map = orderLogisticsService.queryOrderInfo(orderId); |
| | | map = orderLogisticsService.queryOrderInfo(language, orderId); |
| | | break; |
| | | } |
| | | if(null != map.get("telX")){ |
| | | map.put("driverPhone", map.get("telX")); |
| | | } |
| | | |
| | | return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map)); |
| | | OrderInfoWarpper orderInfoWarpper = OrderInfoWarpper.getOrderInfoWarpper(map); |
| | | // String driverName = orderInfoWarpper.getDriverName(); |
| | | // if(language == 2){ |
| | | // driverName = "Master " + driverName.replace("师傅", ""); |
| | | // } |
| | | // if(language == 3){ |
| | | // driverName = "Maître " + driverName.replace("师傅", ""); |
| | | // } |
| | | // orderInfoWarpper.setDriverName(driverName); |
| | | return ResultUtil.success(orderInfoWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiOperation(value = "获取订单取消支付页面详情", tags = {"用户端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=同城小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<OrderInfoWarpper> queryCancelPage(Integer orderId, Integer orderType){ |
| | | public ResultUtil<OrderInfoWarpper> queryCancelPage(Integer orderId, Integer orderType, Integer language){ |
| | | try { |
| | | Map<String, Object> map = null; |
| | | switch (orderType) { |
| | | case 1://专车 |
| | | map = orderPrivateCarService.queryOrderInfo(orderId); |
| | | ResultUtil<BaseWarpper> res = orderPrivateCarService.queryCancleAmount(orderId); |
| | | map = orderPrivateCarService.queryOrderInfo(language, orderId); |
| | | ResultUtil<BaseWarpper> res = orderPrivateCarService.queryCancleAmount(orderId, language); |
| | | map.put("cancelPayMoney", res.getData().getAmount()); |
| | | break; |
| | | case 2://出租车 |
| | | map = orderTaxiService.queryOrderInfo(orderId); |
| | | map = orderTaxiService.queryOrderInfo(language, orderId); |
| | | ResultUtil<BaseWarpper> re = orderTaxiService.queryCancleAmount(orderId); |
| | | map.put("cancelPayMoney", re.getData().getAmount()); |
| | | break; |
| | | case 3://跨城 |
| | | map = orderCrossCityService.queryOrderInfo(orderId); |
| | | map = orderCrossCityService.queryOrderInfo(language, orderId); |
| | | ResultUtil<BaseWarpper> r = orderCrossCityService.queryCancleAmount(orderId); |
| | | map.put("cancelPayMoney", r.getData().getAmount()); |
| | | break; |
| | | case 4://同城小件物流 |
| | | map = orderLogisticsService.queryOrderInfo(language, orderId); |
| | | ResultUtil<BaseWarpper> r1 = orderLogisticsService.queryCancleAmount(orderId, language); |
| | | map.put("cancelPayMoney", r1.getData().getAmount()); |
| | | break; |
| | | } |
| | | return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map)); |
| | | OrderInfoWarpper orderInfoWarpper = OrderInfoWarpper.getOrderInfoWarpper(map); |
| | | return ResultUtil.success(orderInfoWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/sendOrderState") |
| | | public ResultUtil cancelOrder(Integer id, Integer orderType){ |
| | | public ResultUtil cancelOrder(Integer id, Integer orderType, String from){ |
| | | try { |
| | | Integer driverId = null; |
| | | Integer userId = null; |
| | |
| | | userId = orderPrivateCar.getUserId(); |
| | | state = orderPrivateCar.getState(); |
| | | if(null != driverId){ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, "", from); |
| | | } |
| | | break; |
| | | case 2: |
| | |
| | | userId = orderTaxi.getUserId(); |
| | | state = orderTaxi.getState(); |
| | | if(null != driverId){ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, "", from); |
| | | } |
| | | break; |
| | | case 3: |
| | |
| | | if(orderCrossCity.getPayMoney() == null && state == 10){//支付的情况才推送取消 |
| | | break; |
| | | }else{ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, "", from); |
| | | } |
| | | break; |
| | | case 4: |
| | |
| | | if(orderLogistics.getPayMoney() == null && state == 10){//支付的情况才推送取消 |
| | | break; |
| | | }else{ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, "", from); |
| | | } |
| | | break; |
| | | case 5: |
| | |
| | | if(orderLogistics1.getPayMoney() == null && state == 10){//支付的情况才推送取消 |
| | | break; |
| | | }else{ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, "", from); |
| | | } |
| | | break; |
| | | } |
| | | pushUtil.pushOrderState(1, userId, id, orderType, state, 0); |
| | | pushUtil.pushOrderState(1, userId, id, orderType, state, 0, "", from); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | @ApiImplicitParam(value = "终点经度", name = "elon", required = true, dataType = "double"), |
| | | @ApiImplicitParam(value = "终点纬度", name = "elat", required = true, dataType = "double") |
| | | }) |
| | | public ResultUtil<BaseWarpper> queryExpectedTime(Double slon, Double slat, Double elon, Double elat){ |
| | | public ResultUtil<BaseWarpper> queryExpectedTime(Double slon, Double slat, Double elon, Double elat, HttpServletRequest request){ |
| | | try { |
| | | return orderService.queryExpectedTime(slon, slat, elon, elat); |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | return orderService.queryExpectedTime(uid, slon, slat, elon, elat); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiOperation(value = "获取取消订单需要支付的费用金额", tags = {"用户端-出租车", "用户端-专车"}, notes = "返回金额为0则不需要支付") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城, 4=同城小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<BaseWarpper> queryCancleAmount(Integer id, Integer orderType){ |
| | | public ResultUtil<BaseWarpper> queryCancleAmount(Integer id, Integer orderType, Integer language){ |
| | | try { |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.queryCancleAmount(id); |
| | | return orderPrivateCarService.queryCancleAmount(id, language); |
| | | case 2: |
| | | return orderTaxiService.queryCancleAmount(id); |
| | | case 3: |
| | | return orderCrossCityService.queryCancleAmount(id); |
| | | case 4: |
| | | return orderLogisticsService.queryCancleAmount(id, language); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/addCancle") |
| | | @ApiOperation(value = "添加取消记录", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiOperation(value = "添加取消记录【2.0】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "取消原因", name = "reason", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "当前经度", name = "lon", required = true, dataType = "Double"), |
| | | @ApiImplicitParam(value = "当前纬度", name = "lat", required = true, dataType = "Double"), |
| | | @ApiImplicitParam(value = "详细地址", name = "address", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "备注", name = "remark", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "语言类型(1=简体中文,2=英语,3=法语)", name = "language", required = false, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil addCancle(Integer id, Integer orderType, String reason, String remark, Integer language, HttpServletRequest request){ |
| | | public ResultUtil addCancle(Integer id, Integer orderType, String reason, String remark, Double lon, Double lat, String address, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | if(ToolUtil.isNotEmpty(reason)){ |
| | | reason = reason.replaceAll("& #40;", "(") |
| | | .replaceAll("& #41;", ")") |
| | | .replaceAll("& #40;", "(") |
| | | .replaceAll("& #41;", ")") |
| | | .replaceAll("& #39;", "'") |
| | | .replaceAll("& lt;", "<") |
| | | .replaceAll("& gt;", ">"); |
| | | } |
| | | if(ToolUtil.isNotEmpty(remark)){ |
| | | remark = remark.replaceAll("& #40;", "(") |
| | | .replaceAll("& #41;", ")") |
| | | .replaceAll("& #40;", "(") |
| | | .replaceAll("& #41;", ")") |
| | | .replaceAll("& #39;", "'") |
| | | .replaceAll("& lt;", "<") |
| | | .replaceAll("& gt;", ">"); |
| | | } |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.addCancle(id, reason, remark, uid, language); |
| | | return orderPrivateCarService.addCancle(id, reason, remark, uid, lon, lat, address, language); |
| | | // case 2: |
| | | // return orderTaxiService.addCancle(id, reason, remark, uid); |
| | | // case 3: |
| | | // return orderCrossCityService.addCancle(id, reason, remark, uid); |
| | | case 4: |
| | | return orderLogisticsService.addCancle(id, reason, remark, uid, language); |
| | | return orderLogisticsService.addCancle(id, reason, remark, uid, lon, lat, address, language); |
| | | // case 5: |
| | | // return orderLogisticsService.addCancle(id, reason, remark, uid); |
| | | // case 6: |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 取消订单退款回调 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/orderCancelRefundCallback") |
| | | public PayoutCallbackResponse orderCancelRefundCallback(@RequestBody PayoutCallbackRequest request){ |
| | | try { |
| | | System.err.println("转账回调>>>>" + JSON.toJSONString(request)); |
| | | PayoutCallbackResponse payoutCallbackResponse = new PayoutCallbackResponse(); |
| | | AuthStatus authStatus = new AuthStatus(); |
| | | authStatus.setAuthStatusCode(131); |
| | | authStatus.setAuthStatusDescription("Authentication was successful"); |
| | | payoutCallbackResponse.setAuthStatus(authStatus); |
| | | Results results = new Results(); |
| | | PayoutPacket packet = request.getPayload().getPacket(); |
| | | String statusCode = packet.getStatusCode(); |
| | | String beepTransactionID = packet.getBeepTransactionID(); |
| | | String payerTransactionID = packet.getPayerTransactionID(); |
| | | |
| | | String id = payerTransactionID.substring(17); |
| | | OrderCancel orderCancel = orderCancelService.selectById(id); |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderCancel.getOrderId()); |
| | | PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 1, 2); |
| | | transactionDetailsService.saveData(orderLogistics.getUserId(), "包裹取消退款", query.getAmount(), 1, 1, 1, 4, orderLogistics.getId()); |
| | | |
| | | results.setBeepTransactionID(beepTransactionID); |
| | | results.setPayerTransactionID(payerTransactionID); |
| | | results.setStatusCode("188"); |
| | | results.setStatusDescription("Response was received"); |
| | | payoutCallbackResponse.setResults(results); |
| | | return payoutCallbackResponse; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/cancleOrderTaxi") |
| | | @ApiOperation(value = "取消操作支付", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiOperation(value = "取消操作支付【1.1】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付方式(1=线上支付,3=余额)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=同城小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付方式(1=手机支付,2=银行卡支付,3=余额)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "银行卡id", name = "bankCardId", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "取消单id(取消操作返回)", name = "cancleId", required = false, 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 cancleOrderTaxi(Integer id, Integer orderType, Integer payType, Integer cancleId, Integer type, Integer language, HttpServletRequest request){ |
| | | public ResultUtil cancleOrderTaxi(Integer id, Integer orderType, Integer payType, Integer bankCardId, Integer cancleId, Integer type, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | String format = String.format("uid=%s&id=%s&orderType=%s&payType=%s&type=%s", uid, id, orderType, payType, type); |
| | | String key = MD5Util.encrypt(format); |
| | | String value = redisUtil.getValue(key); |
| | | if(ToolUtil.isNotEmpty(value) && (System.currentTimeMillis() - Long.valueOf(value)) <= 1000){ |
| | | return ResultUtil.error(language == 1 ? "请勿重复操作" : language == 2 ? "Don't repeat the operation" : "Ne répétez pas l’opération"); |
| | | } |
| | | redisUtil.setStrValue(key, System.currentTimeMillis() + "", 5); |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.cancleOrderPrivateCar(id, payType, "user_" + uid, cancleId, type, language); |
| | | return orderPrivateCarService.cancleOrderPrivateCar(id, payType, bankCardId, cancleId, type, language); |
| | | // case 2: |
| | | // return orderTaxiService.cancleOrderTaxi(id, payType, cancleId, type); |
| | | // case 3: |
| | | // return orderCrossCityService.cancleOrderCrossCity(id, payType, cancleId, type); |
| | | case 4: |
| | | return orderLogisticsService.cancleOrderPrivateCar(id, payType, bankCardId, cancleId, type, language); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/complaintService") |
| | | @ApiOperation(value = "添加投诉操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiOperation(value = "添加投诉操作【2.0】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "司机id", name = "driverId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "投诉原因", name = "reason", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "投诉描述", name = "description", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "语言类型(1=简体中文,2=英语,3=法语)", name = "language", required = false, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil complaintService(Integer driverId, String reason, String description, Integer language, HttpServletRequest request){ |
| | | public ResultUtil complaintService(Integer orderId, Integer orderType, Integer driverId, String reason, String description, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | complaintService.saveData(driverId, reason, description, uid, language); |
| | | complaintService.saveData(orderId, orderType, driverId, reason, description, uid, language); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Double payMoney = 0D; |
| | | Integer companyId = null; |
| | | switch (orderType){ |
| | | case 1: |
| | | map = orderPrivateCarService.queryBalance(orderId, uid); |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | companyId = orderPrivateCar.getCompanyId(); |
| | | payMoney = orderPrivateCar.getOrderMoney(); |
| | | UserActivityDiscount1 query = userActivityDiscount1Mapper.query(orderPrivateCar.getCompanyId()); |
| | | if(null != query){ |
| | | Integer orderNum=orderPrivateCarService.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId",orderPrivateCar.getUserId()).eq("activityId",query.getId()).last(" and to_days(getoffTime) = to_days(now())")); |
| | | if(query.getDistance()*1000>orderPrivateCar.getMileage() && query.getOrderNum()>orderNum){ |
| | | Double special = query.getSpecial(); |
| | | orderPrivateCar.setDiscount(special); |
| | | Double orderMoney = orderPrivateCar.getOrderMoney(); |
| | | double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | if(orderMoney.compareTo(v) > 0){ |
| | | payMoney = v; |
| | | } |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case 2: |
| | | map = orderTaxiService.queryBalance(orderId, uid); |
| | | break; |
| | | case 3: |
| | | map = orderCrossCityService.queryBalance(orderId, uid); |
| | | break; |
| | | // case 2: |
| | | // map = orderTaxiService.queryBalance(orderId, uid); |
| | | // break; |
| | | // case 3: |
| | | // map = orderCrossCityService.queryBalance(orderId, uid); |
| | | // break; |
| | | case 4: |
| | | map = orderLogisticsService.queryBalance(orderId, uid); |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | companyId = orderLogistics.getCompanyId(); |
| | | payMoney = orderLogistics.getOrderMoney(); |
| | | UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderLogistics.getCompanyId()); |
| | | if(null != query2){ |
| | | Integer orderNum=orderLogisticsService.selectCount(new EntityWrapper<OrderLogistics>().eq("userId",orderLogistics.getUserId()).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())")); |
| | | if(query2.getDistance()*1000>orderLogistics.getMileage() && query2.getOrderNum()>orderNum){ |
| | | Double special = query2.getLogistics(); |
| | | orderLogistics.setDiscount(special); |
| | | Double orderMoney = orderLogistics.getOrderMoney(); |
| | | double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | if(orderMoney.compareTo(v) > 0){ |
| | | payMoney = v; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case 5: |
| | | map = orderLogisticsService.queryBalance(orderId, uid); |
| | | break; |
| | | // case 5: |
| | | // map = orderLogisticsService.queryBalance(orderId, uid); |
| | | // break; |
| | | } |
| | | List<UserRedPacketRecord> userRedPacketRecords = userRedPacketRecordService.selectList(new EntityWrapper<UserRedPacketRecord>() |
| | | .eq("companyId", companyId).eq("state", 1).eq("userId", uid)); |
| | | Double aDouble = 0D; |
| | | if(userRedPacketRecords.size() > 0){ |
| | | aDouble = userRedPacketRecords.stream().mapToDouble(UserRedPacketRecord::getRemainingAmount).sum(); |
| | | } |
| | | map.put("redTotal", aDouble); |
| | | RedEnvelopePaymentSettings redEnvelopePaymentSettings = redEnvelopePaymentSettingsService.getRedEnvelopePaymentSettings(); |
| | | if(null == redEnvelopePaymentSettings){ |
| | | map.put("deductionAmount", 0D); |
| | | }else{ |
| | | Double deductionAmount = new BigDecimal(payMoney).multiply(redEnvelopePaymentSettings.getDeductionRatio().divide(new BigDecimal(100))).doubleValue(); |
| | | map.put("deductionAmount", aDouble.compareTo(deductionAmount) >= 0 ? deductionAmount : aDouble); |
| | | } |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/queryCoupon") |
| | | @ApiOperation(value = "获取支付页面的优惠券列表", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiOperation(value = "获取支付页面的优惠券列表", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryCoupon(Integer orderId, Integer orderType, Integer pageNum, Integer size, HttpServletRequest request){ |
| | | public ResultUtil queryCoupon(Integer language, Integer orderId, Integer orderType, Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | switch (orderType){ |
| | | case 1: |
| | | list = orderPrivateCarService.queryCoupon(orderId, uid, pageNum, size); |
| | | list = orderPrivateCarService.queryCoupon(language, orderId, uid, pageNum, size); |
| | | break; |
| | | case 2: |
| | | list = orderTaxiService.queryCoupon(orderId, uid, pageNum, size); |
| | | break; |
| | | case 3: |
| | | list = orderCrossCityService.queryCoupon(orderId, uid, pageNum, size); |
| | | break; |
| | | // case 4: |
| | | // list = orderLogisticsService.queryCoupon(orderId, uid, pageNum, size); |
| | | // case 2: |
| | | // list = orderTaxiService.queryCoupon(orderId, uid, pageNum, size); |
| | | // break; |
| | | // case 3: |
| | | // list = orderCrossCityService.queryCoupon(orderId, uid, pageNum, size); |
| | | // break; |
| | | case 4: |
| | | list = orderLogisticsService.queryCoupon(language,orderId, uid, pageNum, size); |
| | | break; |
| | | // case 5: |
| | | // list = orderLogisticsService.queryCoupon(orderId, uid, pageNum, size); |
| | | // break; |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/payTaxiOrder") |
| | | @ApiOperation(value = "订单完成支付订单操作【1.1】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiOperation(value = "订单完成支付订单操作【2.0】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "支付方式(1=手机支付,2=银行卡支付,3=余额,4=线下支付)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "银行卡id", name = "bankCardId", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=同城小件物流,5=跨城小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "优惠券id", name = "couponId", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "是否红包抵扣(0=否,1=是)", name = "redDeduction", required = false, 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 payTaxiOrder(Integer payType, Integer bankCardId, Integer orderId, Integer orderType, Integer couponId, Integer type, Integer language, HttpServletRequest request){ |
| | | public ResultUtil payTaxiOrder(Integer payType, Integer bankCardId, Integer orderId, Integer orderType, Integer couponId, Integer redDeduction, Integer type, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | System.err.println("支付接口请求参数:payType=" + payType + "&bankCardId=" + bankCardId + "&orderId=" + orderId + "&orderType=" + orderType + |
| | | "&couponId=" + couponId + "&redDeduction=" + redDeduction + "&type=" + type + "&language=" + language); |
| | | String format = String.format("uid=%s&payType=%s&orderId=%s&orderType=%s", uid, payType, orderId, orderType); |
| | | String key = MD5Util.encrypt(format); |
| | | String value = redisUtil.getValue(key); |
| | | if(ToolUtil.isNotEmpty(value) && (System.currentTimeMillis() - Long.valueOf(value)) <= 1000){ |
| | | return ResultUtil.error(language == 1 ? "请勿重复操作" : language == 2 ? "Don't repeat the operation" : "Ne répétez pas l’opération"); |
| | | } |
| | | redisUtil.setStrValue(key, System.currentTimeMillis() + "", 5); |
| | | |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.payPrivateCarOrder(payType, bankCardId, orderId, couponId, type, language); |
| | | return orderPrivateCarService.payPrivateCarOrder(payType, bankCardId, orderId, couponId, redDeduction, type, language); |
| | | // case 2: |
| | | // return orderTaxiService.payTaxiOrder(payType, orderId, couponId, type); |
| | | // case 3: |
| | | // return orderCrossCityService.payCrossCityOrder(payType, orderId, couponId, type); |
| | | case 4: |
| | | return orderLogisticsService.payLogisticsOrder(payType, bankCardId, orderId, type, language); |
| | | return orderLogisticsService.payLogisticsOrder(payType, bankCardId, orderId,couponId, redDeduction, type, language); |
| | | // case 5: |
| | | // return orderLogisticsService.payLogisticsOrder(payType, orderId, type, language); |
| | | } |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/orderEvaluate") |
| | | @ApiOperation(value = "订单完成后添加评价操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiOperation(value = "订单完成后添加评价操作【2.0】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "评分", name = "fraction", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "评价内容", name = "content", required = false, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | |
| | | orderCrossCity.setState(9); |
| | | orderCrossCityService.updateById(orderCrossCity); |
| | | break; |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | orderLogistics.setState(9); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | break; |
| | | } |
| | | } |
| | | return resultUtil.getCode() == 200 ? ResultUtil.success() : resultUtil; |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/queryRedMoney") |
| | | @ApiOperation(value = "评论成功后获取红包金额", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiOperation(value = "评论成功后获取红包金额", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<BaseWarpper> queryRedMoney(Integer orderId, Integer orderType){ |
| | |
| | | return orderTaxiService.queryRedMoney(orderId); |
| | | case 3: |
| | | return orderCrossCityService.queryRedMoney(orderId); |
| | | case 4: |
| | | return orderLogisticsService.queryRedMoney(orderId); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/shareRedEnvelope") |
| | | @ApiOperation(value = "分享成功后添加红包操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiOperation(value = "分享成功后添加红包操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "语言", name = "language", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil shareRedEnvelope(Integer orderId, Integer orderType, Integer language){ |
| | |
| | | return orderTaxiService.shareRedEnvelope(orderId); |
| | | case 3: |
| | | return orderCrossCityService.shareRedEnvelope(orderId); |
| | | case 4: |
| | | return orderLogisticsService.shareRedEnvelope(orderId, language); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | |
| | | @ResponseBody |
| | | @PostMapping("/base/wxCancelOrderTaxi") |
| | | public CallbackResponse wxCancelOrderTaxi(@RequestBody CallbackRequest callbackRequest){ |
| | | CallbackResponse callbackResponse = new CallbackResponse(); |
| | | try { |
| | | /** |
| | | * 指示服务是否成功或付费的总体请求代码。。 |
| | | * 177-部分付费请求 |
| | | * 178-表明请求已全额支付 |
| | | * 179-表示请求已部分支付但已过期。 |
| | | * 129-请求已过期,未付款。 |
| | | * 180.商户拒绝请求 |
| | | * 183-商户接受请求,我们可以结算资金 |
| | | * 188-商户收到请求。 |
| | | */ |
| | | String request_status_code = callbackRequest.getRequest_status_code(); |
| | | String out_trade_no = callbackRequest.getMerchant_transaction_id(); |
| | | if("177".equals(request_status_code) || "178".equals(request_status_code)){ |
| | | Payments payments = callbackRequest.getPayments().get(0); |
| | | String order_id = payments.getPayer_transaction_id(); |
| | | if(ToolUtil.isNotEmpty(out_trade_no)){ |
| | | Integer type = Integer.valueOf(out_trade_no.substring(17, 18)); |
| | | Integer id = Integer.valueOf(out_trade_no.substring(18)); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, 1); |
| | | break; |
| | | case 2: |
| | | orderTaxiService.payCancelOrderTaxi(id, order_id, 1); |
| | | break; |
| | | case 3: |
| | | orderCrossCityService.payCancelOrderCrossCity(id, order_id, 1); |
| | | break; |
| | | } |
| | | callbackResponse.setCheckout_request_id(order_id); |
| | | callbackResponse.setMerchant_transaction_id(out_trade_no); |
| | | callbackResponse.setStatus_code("183"); |
| | | callbackResponse.setStatus_description("Payment processed successfully"); |
| | | callbackResponse.setReceipt_number(UUIDUtil.getRandomCode(16)); |
| | | } |
| | | }else{ |
| | | callbackResponse.setCheckout_request_id(UUIDUtil.getRandomCode(16)); |
| | | callbackResponse.setMerchant_transaction_id(out_trade_no); |
| | | callbackResponse.setStatus_code("180"); |
| | | callbackResponse.setStatus_description("means payment rejected."); |
| | | callbackResponse.setReceipt_number(UUIDUtil.getRandomCode(16)); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return callbackResponse; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 取消订单支付宝回调 |
| | | * @param request |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/aliCancelOrderTaxi") |
| | | public void aliCancelOrderTaxi(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request);//icbcPayUtil.payCallback(request); |
| | | if(null != map){ |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String order_id = map.get("trade_no"); |
| | | if(ToolUtil.isNotEmpty(out_trade_no)){ |
| | | String[] split = out_trade_no.split("_"); |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, 2); |
| | | break; |
| | | case 2: |
| | | orderTaxiService.payCancelOrderTaxi(id, order_id, 2); |
| | | break; |
| | | case 3: |
| | | orderCrossCityService.payCancelOrderCrossCity(id, order_id, 2); |
| | | break; |
| | | } |
| | | } |
| | | response.setContentType("text/html;charset=UTF-8"); |
| | | PrintWriter out; |
| | | out = response.getWriter(); |
| | | out.println("success"); // 请不要修改或删除 |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 完成订单微信支付回调 |
| | | * @param |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/wxPayOrderTaxi") |
| | | public CallbackResponse wxPayOrderTaxi(@RequestBody CallbackRequest callbackRequest){ |
| | | log.info("取消订单支付回调结果:{}", JSON.toJSONString(callbackRequest)); |
| | | CallbackResponse callbackResponse = new CallbackResponse(); |
| | | try { |
| | | /** |
| | |
| | | Integer id = Integer.valueOf(out_trade_no.substring(19)); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 1, language); |
| | | orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, language); |
| | | break; |
| | | case 2: |
| | | orderTaxiService.payOrderTaxiCallback(id, order_id, 1); |
| | | break; |
| | | case 3: |
| | | orderCrossCityService.payOrderCrossCityCallback(id, order_id, 1); |
| | | break; |
| | | // case 2: |
| | | // orderTaxiService.payCancelOrderTaxi(id, order_id, 1); |
| | | // break; |
| | | // case 3: |
| | | // orderCrossCityService.payCancelOrderCrossCity(id, order_id, 1); |
| | | // break; |
| | | case 4: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1, language); |
| | | break; |
| | | case 5: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1, language); |
| | | orderLogisticsService.payCancelOrderPrivateCar(id, order_id, language); |
| | | break; |
| | | } |
| | | callbackResponse.setCheckout_request_id(order_id); |
| | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | log.info("取消订单支付回调处理结束:{}", JSON.toJSONString(callbackResponse)); |
| | | return callbackResponse; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 取消订单支付宝回调 |
| | | * @param request |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/aliCancelOrderTaxi") |
| | | public void aliCancelOrderTaxi(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | // Map<String, String> map = payMoneyUtil.alipayCallback(request);//icbcPayUtil.payCallback(request); |
| | | // if(null != map){ |
| | | // String out_trade_no = map.get("out_trade_no"); |
| | | // String order_id = map.get("trade_no"); |
| | | // if(ToolUtil.isNotEmpty(out_trade_no)){ |
| | | // String[] split = out_trade_no.split("_"); |
| | | // Integer id = Integer.valueOf(split[0]); |
| | | // Integer type = Integer.valueOf(split[1]); |
| | | // switch (type){ |
| | | // case 1: |
| | | // orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, 2); |
| | | // break; |
| | | // case 2: |
| | | // orderTaxiService.payCancelOrderTaxi(id, order_id, 2); |
| | | // break; |
| | | // case 3: |
| | | // orderCrossCityService.payCancelOrderCrossCity(id, order_id, 2); |
| | | // break; |
| | | // } |
| | | // } |
| | | // response.setContentType("text/html;charset=UTF-8"); |
| | | // PrintWriter out; |
| | | // out = response.getWriter(); |
| | | // out.println("success"); // 请不要修改或删除 |
| | | // } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 完成订单微信支付回调 |
| | | * @param |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/wxPayOrderTaxi") |
| | | public CallbackResponse wxPayOrderTaxi(@RequestBody CallbackRequest callbackRequest){ |
| | | log.info("订单完成支付回调结果:{}", JSON.toJSONString(callbackRequest)); |
| | | CallbackResponse callbackResponse = new CallbackResponse(); |
| | | try { |
| | | /** |
| | | * 指示服务是否成功或付费的总体请求代码。。 |
| | | * 177-部分付费请求 |
| | | * 178-表明请求已全额支付 |
| | | * 179-表示请求已部分支付但已过期。 |
| | | * 129-请求已过期,未付款。 |
| | | * 180.商户拒绝请求 |
| | | * 183-商户接受请求,我们可以结算资金 |
| | | * 188-商户收到请求。 |
| | | */ |
| | | String request_status_code = callbackRequest.getRequest_status_code(); |
| | | String out_trade_no = callbackRequest.getMerchant_transaction_id(); |
| | | if("177".equals(request_status_code) || "178".equals(request_status_code)){ |
| | | Payments payments = callbackRequest.getPayments().get(0); |
| | | String order_id = payments.getPayer_transaction_id(); |
| | | if(ToolUtil.isNotEmpty(out_trade_no)){ |
| | | Integer orderType = Integer.valueOf(out_trade_no.substring(17, 18)); |
| | | Integer language = Integer.valueOf(out_trade_no.substring(18, 19)); |
| | | Integer id = Integer.valueOf(out_trade_no.substring(19)); |
| | | switch (orderType){ |
| | | case 1: |
| | | orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, language); |
| | | break; |
| | | // case 2: |
| | | // orderTaxiService.payOrderTaxiCallback(id, order_id, 1); |
| | | // break; |
| | | // case 3: |
| | | // orderCrossCityService.payOrderCrossCityCallback(id, order_id, 1); |
| | | // break; |
| | | case 4: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, language); |
| | | break; |
| | | // case 5: |
| | | // orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1, language); |
| | | // break; |
| | | } |
| | | callbackResponse.setCheckout_request_id(order_id); |
| | | callbackResponse.setMerchant_transaction_id(out_trade_no); |
| | | callbackResponse.setStatus_code("183"); |
| | | callbackResponse.setStatus_description("Payment processed successfully"); |
| | | callbackResponse.setReceipt_number(UUIDUtil.getRandomCode(16)); |
| | | } |
| | | }else{ |
| | | callbackResponse.setCheckout_request_id(UUIDUtil.getRandomCode(16)); |
| | | callbackResponse.setMerchant_transaction_id(out_trade_no); |
| | | callbackResponse.setStatus_code("180"); |
| | | callbackResponse.setStatus_description("means payment rejected."); |
| | | callbackResponse.setReceipt_number(UUIDUtil.getRandomCode(16)); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | log.info("订单完成支付回调处理结束:{}", JSON.toJSONString(callbackResponse)); |
| | | return callbackResponse; |
| | | } |
| | | |
| | |
| | | Integer type = Integer.valueOf(split[1]); |
| | | Integer language = Integer.valueOf(split[2]); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 2, language); |
| | | break; |
| | | case 2: |
| | | orderTaxiService.payOrderTaxiCallback(id, order_id, 2); |
| | | break; |
| | | case 3: |
| | | orderCrossCityService.payOrderCrossCityCallback(id, order_id, 2); |
| | | break; |
| | | case 4: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2, language); |
| | | break; |
| | | case 5: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2, language); |
| | | break; |
| | | // case 1: |
| | | // orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 2, language); |
| | | // break; |
| | | // case 2: |
| | | // orderTaxiService.payOrderTaxiCallback(id, order_id, 2); |
| | | // break; |
| | | // case 3: |
| | | // orderCrossCityService.payOrderCrossCityCallback(id, order_id, 2); |
| | | // break; |
| | | // case 4: |
| | | // orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2, language); |
| | | // break; |
| | | // case 5: |
| | | // orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2, language); |
| | | // break; |
| | | } |
| | | response.setContentType("text/html;charset=UTF-8"); |
| | | PrintWriter out; |
| | |
| | | |
| | | /** |
| | | * 小件物流差价微信支付回调 |
| | | * @param request |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/wxPayOrderLogisticsSpread") |
| | | public void wxPayOrderLogisticsSpread(HttpServletRequest request, HttpServletResponse response){ |
| | | public CallbackResponse wxPayOrderLogisticsSpread(@RequestBody CallbackRequest callbackRequest){ |
| | | CallbackResponse callbackResponse = new CallbackResponse(); |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request);//icbcPayUtil.payCallback(request); |
| | | if(null != map){ |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String order_id = map.get("transaction_id"); |
| | | String s = null;//icbcPayUtil.queryTransaction("", order_id); |
| | | if(!s.equals("") && !s.equals("2")){ |
| | | //icbcPayUtil.answer(response);//回调应答 |
| | | /** |
| | | * 指示服务是否成功或付费的总体请求代码。。 |
| | | * 177-部分付费请求 |
| | | * 178-表明请求已全额支付 |
| | | * 179-表示请求已部分支付但已过期。 |
| | | * 129-请求已过期,未付款。 |
| | | * 180.商户拒绝请求 |
| | | * 183-商户接受请求,我们可以结算资金 |
| | | * 188-商户收到请求。 |
| | | */ |
| | | String request_status_code = callbackRequest.getRequest_status_code(); |
| | | String out_trade_no = callbackRequest.getMerchant_transaction_id(); |
| | | if("177".equals(request_status_code) || "178".equals(request_status_code)){ |
| | | Payments payments = callbackRequest.getPayments().get(0); |
| | | String order_id = payments.getPayer_transaction_id(); |
| | | if(ToolUtil.isNotEmpty(out_trade_no)){ |
| | | Integer orderType = Integer.valueOf(out_trade_no.substring(17, 18)); |
| | | Integer language = Integer.valueOf(out_trade_no.substring(18, 19)); |
| | | Integer id = Integer.valueOf(out_trade_no.substring(19)); |
| | | orderLogisticsService.payOrderLogisticsSpreadCallback(id, order_id, language); |
| | | callbackResponse.setCheckout_request_id(order_id); |
| | | callbackResponse.setMerchant_transaction_id(out_trade_no); |
| | | callbackResponse.setStatus_code("183"); |
| | | callbackResponse.setStatus_description("Payment processed successfully"); |
| | | callbackResponse.setReceipt_number(UUIDUtil.getRandomCode(16)); |
| | | } |
| | | if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id) && s.equals("0")){ |
| | | String[] split = out_trade_no.split(","); |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | orderLogisticsService.payOrderLogisticsSpreadCallback(id, order_id, 1); |
| | | } |
| | | }else{ |
| | | callbackResponse.setCheckout_request_id(UUIDUtil.getRandomCode(16)); |
| | | callbackResponse.setMerchant_transaction_id(out_trade_no); |
| | | callbackResponse.setStatus_code("180"); |
| | | callbackResponse.setStatus_description("means payment rejected."); |
| | | callbackResponse.setReceipt_number(UUIDUtil.getRandomCode(16)); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return callbackResponse; |
| | | } |
| | | |
| | | |
| | |
| | | @PostMapping("/base/aliPayOrderLogisticsSpread") |
| | | public void aliPayOrderLogisticsSpread(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request);//icbcPayUtil.payCallback(request); |
| | | if(null != map){ |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String order_id = map.get("trade_no"); |
| | | String s = null;//icbcPayUtil.queryTransaction("", order_id); |
| | | if(!s.equals("") && !s.equals("2")){ |
| | | //icbcPayUtil.answer(response);//回调应答 |
| | | } |
| | | if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id) && s.equals("0")){ |
| | | String[] split = out_trade_no.split(","); |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | orderLogisticsService.payOrderLogisticsSpreadCallback(id, order_id, 2); |
| | | } |
| | | |
| | | } |
| | | // Map<String, String> map = payMoneyUtil.alipayCallback(request);//icbcPayUtil.payCallback(request); |
| | | // if(null != map){ |
| | | // String out_trade_no = map.get("out_trade_no"); |
| | | // String order_id = map.get("trade_no"); |
| | | // String s = null;//icbcPayUtil.queryTransaction("", order_id); |
| | | // if(!s.equals("") && !s.equals("2")){ |
| | | // //icbcPayUtil.answer(response);//回调应答 |
| | | // } |
| | | // if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id) && s.equals("0")){ |
| | | // String[] split = out_trade_no.split(","); |
| | | // Integer id = Integer.valueOf(split[0]); |
| | | // Integer type = Integer.valueOf(split[1]); |
| | | // orderLogisticsService.payOrderLogisticsSpreadCallback(id, order_id, 2); |
| | | // } |
| | | // |
| | | // } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | payoutCallbackResponse.setResults(results); |
| | | return payoutCallbackResponse; |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/updateEndAddress") |
| | | @ApiOperation(value = "修改目的地【2.0】", tags = {"用户端-专车", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "终点经度", name = "endLon", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "终点纬度", name = "endLat", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "终点地址", name = "endAddress", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "语言", name = "language", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil updateEndAddress(Integer orderId, Integer orderType, String endLon, String endLat, String endAddress){ |
| | | switch (orderType){ |
| | | case 1: |
| | | orderPrivateCarService.updateEndAddress(orderId, endLon, endLat, endAddress); |
| | | break; |
| | | case 4: |
| | | orderLogisticsService.updateEndAddress(orderId, endLon, endLat, endAddress); |
| | | break; |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/redEnvelopeDeductionAmount") |
| | | @ApiOperation(value = "获取支付页红包抵扣金额【2.0】", tags = {"用户端-专车", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "语言", name = "language", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil redEnvelopeDeductionAmount(Integer orderId, Integer orderType, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Double payMoney = 0D; |
| | | Integer companyId = 1; |
| | | switch (orderType){ |
| | | case 1: |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | companyId = orderPrivateCar.getCompanyId(); |
| | | Double orderMoney = orderPrivateCar.getOrderMoney(); |
| | | if(null == orderMoney){ |
| | | orderMoney = 0D; |
| | | } |
| | | UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderPrivateCar.getCompanyId()); |
| | | if(null != query2){ |
| | | Integer orderNum=orderPrivateCarService.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId", uid).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())")); |
| | | if(query2.getDistance()*1000>orderPrivateCar.getMileage() && query2.getOrderNum()>orderNum){ |
| | | Double special = query2.getSpecial(); |
| | | if(null != special){ |
| | | double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | payMoney = v; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | companyId = orderLogistics.getCompanyId(); |
| | | Double orderMoney1 = orderLogistics.getOrderMoney(); |
| | | if(null == orderMoney1){ |
| | | orderMoney1 = 0D; |
| | | } |
| | | UserActivityDiscount1 query1 = userActivityDiscount1Mapper.query(orderLogistics.getCompanyId()); |
| | | if(null != query1){ |
| | | Integer orderNum=orderLogisticsService.selectCount(new EntityWrapper<OrderLogistics>().eq("userId", uid).eq("activityId",query1.getId()).last(" and to_days(getoffTime) = to_days(now())")); |
| | | if(query1.getDistance()*1000>orderLogistics.getMileage() && query1.getOrderNum()>orderNum){ |
| | | Double special = query1.getLogistics(); |
| | | if(null != special){ |
| | | double v = new BigDecimal(orderMoney1).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | payMoney = v; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | List<UserRedPacketRecord> userRedPacketRecords = userRedPacketRecordService.selectList(new EntityWrapper<UserRedPacketRecord>().eq("userId", uid) |
| | | .eq("state", 1).eq("companyId", companyId).gt("remainingAmount", 0).orderBy("insertTime", false)); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("redTotal", userRedPacketRecords.stream().mapToDouble(UserRedPacketRecord::getRemainingAmount).sum()); |
| | | RedEnvelopePaymentSettings redEnvelopePaymentSettings = redEnvelopePaymentSettingsService.getRedEnvelopePaymentSettings(); |
| | | if(null == redEnvelopePaymentSettings){ |
| | | map.put("deductionAmount", 0D); |
| | | return ResultUtil.success(map); |
| | | } |
| | | Double deductionAmount = new BigDecimal(payMoney).multiply(redEnvelopePaymentSettings.getDeductionRatio().divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | map.put("deductionAmount", deductionAmount); |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/getNewTripId") |
| | | @ApiOperation(value = "获取google预定tripid【2.0】", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<String> getNewTripId(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | String randomCode = UUIDUtil.getRandomCode(); |
| | | redisUtil.setStrValue("trip" + uid, randomCode); |
| | | log.warn("生成tripId:{} {}", System.currentTimeMillis(), randomCode); |
| | | return ResultUtil.success(randomCode); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |