zhibing.pu
2024-08-01 287cbb376dea7b3972e5f38a38fad043aa4d3b68
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
@@ -36,6 +36,7 @@
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -201,6 +202,9 @@
            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:
@@ -639,7 +643,31 @@
    })
    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();
@@ -1702,17 +1730,39 @@
                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);
@@ -1721,7 +1771,7 @@
                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){