From 822ed15aacf175cba141c3a423e17f044d569768 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期四, 12 十二月 2024 16:16:33 +0800 Subject: [PATCH] 修改bug --- ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TSysReformistController.java | 111 +++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 75 insertions(+), 36 deletions(-) diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TSysReformistController.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TSysReformistController.java index c952541..fe8d63e 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TSysReformistController.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TSysReformistController.java @@ -26,6 +26,7 @@ import java.util.Date; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 系统设置控制器 @@ -120,7 +121,8 @@ @RequestMapping(value = "/redSet/list") @ResponseBody public Object redSetList() { - + List<String> strings = new ArrayList<>(); + strings.add("updateTime"); Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); if (ShiroKit.getUser().getRoleType() != 1){ page.setRecords(null); @@ -129,7 +131,16 @@ for (Map<String, Object> stringObjectMap : list) { stringObjectMap.put(stringObjectMap.get("deductionRatio").toString(),stringObjectMap.get("deductionRatio")+"%"); } - page.setRecords(list); + List<Map<String, Object>> sortedList = list.stream() + .sorted((map1, map2) -> { + // 获取 updateTime 字段 + String time1 = map1.get("updateTime").toString(); + String time2 = map2.get("updateTime").toString(); + // 倒序排列 + return time2.compareTo(time1); + }) + .collect(Collectors.toList()); + page.setRecords(sortedList); } return super.packForBT(page); } @@ -148,7 +159,12 @@ String s = replace + ":00"; SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = dateFormat.parse(s); + if (date.before(new Date())){ + // 选择的生效时间不能小于当前时间 + return 501; + } tSysRedSet.setInsertTime(new Date()); + tSysRedSet.setUpdateTime(new Date()); tSysRedSet.setEffectiveDate(date); tSysRedSet.setStatus(1); redEnvelopePaymentSettingsService.insert(tSysRedSet); @@ -167,7 +183,7 @@ String s = replace + ":00"; SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = dateFormat.parse(s); - tSysRedSet.setInsertTime(date); + tSysRedSet.setEffectiveDate(date); tSysRedSet.setUpdateTime(new Date()); redEnvelopePaymentSettingsService.updateById(tSysRedSet); return SUCCESS_TIP; @@ -237,39 +253,62 @@ model.addAttribute("ptCancel3",ptCancel3); // 司机超时 - JSONObject jsonObject = JSON.parseObject(ptCancel1.getContent()); - model.addAttribute("driverTimeout",jsonObject.getIntValue("driverTimeout")); - // 订单取消规则 - JSONObject order = jsonObject.getJSONObject("order"); - String orderAcceptanceTime = order.getString("orderAcceptanceTime"); - String money = order.getString("money"); - String mileageFee = order.getString("mileageFee"); - String durationFee = order.getString("durationFee"); - // 接单xx分钟后 - model.addAttribute("orderAcceptanceTime",orderAcceptanceTime); - // 取消订单金额 - model.addAttribute("money",money); - // 时长费 - model.addAttribute("mileageFee",mileageFee); - // 分钟 - model.addAttribute("durationFee",durationFee); - // 预约单取消规则 - JSONObject reservationOrder = jsonObject.getJSONObject("reservationOrder"); - String orderAcceptanceTime1 = reservationOrder.getString("orderAcceptanceTime"); - String money1 = reservationOrder.getString("money"); - String mileageFee1 = reservationOrder.getString("mileageFee"); - String durationFee1 = reservationOrder.getString("durationFee"); - String reservationFee = reservationOrder.getString("reservationFee"); - // 预约单接单xx分钟后 - model.addAttribute("orderAcceptanceTime1",orderAcceptanceTime1); - // 预约单取消订单金额 - model.addAttribute("money1",money1); - // 预约单时长费 - model.addAttribute("mileageFee1",mileageFee1); - // 预约单分钟 - model.addAttribute("durationFee1",durationFee1); - // 预定费用 - model.addAttribute("reservationFee",reservationFee); + if(null != ptCancel1){ + JSONObject jsonObject = JSON.parseObject(ptCancel1.getContent()); + model.addAttribute("driverTimeout",jsonObject.getIntValue("driverTimeout")); + // 订单取消规则 + JSONObject order = jsonObject.getJSONObject("order"); + String orderAcceptanceTime = order.getString("orderAcceptanceTime"); + String money = order.getString("money"); + String mileageFee = order.getString("mileageFee"); + String durationFee = order.getString("durationFee"); + // 接单xx分钟后 + model.addAttribute("orderAcceptanceTime",orderAcceptanceTime); + // 取消订单金额 + model.addAttribute("money",money); + // 时长费 + model.addAttribute("mileageFee",mileageFee); + // 分钟 + model.addAttribute("durationFee",durationFee); + // 预约单取消规则 + JSONObject reservationOrder = jsonObject.getJSONObject("reservationOrder"); + String orderAcceptanceTime1 = reservationOrder.getString("orderAcceptanceTime"); + String money1 = reservationOrder.getString("money"); + String mileageFee1 = reservationOrder.getString("mileageFee"); + String durationFee1 = reservationOrder.getString("durationFee"); + String reservationFee = reservationOrder.getString("reservationFee"); + // 预约单接单xx分钟后 + model.addAttribute("orderAcceptanceTime1",orderAcceptanceTime1); + // 预约单取消订单金额 + model.addAttribute("money1",money1); + // 预约单时长费 + model.addAttribute("mileageFee1",mileageFee1); + // 预约单分钟 + model.addAttribute("durationFee1",durationFee1); + // 预定费用 + model.addAttribute("reservationFee",reservationFee); + }else{ + model.addAttribute("driverTimeout", ""); + // 接单xx分钟后 + model.addAttribute("orderAcceptanceTime", ""); + // 取消订单金额 + model.addAttribute("money",""); + // 时长费 + model.addAttribute("mileageFee",""); + // 分钟 + model.addAttribute("durationFee",""); + // 预约单取消规则 + // 预约单接单xx分钟后 + model.addAttribute("orderAcceptanceTime1",""); + // 预约单取消订单金额 + model.addAttribute("money1",""); + // 预约单时长费 + model.addAttribute("mileageFee1",""); + // 预约单分钟 + model.addAttribute("durationFee1",""); + // 预定费用 + model.addAttribute("reservationFee",""); + } // 超时设置 TSysOverTime overTime = sysOverTimeService.selectOne(new EntityWrapper<TSysOverTime>().eq("companyId", ShiroKit.getUser().getObjectId())); -- Gitblit v1.7.1