From 77bca6b387f9349d072b8737e82b42fd7f723be0 Mon Sep 17 00:00:00 2001 From: zhibing.pu <393733352@qq.com> Date: 星期五, 02 八月 2024 18:07:39 +0800 Subject: [PATCH] 修改2.0 bug --- UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java | 229 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 178 insertions(+), 51 deletions(-) diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java index 3db4811..43aa8b6 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java @@ -3,6 +3,7 @@ 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; @@ -11,6 +12,7 @@ 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.*; @@ -26,14 +28,22 @@ 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.*; @@ -105,6 +115,9 @@ @Autowired private IUserRedPacketRecordService userRedPacketRecordService; + + @Resource + private UserActivityDiscount1Mapper userActivityDiscount1Mapper; /** * 获取正在进行中的订单 @@ -136,6 +149,7 @@ 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); @@ -147,6 +161,7 @@ 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); @@ -158,6 +173,7 @@ orderStatusWarpper.setOrderId(orderCrossCity.getId()); orderStatusWarpper.setOrderType(3); orderStatusWarpper.setState(orderCrossCity.getState()); +// orderStatusWarpper.setTripId(orderPrivateCar.getTripId()); data.add(orderStatusWarpper); } return ResultUtil.success(data); @@ -193,6 +209,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: @@ -227,13 +246,13 @@ */ @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){ @@ -260,26 +279,26 @@ 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", DateUtil.conversionFormat(language, 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); @@ -288,6 +307,9 @@ }else{ orderWarpper = new ArrayList<>(); } + orderWarpper.forEach(s->{ + s.setTotal(sum); + }); return ResultUtil.success(orderWarpper); }catch (Exception e){ e.printStackTrace(); @@ -431,7 +453,7 @@ */ @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"), @@ -461,16 +483,8 @@ map.put("driverPhone", map.get("telX")); } 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); - 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")); @@ -636,7 +650,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(); @@ -665,7 +703,7 @@ 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: @@ -674,7 +712,7 @@ 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: @@ -685,7 +723,7 @@ 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: @@ -696,7 +734,7 @@ 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: @@ -707,11 +745,11 @@ 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(); @@ -886,6 +924,20 @@ 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); @@ -906,8 +958,9 @@ return ResultUtil.runErr(); } } - - + + + /** * 取消订单退款回调 * @param request @@ -1003,21 +1056,23 @@ */ @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(); @@ -1048,9 +1103,26 @@ return ResultUtil.tokenErr(); } Map<String, Object> map = new HashMap<>(); + Double payMoney = 0D; switch (orderType){ case 1: map = orderPrivateCarService.queryBalance(orderId, uid); + OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); + 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); @@ -1060,10 +1132,34 @@ // break; case 4: map = orderLogisticsService.queryBalance(orderId, uid); + OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); + 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; + } + Double aDouble = userRedPacketRecordService.queryRemainingAmount(uid); + 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){ @@ -1084,10 +1180,10 @@ */ @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.....") @@ -1182,10 +1278,10 @@ */ @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.....") @@ -1210,6 +1306,11 @@ 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; @@ -1228,10 +1329,10 @@ */ @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){ @@ -1243,6 +1344,8 @@ return orderTaxiService.queryRedMoney(orderId); case 3: return orderCrossCityService.queryRedMoney(orderId); + case 4: + return orderLogisticsService.queryRedMoney(orderId); } return ResultUtil.success(); }catch (Exception e){ @@ -1261,7 +1364,7 @@ */ @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"), @@ -1277,6 +1380,8 @@ return orderTaxiService.shareRedEnvelope(orderId); case 3: return orderCrossCityService.shareRedEnvelope(orderId); + case 4: + return orderLogisticsService.shareRedEnvelope(orderId, language); } return ResultUtil.success(); }catch (Exception e){ @@ -1647,17 +1752,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); @@ -1666,7 +1793,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){ -- Gitblit v1.7.1