| | |
| | | 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.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.dao.UserActivityDiscount1Mapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | |
| | | 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.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.*; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IUserRedPacketRecordService userRedPacketRecordService; |
| | | |
| | | @Resource |
| | | private UserActivityDiscount1Mapper userActivityDiscount1Mapper; |
| | | |
| | | /** |
| | | * 获取正在进行中的订单 |
| | |
| | | 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); |
| | | } |
| | | return ResultUtil.success(data); |
| | |
| | | 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: |
| | |
| | | }) |
| | | public ResultUtil queryTrack_(Integer orderId, Integer orderType){ |
| | | try { |
| | | List<Map<String, Object>> list = orderPositionService.queryTrack(orderId, orderType); |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | switch (orderType){ |
| | | case 1: |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("lon", orderPrivateCar.getStartLon()); |
| | | map.put("lat", orderPrivateCar.getStartLat()); |
| | | list.add(map); |
| | | map = new HashMap<>(); |
| | | map.put("lon", orderPrivateCar.getEndLon()); |
| | | map.put("lat", orderPrivateCar.getEndLat()); |
| | | list.add(map); |
| | | break; |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | | map1.put("lon", orderLogistics.getStartLon()); |
| | | map1.put("lat", orderLogistics.getStartLat()); |
| | | list.add(map1); |
| | | map1 = new HashMap<>(); |
| | | map1.put("lon", orderLogistics.getEndLon()); |
| | | map1.put("lat", orderLogistics.getEndLat()); |
| | | list.add(map1); |
| | | break; |
| | | } |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | 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, ""); |
| | | } |
| | | 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, ""); |
| | | } |
| | | 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, ""); |
| | | } |
| | | 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, ""); |
| | | } |
| | | 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, ""); |
| | | } |
| | | break; |
| | | } |
| | | pushUtil.pushOrderState(1, userId, id, orderType, state, 0); |
| | | pushUtil.pushOrderState(1, userId, id, orderType, state, 0, ""); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | reason = reason.replaceAll("& #40;", "(") |
| | | .replaceAll("& #41;", ")") |
| | | .replaceAll("& #40;", "(") |
| | | .replaceAll("& #41;", ")") |
| | | .replaceAll("& #39;", "'") |
| | | .replaceAll("& lt;", "<") |
| | | .replaceAll("& gt;", ">"); |
| | | 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, lon, lat, address, language); |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 取消订单退款回调 |
| | | * @param request |
| | |
| | | case 1: |
| | | map = orderPrivateCarService.queryBalance(orderId, uid); |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | payMoney = orderPrivateCar.getPayMoney(); |
| | | 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); |
| | |
| | | case 4: |
| | | map = orderLogisticsService.queryBalance(orderId, uid); |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | payMoney = orderLogistics.getPayMoney(); |
| | | 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); |
| | |
| | | map.put("deductionAmount", 0D); |
| | | }else{ |
| | | Double deductionAmount = new BigDecimal(payMoney).multiply(redEnvelopePaymentSettings.getDeductionRatio().divide(new BigDecimal(100))).doubleValue(); |
| | | map.put("deductionAmount", deductionAmount); |
| | | map.put("deductionAmount", aDouble.compareTo(deductionAmount) >= 0 ? deductionAmount : aDouble); |
| | | } |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Double payMoney = 0D; |
| | | Integer companyId = 1; |
| | | switch (orderType){ |
| | | case 1: |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | payMoney = orderPrivateCar.getPayMoney(); |
| | | Double orderMoney = orderPrivateCar.getOrderMoney(); |
| | | 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); |
| | | payMoney = orderLogistics.getPayMoney(); |
| | | Double orderMoney1 = orderLogistics.getOrderMoney(); |
| | | 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.getSpecial(); |
| | | if(null != special){ |
| | | double v = new BigDecimal(orderMoney1).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | payMoney = v; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | Double aDouble = userRedPacketRecordService.queryRemainingAmount(uid); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("redTotal", aDouble); |
| | |
| | | map.put("deductionAmount", 0D); |
| | | return ResultUtil.success(map); |
| | | } |
| | | Double deductionAmount = new BigDecimal(payMoney).multiply(redEnvelopePaymentSettings.getDeductionRatio().divide(new BigDecimal(100))).doubleValue(); |
| | | 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){ |