From e2ade1791438256f0aea9e7a6ed635be3231c064 Mon Sep 17 00:00:00 2001 From: "2265829957@qq.com" <2265829957@qq.com> Date: Thu, 5 Mar 2026 10:08:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=A0=E4=BD=8D=E8=B4=B9?= =?UTF-8?q?=E3=80=81=E5=B7=A1=E6=A3=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../evcs/api/CheckChargeOrderController.java | 2 +- .../XhpcClearingCheckoutController.java | 12 + .../service/XhpcClearingCheckoutService.java | 3 + .../impl/XhpcClearingCheckoutServiceImpl.java | 90 +++ .../mapper/XhpcClearingHistoryOrderMapper.xml | 1 + .../XhpcChargingStationServiceImpl.java | 12 + .../com/xhpc/common/api/PileOrderService.java | 2 + .../api/factory/PileOrderFallbackFactory.java | 5 + .../xhpc/common/data/up/ReturnGunGecord.java | 56 ++ .../com/xhpc/common/util/UserTypeUtil.java | 4 +- .../order/api/XhpcPileOrderController.java | 60 +- .../XhpcHistoryOrderController.java | 10 + .../controller/XhpcInspectionController.java | 7 +- .../XhpcPlaceholderOrderController.java | 12 +- .../controller/XhpcStatisticsController.java | 200 ++++++- .../com/xhpc/order/domain/XhpcInspection.java | 2 +- .../order/mapper/XhpcHistoryOrderMapper.java | 3 + .../order/mapper/XhpcInspectionMapper.java | 25 +- .../mapper/XhpcPlaceholderOrderMapper.java | 10 +- .../service/IXhpcHistoryOrderService.java | 1 + .../order/service/IXhpcInspectionService.java | 4 +- .../service/IXhpcPlaceholderOrderService.java | 2 + .../impl/XhpcChargeOrderServiceImpl.java | 5 +- .../impl/XhpcHistoryOrderServiceImpl.java | 42 ++ .../impl/XhpcInspectionServiceImpl.java | 533 ++++++++++++------ .../impl/XhpcPlaceholderOrderServiceImpl.java | 434 +++++++++++++- .../impl/XhpcRealTimeOrderServiceImpl.java | 2 +- .../mapper/XhpcHistoryOrderMapper.xml | 96 +++- .../resources/mapper/XhpcInspectionMapper.xml | 174 +++++- .../mapper/XhpcPlaceholderOrderMapper.xml | 77 ++- .../resources/mapper/XhpcStatisticsMapper.xml | 3 + .../xhpc/pp/logic/ReturnGunGecordLogic.java | 74 +++ .../src/main/resources/svcmainlogic.xml | 2 + .../controller/XhpcMotorcadeController.java | 12 +- .../com/xhpc/user/domain/XhpcMotorcade.java | 1 + .../xhpc/user/service/IMechanismService.java | 2 + .../user/service/IXhpcMotorcadeService.java | 3 + .../impl/XhpcMotorcadeServiceImpl.java | 37 +- .../resources/mapper/XhpcMotorcadeMapper.xml | 2 +- 39 files changed, 1752 insertions(+), 270 deletions(-) create mode 100644 xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/data/up/ReturnGunGecord.java create mode 100644 xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/ReturnGunGecordLogic.java diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/CheckChargeOrderController.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/CheckChargeOrderController.java index 4aed8ce8..7b8978ae 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/CheckChargeOrderController.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/CheckChargeOrderController.java @@ -147,7 +147,7 @@ public class CheckChargeOrderController { // // System.out.println("==========sss==============="+s); - String date= "NR0oe4La+0SLizVoKCDfRkj37avo59qzZBUm7BFSmU+XA81uaP2614Vjbb7VvhRRumS4LwHu6CR981cKMxNM57w7bhdEl/7Q0euTasU7M8cc8gQlgjXhwKnngJ47lusklAi1XcN8H4FV+QIKt6EtPKGS1J3fbsT/OD92OB7EtyWXsUKgVUICJbPGbAtdRJFCuH4eW0wsVpO7mma72I5Dj7+NFWzbPhNo7hb/eYyMXySxj/K1srxf9cgn1r80W/Rc0RXXoc+Fcg7vAoOmol7W/CMCwuY7k1nAs54iuHAxBUfHTv9vYggsRTc+qgyWp7EAIarrl+MsFqUx0VNMZtka55ORDQ5DKZldrmgdseQm4EcT9XwdARwQr8t/Rl12Xfkt157tjQZGeVmjin6wc0waR/Y+FG6do9Yckdrk+lVMrvgL0WfeQXfRlCBy7oFcv5YeqdF529egpZER8SH3suDa/Qlyb6I/3AjEITbjni414vo5QL+SEuQoR5NybOCVHK0BDHylmxtG8M5fPUU0cLZjdpQwpHRkzSIrIIqSPJpSB26jWi1tcHrij8NdYUIzTlWwtJkwpfQX13p+n7cbwaYOl0345AhB7ugpTCCu7WO+ij49b6lcT/3gHXKpmMbr6Pe26eyFkdUMndgyNcC1CmvkhiSoDxAXgb9uHjgEPqv+uEhxvC3zKHr5Q/Trbof4PU1X01lXFoeIU3w+kj+y+JkQXU9iwk2DHt6YuM//O26zZPXygjsZX9GQSqprW9x2C85MfT66RZddfhzkqclSb3rJv7W9CeLj8Hwo4JPaPTEIGHFGwUsfyQqt8tiU0qy72TKymW95617++Q07qCCEdLDXWoT/w6hViG2DSspfLLbYTGeLo8gThDL64EyPPNDKE5i7srm27ag6X8ZhnRwtT7Qn3rw5+1Y58Nw8ByHLpb3dKCNTq82Mt+A+s7XXzRFIdrG6G2XlVOzj93AhU3EX+Yr2x1Z2x0L2MtQSyKI8T2NFVa2ho7+2pYdlGEiRpp1OVfXRr3LJotYdvtEbmVT9vkfVcCRfHjQ/DH5C+GgoxkKLQm/4k9B5aKOxV11K4XUQYh+zOPjVdOU5BpIrMyPIeYa5ZNEZJq88LIgoGfFBa2v1JUAgFxg63ed5PzG8Tj+HnYhnRCF9YeOKet1U7TlCvjXUwMVjcs3bZryztyBe6EbqL0QgYTEGAO0vsMXn78sZdShrwXf9+S7rCG7h6I2zMDLHMzhQxcHX724Fr8DkUs8S3fnww+ufcCcIuQhbr0fNgdS+p7cpC1S/zePnCxYr4rfK8Wyc3+3UxV5ocniX2rcrF+MIqigiS4xy+j4aSxmJDeY4SeiEss3ep1sF++fOzyxp+z4aKIi0lNZkJYHyjLAd+MyZxfTumJFhSG4i4HJ7kAAM+q1kHZIRm7W+i64kAKfCixueZrFNGzKwjugsSw+0tyT1pPmVDFyztfZnSlxwpH9ZQGV9leONxF2oyOqmgXwqZ174nGDuPBl5rbKehM+pmP0V4ZFgOyHh1XKIwD8Gg/KVHGEb11wrg5AC2/7Vev2StkNCrbLyzVQD8Wo4jPjBpCyDYlCCveOe2A+Vt5jhLWMFWgQKTWl6ZMJ7vksAzPLfqKhv/2KqjoXNNZdcU1eIeJO0aXcRLKnzAMHcooqg0gpt+asL/pMvFUuliYlbyCJNdt2XMjcVana/uqKsqfbtZNXKzRaQzGxNYWwj6MPAkYqhbRvdYFv9VWL43YJm6Bly2V1rAQx4nKj0YdOYO5XSuSQ6hvM99ioI8w5zeKJdwjzkfaXgNjUAVobmnRpRNoX4kyoDOkVuPfnWe98IWv4BH+Ge1xnaXoxQBeV3t7CEYYh5wsuS/ulNrY9h0ZH+RKNN1B9FjVoh0nQXdIXTI89FGEcrTCJ6OwMg+ULTNxwd/ri98Ym/bjwPBxMnAK6socek6eugm0SxKsgN111oAzqlCfbgwHdruymvPMVaL7y2r5sna70dnWU9bu2tOJnhupMxcZeJYCqkhuo3w8LeRvVgRZ+oWrNl31x3tpnvOiT7x+hdt6rayNboYXKuhVZQ7YjuW8R5Ud09hN8SVoPHPi/3cdoVqnX0tV3M3rZY+aTPxAYoWwtl/vl7bRydfjuy2X5CD+hr5X8YR2KhJqCzc7GWusinzGAY0BVTHqkisGo8EqzacGD1mWrMSdTWqoPnzqogLbcAnzxI2Dt1HR38fEIo+sS8AtTOacrx6F8GyvRw96ZnXcnuViy3Mr58lkAZ8p3qwFfBTlsYziMfKKZSOHFV8ZUwTyyXqpE+M4iRxSCByaGDZ52MuvRg6Sowr9GaGE+gS6R4tg3/tUfebRLZEO1mZdEV/9xSFtPSUdCVLyEVAxHtjVOclI9RtJNmbzHEGhx/RKuo5BOVmiheMRXYHgwayhzpczOOJshlb93yVzVfwH6YuXUI26fEZppdF/daCx+T31xB8gYk0O+anRGEs6JueNifPISPfn818k8nKYvGb2Mim+bQT8ML9eOvl/2vVCE5He6m5mmkfmHp6cmcnAqsjU8Q11LN24JskAMfa6QmFfOUFF1vo+qIjEz7j6Ei1s7iMJAo8tXyB7HxLt5SxjaD4IXTy2mPfC8i/c0J2Bv6fhvPoJa2KPZy5hEi/sR6fvCXLHNErzbhi4HBtuKwpxPfsBZ+zPuyKf9GaAtB9Vp1P/5DZeBJWnCzpcVutWbSRwnYgIrKMj3pbHCYCwNI/9EbUJzGwy+UdD2eWeVs85iEGfQwb7usoj5/Vk9SRSyh+oV3qhnQLrDTsAwrd3EgSz7AR6y2qmgb2JY0zzobNKoEy58vb3k/Q0JlkjImwAeIhaxhjh5OgvTkH/Mz1Yg/KCDaMaI+5Hg+moVncfVkN9OQ6UW3k5E6b8qpZXmyhZ4zncCiF55IThPw3omlKQ//ck+KiF4=" ; + String date= "ywyEEd5aKPJOTraAY/gXBxX6qL9+xRX4dEBcxpmT1ylQ/2kIMRcIYozP9GR/DIYQqRm9a6/s5ZnVkjEHsOEbNdVUF00crSZfRIDHbfiDkQdLjJiBVuCU7b1lu5+QYR2CJzFfLIKZc9QYpt+/1PToDvzcbrvR4eLwSANt3H5sh+CSxnPjPhGaJNwOtQnMLLxOthBctkcW+aSF4O3s2KqnCvAB3O9OiQSLxfW1UZ0I0x0JvAMxY+Z4ncc4k16noCWCojVxFYQGITvXMH8ySQQ25A=="; String s2 = decryptString(date, "8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6"); diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcClearingCheckoutController.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcClearingCheckoutController.java index 81680628..2245484c 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcClearingCheckoutController.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcClearingCheckoutController.java @@ -169,4 +169,16 @@ public class XhpcClearingCheckoutController extends BaseController { return getDataTable(listPage); } + + @PostMapping("/getListPageExport") + public void getListPageExport(HttpServletRequest request, HttpServletResponse response,String phone, String transactionNumber, @RequestParam("status") Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, @RequestParam("userId") Long userId, Integer type, + String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult, Integer checkoutId)throws IOException { + LoginUser loginUser = logUserUtils.getLogUser(request); + if(operatorId == null || operatorId == 0){ + operatorId = loginUser.getSysUser().getOperatorId(); + } + + checkoutService.getListPageExport(response,phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, checkoutId); + + } } diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/XhpcClearingCheckoutService.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/XhpcClearingCheckoutService.java index e02d5e63..ee3f84d7 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/XhpcClearingCheckoutService.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/XhpcClearingCheckoutService.java @@ -34,4 +34,7 @@ public interface XhpcClearingCheckoutService { */ List> getListPage(String phone,String transactionNumber,Integer status,String chargingStationName,Long operatorId,Integer source,String beginStartTime,String beginEndTime,Long userId,Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId,Integer confirmResult, Integer checkoutId); + + void getListPageExport(HttpServletResponse response,String phone,String transactionNumber,Integer status,String chargingStationName,Long operatorId,Integer source,String beginStartTime,String beginEndTime,Long userId,Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId,Integer confirmResult, Integer checkoutId) throws IOException; + } diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/XhpcClearingCheckoutServiceImpl.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/XhpcClearingCheckoutServiceImpl.java index 13edfd91..947697c3 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/XhpcClearingCheckoutServiceImpl.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/XhpcClearingCheckoutServiceImpl.java @@ -415,4 +415,94 @@ public class XhpcClearingCheckoutServiceImpl extends BaseService implements Xhpc return list; } + + + @Override + public void getListPageExport(HttpServletResponse response,String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type, String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult, Integer checkoutId) throws IOException { + + Integer number = 0; + if (!"".equals(phone) && phone != null && !"".equals(source) && source != null) { + number = 3; + } else if (!"".equals(phone) && phone != null && source == null) { + number = 1; + } else if (phone == null && source != null) { + number = 2; + } + //获取登陆用户 + Long logUserId = SecurityUtils.getUserId(); + LoginUser loginUser = tokenService.getLoginUser(); + String tenantId = loginUser.getTenantId(); + //桩的统计、该时段金额 + List> list = new ArrayList<>(); + if (!userId.equals(UserTypeUtil.USER_ID)) { + Map landUser = historyOrderMapper.getLandUser(logUserId); + if (landUser != null) { + if (landUser.get("userType") != null) { + startPage(); + if (UserTypeUtil.SYS_USER_TYPE_ONE.equals(landUser.get("userType").toString())) { + Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); + //运营商看自己的场站 + list = historyOrderMapper.getOrderListPage(phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0, checkoutId); + } else { + //查询赋值的场站 + list = historyOrderMapper.getOrderListPage(phone, transactionNumber, 2, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0, checkoutId); + } + } + } + + } else { + startPage(); + list = historyOrderMapper.getOrderListPage(phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0, checkoutId); + } + + + Map params = new HashMap<>(); + // 通过工具类创建writer,默认创建xls格式 + BigExcelWriter writer = ExcelUtil.getBigWriter("HistoryOrder_" + System.currentTimeMillis() + ".xlsx"); + writer.addHeaderAlias("serialNumber", "订单号"); + writer.addHeaderAlias("sourceName", "用户类型"); + writer.addHeaderAlias("chargingModeName", "流量方名称"); + writer.addHeaderAlias("chargingStationName", "电站名称"); + writer.addHeaderAlias("terminalName", "终端名称"); + writer.addHeaderAlias("operatorName", "运营商"); + writer.addHeaderAlias("totalPower", "电量"); + writer.addHeaderAlias("powerPriceTotal", "电费(元)"); + writer.addHeaderAlias("servicePriceTotal", "服务费(元)"); + writer.addHeaderAlias("totalPrice", "订单总金额(元)"); + writer.addHeaderAlias("promotionDiscount", "抵扣总金额(元)"); + writer.addHeaderAlias("actPrice", "用户支付的金额(元)"); + writer.addHeaderAlias("internetCommission", "流量方总金额抽成(元)"); + writer.addHeaderAlias("internetSvcCommission", "流量方服务费抽成(元)"); + writer.addHeaderAlias("internetDegreeCommission", "流量方电量抽成(元)"); + writer.addHeaderAlias("platformCommission", "平台总金额抽成(元)"); + writer.addHeaderAlias("platformSvcCommisssion", "平台服务费抽成(元)"); + writer.addHeaderAlias("operationCommission", "运维总抽成(元)"); + writer.addHeaderAlias("operationSvcCommission", "运维服务费抽成(元)"); + writer.addHeaderAlias("actPowerPrice", "运营商实收电费(元)"); + writer.addHeaderAlias("actServicePrice", "运营商实收服务费(元)"); + writer.addHeaderAlias("startSoc", "启动SOC"); + writer.addHeaderAlias("endSoc", "结算SOC"); + writer.addHeaderAlias("startTime", "开始充电时间"); + writer.addHeaderAlias("endTime", "结束充电时间"); + // 默认的,未添加alias的属性也会写出,如果想只写出加了别名的字段,可以调用此方法排除之 + writer.setOnlyAlias(true); + // 一次性写出内容,使用默认样式,强制输出标题 + writer.write(list, true); + //out为OutputStream,需要写出到的目标流 + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); +// //response为HttpServletResponse对象 +// response.setContentType("application/vnd.ms-excel;charset=utf-8"); +// //test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码 +// response.setHeader("Content-Disposition", "attachment;filename=历史订单列表.xls"); + ServletOutputStream out = response.getOutputStream(); + + writer.flush(out, true); + // 关闭writer,释放内存 + writer.close(); + //此处记得关闭输出Servlet流 + IoUtil.close(out); + + + } } diff --git a/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcClearingHistoryOrderMapper.xml b/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcClearingHistoryOrderMapper.xml index bb2b2dfb..6891bbc8 100644 --- a/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcClearingHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcClearingHistoryOrderMapper.xml @@ -584,6 +584,7 @@ co.charge_order_id as chargeOrderId, ho.serial_number as serialNumber, ct.name as chargingStationName, + ho.total_power as totalPower, ter.pile_serial_number as pileSerialNumber, ter.name as terminalName, op.operator_id as operatorId, diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java index e643e3d2..14145a21 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java @@ -37,6 +37,8 @@ import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; +import static org.bouncycastle.asn1.x500.style.RFC4519Style.serialNumber; + /** * 电站Service业务层处理 @@ -1386,6 +1388,16 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc //修改桩和终端的模板id xhpcChargingStationMapper.updateXhpcChargingPile(chargingStationId,rateModelId); xhpcChargingStationMapper.updateXhpcTerminal(chargingStationId,rateModelId); + + //发送校时校价命令 + Set pileList = xhpcChargingStationMapper.getXchargingPileList(chargingStationId); + if(pileList.size()>0){ + List setlist = new ArrayList<>(pileList); + for (int j = 0; j > listPage = xhpcHistoryOrderService.getTerminalListPage(request,terminalId,chargingStationId); + return getDataTable(listPage); + } + } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcInspectionController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcInspectionController.java index ed720520..a843f36b 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcInspectionController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcInspectionController.java @@ -30,8 +30,8 @@ public class XhpcInspectionController extends BaseController { @GetMapping("/getDataBoard") - public AjaxResult getDataBoard(){ - return AjaxResult.success(xhpcInspectionService.getDataBoard()); + public AjaxResult getDataBoard(HttpServletRequest request){ + return AjaxResult.success(xhpcInspectionService.getDataBoard(request)); } @GetMapping("/getRealTimeWarning") @@ -70,8 +70,7 @@ public class XhpcInspectionController extends BaseController { public AjaxResult getInspectionList(@Param("stationId") Long stationId, String time) { //stationName:场站名称 twoDayOrder:订单量 emptyOrderRate:空订单率 // normal:正常 offline:离线 fault:故障 "未知": 3 - - List> inspectionList = xhpcInspectionService.getInspectionList(stationId, time); + Map inspectionList = xhpcInspectionService.getInspectionList(stationId, time); return AjaxResult.success(inspectionList); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcPlaceholderOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcPlaceholderOrderController.java index dfbd4c59..d56b2227 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcPlaceholderOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcPlaceholderOrderController.java @@ -104,14 +104,22 @@ public class XhpcPlaceholderOrderController extends BaseController { xhpcPlaceholderOrderService.getTimingPriceTime(gunNumber); } - //超过360分钟的都变成异常订单 + + //归枪记录 + @GetMapping("/getReturnGunRecord") + public void getReturnGunRecord(@RequestParam(value = "serialNumber")String serialNumber,@RequestParam(value = "startTime")String startTime,@RequestParam(value = "endTime")String endTime) { + xhpcPlaceholderOrderService.getReturnGunRecord(serialNumber,startTime,endTime); + } + + //超过720分钟的都变成异常订单 @Scheduled(cron = "0 0/5 * * * ? ") public void getAbnormal() { xhpcPlaceholderOrderService.getAbnormal(); } //查询标记为状态 type=3,手动处理的订单 - @Scheduled(cron = "0 0/5 * * * ? ") + //@Scheduled(cron = "0 0/5 * * * ? ") + @GetMapping("/getType") public void getType() { xhpcPlaceholderOrderService.getType(); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStatisticsController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStatisticsController.java index 7b260f67..8957ea66 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStatisticsController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStatisticsController.java @@ -5,6 +5,7 @@ import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.order.service.IXhpcStatisticsService; import io.swagger.annotations.Api; +import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -13,9 +14,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @author yuyang @@ -497,4 +496,199 @@ public class XhpcStatisticsController extends BaseController { { xhpcStatisticsService.getChargingPileStatusPageExport(request,response,chargingStationId,serialNumber,statusName,startTime,endTime); } + + + + //-----------------------运维小程序----getDataBoard-------------------- + @GetMapping("/getDataBoard") + public AjaxResult getDataBoard(){ + Map map1 =new HashMap<>(); + map1.put("stationSum",11); + map1.put("abnormalStation",1); + map1.put("todayOrder",236); + map1.put("emptyOrderRate","23.56"); + map1.put("completionRate","75%"); + map1.put("onlineRate","93.5%"); + return AjaxResult.success(map1); + } + + @GetMapping("/getRealTimeWarning") + public AjaxResult getRealTimeWarning(){ + List> mapList =new ArrayList<>(); + + Map map1 =new HashMap<>(); + map1.put("stationName","小华充电团结平安村充电站"); + map1.put("terminalName","4号桩B枪"); + map1.put("time","2026-2-5 08:35:45"); + map1.put("conent","离线时间超过2小时"); + mapList.add(map1); + + Map map2 =new HashMap<>(); + map2.put("stationName","小华充电团结平安村充电站"); + map2.put("terminalName","3号桩B枪"); + map2.put("time","2026-2-4 08:35:45"); + map2.put("conent","离线时间超过1小时"); + mapList.add(map2); + + + return AjaxResult.success(mapList); + } + + + @GetMapping("/getStationList") + public AjaxResult getStationList() { + //stationName:场站名称 twoDayOrder:订单量 emptyOrderRate:空订单率 + // normal:正常 offline:离线 fault:故障 "未知": 3 + List> mapList = new ArrayList<>(); + + Map map1 = new HashMap<>(); + map1.put("stationName", "小华充电团结平安村充电站"); + map1.put("stationId",1); + map1.put("twoDayOrder", "243"); + map1.put("emptyOrderRate", "34.8%"); + map1.put("normal", 7); + map1.put("offline", 1); + map1.put("fault", 2); + map1.put("unknown", 3); + mapList.add(map1); + + Map map2 = new HashMap<>(); + map2.put("stationName", "小华充电高堆路充电站"); + map2.put("stationId",2); + map2.put("twoDayOrder", "2430"); + map2.put("emptyOrderRate", "34.8%"); + map2.put("normal", 15); + map2.put("offline", 1); + map2.put("fault", 2); + map2.put("unknown", 3); + mapList.add(map2); + return AjaxResult.success(mapList); + } + + + + @GetMapping("/getInspectionList") + public AjaxResult getInspectionList(@Param("stationId") Long stationId,String time) { + //stationName:场站名称 twoDayOrder:订单量 emptyOrderRate:空订单率 + // normal:正常 offline:离线 fault:故障 "未知": 3 + // 系统自动生成每日巡检项23:50 + List> mapList = new ArrayList<>(); + + Map map1 = new HashMap<>(); + map1.put("name", "箱变"); + map1.put("status", 0); + map1.put("id", "XB"); + mapList.add(map1); + + Map map2 = new HashMap<>(); + map2.put("name", "监控"); + map2.put("status", 1); + map2.put("id", "JK"); + mapList.add(map2); + + Map map3 = new HashMap<>(); + map3.put("name", "道闸"); + map3.put("status", 1); + map3.put("id", "DZ"); + mapList.add(map3); + + Map map4 = new HashMap<>(); + map4.put("name", "远程连接"); + map4.put("status", 1); + map4.put("id", "YC"); + mapList.add(map4); + + Map map5 = new HashMap<>(); + map5.put("name", "1号桩"); + map5.put("status", 1); + map5.put("id", "1"); + mapList.add(map5); + + Map map6 = new HashMap<>(); + map6.put("name", "2号桩"); + map6.put("status", 0); + map6.put("id", "2"); + map6.put("errorName", "A枪故障"); + mapList.add(map6); + + Map map7 = new HashMap<>(); + map7.put("name", "3号桩"); + map7.put("status", 0); + map7.put("id", "3"); + mapList.add(map7); + + Map map8 = new HashMap<>(); + map8.put("name", "4号桩"); + map8.put("status", 0); + map8.put("id", "4"); + mapList.add(map8); + + Map map9 = new HashMap<>(); + map9.put("name", "5号桩"); + map9.put("status", 0); + map9.put("id", "5"); + mapList.add(map9); + + Map map10 = new HashMap<>(); + map10.put("name", "6号桩"); + map10.put("status", 3); + map10.put("id", "6"); + map6.put("errorName", "停用"); + mapList.add(map10); + + Map map11 = new HashMap<>(); + map11.put("name", "7号桩"); + map11.put("status", 0); + map11.put("id", "7"); + mapList.add(map11); + + Map map12 = new HashMap<>(); + map12.put("name", "8号桩"); + map12.put("status", 0); + map12.put("id", "8"); + mapList.add(map12); + + Map map13 = new HashMap<>(); + map13.put("name", "9号桩"); + map13.put("status", 0); + map13.put("id", "9"); + mapList.add(map13); + + Map map14 = new HashMap<>(); + map14.put("name", "10号桩"); + map14.put("status", 0); + map14.put("id", "10"); + mapList.add(map14); + + return AjaxResult.success(mapList); + } + + @GetMapping("/getInspectionById") + public AjaxResult getInspectionById(@Param("stationId") Long stationId,@Param("id") String id) { + //stationName:场站名称 twoDayOrder:订单量 emptyOrderRate:空订单率 + // normal:正常 offline:离线 fault:故障 "未知": 3 + + if(stationId==1L && id.equals("XB")){ + Map map1 = new HashMap<>(); + map1.put("status", 1); + map1.put("inspectionImg", "avatar/032dacfa3b87aa4e11e62bbefcd5352.png,avatar/logo.png"); + map1.put("faultImg", ""); + map1.put("faultDescription", ""); + map1.put("maintenanceRecord", ""); + + return AjaxResult.success(map1); + }else if(stationId==1L && id.equals("DZ")){ + Map map1 = new HashMap<>(); + map1.put("status", 2); + map1.put("inspectionImg", "avatar/032dacfa3b87aa4e11e62bbefcd5352.png,avatar/logo.png"); + map1.put("faultImg", "power/11.png,power/222.jpg,power/333.jpg"); + map1.put("faultDescription", "显示屏损坏"); + map1.put("maintenanceRecord", "已更换显示屏"); + + return AjaxResult.success(map1); + } + + return AjaxResult.success(); + } + } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcInspection.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcInspection.java index 88298531..57a07ce7 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcInspection.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcInspection.java @@ -28,7 +28,7 @@ public class XhpcInspection extends BaseEntity { private Integer delFlag; - private String dataIime; + private String dataTime; private Integer type; diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java index bc3fa833..cbd0e68a 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java @@ -162,4 +162,7 @@ public interface XhpcHistoryOrderMapper { List> getXhpcHistoryOrderChargeDetailsList(@Param("historyOrderId")Long historyOrderId); + + List> getTerminalListPage(@Param("terminalId")Long terminalId,@Param("status")Integer status,@Param("operatorId")Long operatorId,@Param("chargingStationId")Long chargingStationId); + } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcInspectionMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcInspectionMapper.java index 9711f334..bbfc7466 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcInspectionMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcInspectionMapper.java @@ -11,7 +11,9 @@ public interface XhpcInspectionMapper { List> getInspectionList(@Param("stationId") Long stationId,@Param("time") String time); - List> getInspectionChargingStation(); + Map getInspectionZTList(@Param("stationId") Long stationId,@Param("time") String time); + + List> getInspectionChargingStation(@Param("chargingStationId")Long chargingStationId); int installInspection(XhpcInspection xhpcInspection); @@ -27,17 +29,24 @@ public interface XhpcInspectionMapper { List> getInspectionUserList(@Param("userId") Long userId); - int stationSum(); + int stationSum(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId); - Integer abnormalStation(@Param("time") String time); + Integer abnormalStation(@Param("time") String time,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId); - int todayOrder(@Param("time") String time); + Map todayOrder(@Param("time") String time,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId); - int emptyOrderRate(@Param("time") String time); + int emptyOrderRate(@Param("time") String time,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId); - String completionRate(@Param("time") String time); + String completionRate(@Param("time") String time,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId); - List> getChargingStationList(); + List> getChargingStationList(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId); + + BigDecimal onlineRate(@Param("normal")int normal,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId); + + Map getChargingStationOrder(@Param("time") String time,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId,@Param("chargingStationId")Long chargingStationId); + + XhpcInspection getXhpcInspectionById(@Param("inspectionId")Long inspectionId); + + int updateXhpcInspectionType(@Param("chargingStationId")Long chargingStationId,@Param("time") String time); - BigDecimal onlineRate(int normal); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcPlaceholderOrderMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcPlaceholderOrderMapper.java index 0530d69b..4352790b 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcPlaceholderOrderMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcPlaceholderOrderMapper.java @@ -22,6 +22,10 @@ public interface XhpcPlaceholderOrderMapper { XhpcPlaceholderOrder getXhpcPlaceholderOrderSerialNumber(@Param("serialNumber") String serialNumber); + XhpcPlaceholderOrder getReturnGunRecord(@Param("serialNumber") String serialNumber); + + int getXhpcHistoryOrderTotalPrice(@Param("serialNumber") String serialNumber,@Param("type")Integer type); + int getXhpcChargeOrderStatus(@Param("serialNumber") String serialNumber); List getXhpcPlaceholderTime(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("placeholderId")Long placeholderId); @@ -112,7 +116,11 @@ public interface XhpcPlaceholderOrderMapper { List> getType(); - Map getXhpcPlaceholderOrderType(@Param("chargeOrderNo") String chargeOrderNo ,@Param("gunNumber") String gunNumber); + int getXhpcHistoryOrderNextOrderTime(@Param("historyOrderId")Long historyOrderId,@Param("terminalId")Long terminalId,@Param("startTime") String startTime); + + + + } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java index a20e56a3..ba25cec8 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java @@ -161,5 +161,6 @@ public interface IXhpcHistoryOrderService { R fileUpload(HttpServletRequest request, HttpServletResponse response, String tenantId, MultipartFile file, int type, String startTime, String endTime) throws Exception; + List> getTerminalListPage(HttpServletRequest request,Long terminalId,Long chargingStationId); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcInspectionService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcInspectionService.java index fea40c87..9f9d4b60 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcInspectionService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcInspectionService.java @@ -9,7 +9,7 @@ import java.util.Map; public interface IXhpcInspectionService { - List> getInspectionList( Long stationId, String time); + Map getInspectionList( Long stationId, String time); void timing(); @@ -21,5 +21,5 @@ public interface IXhpcInspectionService { List> getInspectionUserList(HttpServletRequest request); - Map getDataBoard(); + Map getDataBoard(HttpServletRequest request); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcPlaceholderOrderService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcPlaceholderOrderService.java index acba345c..9f82cd1a 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcPlaceholderOrderService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcPlaceholderOrderService.java @@ -23,6 +23,8 @@ public interface IXhpcPlaceholderOrderService { void getTimingPriceTime(String gunNumber); + void getReturnGunRecord(String serialNumber,String startTime,String endTime); + List> getListPage(String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type, String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult); List> getAbnormalListPage(String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type, String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java index 5986427b..2878d91c 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java @@ -1128,14 +1128,16 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar } String tenantId = xhpcTerminal.getTenantId(); long l1 = System.currentTimeMillis(); + logger.info("<<<<<<<<<<1111<<<<<<<<<<<<<>>>>>>>>>>>>>>>>"); R user = userTypeService.getUser(null, userId, userType, vinNumber,tenantId); long l2 = System.currentTimeMillis(); - + logger.info("<<<<<<<<<<2222<<<<<<<<<<<<<>>>>>>>>>>>>>>>>"); Map userMessage = (Map)user.getData(); if(UserTypeUtil.USER_TYPE !=userType){ if(Integer.valueOf(userMessage.get("number").toString())==0){ return R.fail(UserTypeUtil.LOGIN_TYPE, "此账号不能在该场站充电,请使用手机号登录"); } + logger.info("<<<<<<<<<<66666<<<<<<<<<<<<<>>>>>>>>>>>>>>>>"); } String pattern = "^([0-9]{16})"; Pattern compile = Pattern.compile(pattern); @@ -1148,6 +1150,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar if (userMessage == null || userMessage.get("balance") == null || a.compareTo(new BigDecimal(userMessage.get("balance").toString())) == 1) { return R.fail(1100, "金额小于5元,不能充电,请充值后再进行充电"); } + logger.info("<<<<<<<<<<333<<<<<<<<<<<<<>>>>>>>>>>>>>>>>"); //充电用户是否存在异常的订单 int j = xhpcChargeOrderMapper.countXhpcChargeOrder(userId,userType,tenantId); if (j > 0) { diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java index cd5320b1..149937f0 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java @@ -698,6 +698,48 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis } + @Override + public List> getTerminalListPage(HttpServletRequest request, Long terminalId,Long chargingStationId) { + //获取登陆用户 + Long logUserId = SecurityUtils.getUserId(); + LoginUser loginUser = tokenService.getLoginUser(request); + //桩的统计、该时段金额 + List> list = new ArrayList<>(); + Long userId = loginUser.getUserid(); + SysUser sysUser = loginUser.getSysUser(); + if(UserTypeUtil.SYS_USER_TYPE_FOUR.equals(sysUser.getUserType())){ + //运维管理人员 + startPage(); + list = xhpcHistoryOrderMapper.getTerminalListPage(terminalId, 2, logUserId,chargingStationId); + }else{ + if(UserTypeUtil.SYS_SUPER_TYPE_ONE == loginUser.getSuperType()){ + list = xhpcHistoryOrderMapper.getTerminalListPage(terminalId, 0, userId,chargingStationId); + }else{ + if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ + startPage(); + if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ + Long logOperatorId = sysUser.getOperatorId(); + list = xhpcHistoryOrderMapper.getTerminalListPage(terminalId, 1, logOperatorId,chargingStationId); + }else{ + //查询赋值的场站 + list = xhpcHistoryOrderMapper.getTerminalListPage(terminalId, 2, logUserId,chargingStationId); + } + }else{ + startPage(); + list = xhpcHistoryOrderMapper.getTerminalListPage(terminalId, 0, userId,chargingStationId); + } + } + } + for (int i = 0; i map = list.get(i); + if(map!=null){ + map.put("stopReasonRvcsName",translate(map.get("stopReasonEvcs").toString())); + } + } + + return list; + } + /** * 历史信息费率时段 diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcInspectionServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcInspectionServiceImpl.java index 2708cf7e..a86154c1 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcInspectionServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcInspectionServiceImpl.java @@ -30,91 +30,137 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService { @Override - public List> getInspectionList(Long stationId, String time) { + public Map getInspectionList(Long stationId, String time) { String today = DateUtil.today(); - + Map map =new HashMap<>(); + List> list =new ArrayList<>(); if(time==null || "".equals(time)){ - return xhpcInspectionMapper.getInspectionList(stationId, today); + list = xhpcInspectionMapper.getInspectionList(stationId, today); + //单独获取整体场站数据 + Map zt = xhpcInspectionMapper.getInspectionZTList(stationId, today); + map.put("ZT",zt); + map.put("data",list); + }else{ + list = xhpcInspectionMapper.getInspectionList(stationId, time); + Map zt = xhpcInspectionMapper.getInspectionZTList(stationId, time); + map.put("ZT",zt); + map.put("data",list); } - - return xhpcInspectionMapper.getInspectionList(stationId, time); - - - + return map; } @Override public void timing() { + List> list = xhpcInspectionMapper.getChargingStationList(0,null,"000000"); + for (int k = 0; k stringMap = list.get(k); + Long stationId = Long.valueOf(stringMap.get("stationId").toString()); + //查询没有删除的场站,进行生成每日巡检任务 + List> mapList = xhpcInspectionMapper.getInspectionChargingStation(stationId); + for (int i = 0; i map = mapList.get(i); + String today = DateUtil.today(); + Long chargingStationId = Long.valueOf(map.get("chargingStationId").toString()); + Long terminalId = Long.valueOf(map.get("terminalId").toString()); + if(i==0){ - //查询没有删除的场站,进行生成每日巡检任务 - List> mapList = xhpcInspectionMapper.getInspectionChargingStation(); + XhpcInspection xhpcInspection6 = new XhpcInspection(); + xhpcInspection6.setName("场站整体照片"); + xhpcInspection6.setTerminalId(terminalId); + xhpcInspection6.setChargingStationId(chargingStationId); + xhpcInspection6.setStatus(0); + xhpcInspection6.setType(7); + xhpcInspection6.setDataTime(today); + xhpcInspection6.setCreateTime(new Date()); + xhpcInspection6.setTenantId("000000"); + xhpcInspectionMapper.installInspection(xhpcInspection6); - for (int i = 0; i map = mapList.get(i); - String today = DateUtil.today(); - Long chargingStationId = Long.valueOf(map.get("chargingStationId").toString()); - Long terminalId = Long.valueOf(map.get("terminalId").toString()); - if(i==0){ + XhpcInspection xhpcInspection = new XhpcInspection(); + xhpcInspection.setName("箱变"); + xhpcInspection.setChargingStationId(chargingStationId); + xhpcInspection.setTerminalId(terminalId); + xhpcInspection.setStatus(0); + xhpcInspection.setType(1); + xhpcInspection.setDataTime(today); + xhpcInspection.setCreateTime(new Date()); + xhpcInspection.setTenantId("000000"); + xhpcInspectionMapper.installInspection(xhpcInspection); + + XhpcInspection xhpcInspection1 = new XhpcInspection(); + xhpcInspection1.setName("监控"); + xhpcInspection1.setTerminalId(terminalId); + xhpcInspection1.setChargingStationId(chargingStationId); + xhpcInspection1.setStatus(0); + xhpcInspection1.setType(2); + xhpcInspection1.setDataTime(today); + xhpcInspection1.setCreateTime(new Date()); + xhpcInspection1.setTenantId("000000"); + xhpcInspectionMapper.installInspection(xhpcInspection1); + + XhpcInspection xhpcInspection2 = new XhpcInspection(); + xhpcInspection2.setName("道闸"); + xhpcInspection2.setTerminalId(terminalId); + xhpcInspection2.setChargingStationId(chargingStationId); + xhpcInspection2.setStatus(0); + xhpcInspection2.setType(3); + xhpcInspection2.setDataTime(today); + xhpcInspection2.setCreateTime(new Date()); + xhpcInspection2.setTenantId("000000"); + xhpcInspectionMapper.installInspection(xhpcInspection2); + + XhpcInspection xhpcInspection3 = new XhpcInspection(); + xhpcInspection3.setName("远程连接"); + xhpcInspection3.setTerminalId(terminalId); + xhpcInspection3.setChargingStationId(chargingStationId); + xhpcInspection3.setStatus(0); + xhpcInspection3.setType(4); + xhpcInspection3.setDataTime(today); + xhpcInspection3.setCreateTime(new Date()); + xhpcInspection3.setTenantId("000000"); + xhpcInspectionMapper.installInspection(xhpcInspection3); + + XhpcInspection xhpcInspection4 = new XhpcInspection(); + xhpcInspection4.setName("消防设备"); + xhpcInspection4.setTerminalId(terminalId); + xhpcInspection4.setChargingStationId(chargingStationId); + xhpcInspection4.setStatus(0); + xhpcInspection4.setType(5); + xhpcInspection4.setDataTime(today); + xhpcInspection4.setCreateTime(new Date()); + xhpcInspection4.setTenantId("000000"); + xhpcInspectionMapper.installInspection(xhpcInspection4); + + XhpcInspection xhpcInspection5 = new XhpcInspection(); + xhpcInspection5.setName("车档及防撞杆"); + xhpcInspection5.setTerminalId(terminalId); + xhpcInspection5.setChargingStationId(chargingStationId); + xhpcInspection5.setStatus(0); + xhpcInspection5.setType(6); + xhpcInspection5.setDataTime(today); + xhpcInspection5.setCreateTime(new Date()); + xhpcInspection5.setTenantId("000000"); + xhpcInspectionMapper.installInspection(xhpcInspection5); + + } XhpcInspection xhpcInspection = new XhpcInspection(); - xhpcInspection.setName("箱变"); + xhpcInspection.setName(map.get("name").toString()); xhpcInspection.setChargingStationId(chargingStationId); xhpcInspection.setTerminalId(terminalId); - xhpcInspection.setStatus(0); - xhpcInspection.setType(1); - xhpcInspection.setDataIime(today); xhpcInspection.setCreateTime(new Date()); - xhpcInspectionMapper.installInspection(xhpcInspection); - - XhpcInspection xhpcInspection1 = new XhpcInspection(); - xhpcInspection1.setName("监控"); - xhpcInspection1.setTerminalId(terminalId); - xhpcInspection1.setChargingStationId(chargingStationId); - xhpcInspection1.setStatus(0); - xhpcInspection1.setType(2); - xhpcInspection1.setDataIime(today); - xhpcInspection1.setCreateTime(new Date()); - xhpcInspectionMapper.installInspection(xhpcInspection1); - - XhpcInspection xhpcInspection2 = new XhpcInspection(); - xhpcInspection2.setName("道闸"); - xhpcInspection2.setTerminalId(terminalId); - xhpcInspection2.setChargingStationId(chargingStationId); - xhpcInspection2.setStatus(0); - xhpcInspection2.setType(3); - xhpcInspection2.setDataIime(today); - xhpcInspection2.setCreateTime(new Date()); - xhpcInspectionMapper.installInspection(xhpcInspection2); - - XhpcInspection xhpcInspection3 = new XhpcInspection(); - xhpcInspection3.setName("远程连接"); - xhpcInspection3.setTerminalId(terminalId); - xhpcInspection3.setChargingStationId(chargingStationId); - xhpcInspection3.setStatus(0); - xhpcInspection3.setType(4); - xhpcInspection3.setDataIime(today); - xhpcInspection3.setCreateTime(new Date()); - xhpcInspectionMapper.installInspection(xhpcInspection3); - - } - XhpcInspection xhpcInspection = new XhpcInspection(); - xhpcInspection.setName(map.get("name").toString()); - xhpcInspection.setChargingStationId(chargingStationId); - xhpcInspection.setTerminalId(terminalId); - xhpcInspection.setCreateTime(new Date()); - String statusY = map.get("status").toString(); - //System.out.println("statusY="+statusY); - //int status = Math.toIntExact(Long.getLong(map.get("status").toString())); - if("0".equals(statusY)){ - xhpcInspection.setStatus(0); - }else{ - xhpcInspection.setStatus(3); - if(map.get("prompt")!=null){ - xhpcInspection.setErrorName(map.get("prompt").toString()); + xhpcInspection.setTenantId("000000"); + String statusY = map.get("status").toString(); + if("0".equals(statusY)){ + xhpcInspection.setStatus(0); + }else{ + xhpcInspection.setStatus(3); + if(map.get("prompt")!=null){ + xhpcInspection.setErrorName(map.get("prompt").toString()); + } } + xhpcInspection.setType(0); + xhpcInspection.setDataTime(today); + xhpcInspectionMapper.installInspection(xhpcInspection); } - xhpcInspection.setType(0); - xhpcInspection.setDataIime(today); - xhpcInspectionMapper.installInspection(xhpcInspection); } } @@ -129,16 +175,30 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService { }else if(id.equals("JK")){ type=2; }else if(id.equals("YC")){ - type=2; + type=4; + }else if(id.equals("XF")){ + type=5; + }else if(id.equals("CD")){ + type=6; + }else if(id.equals("ZT")){ + type=7; } + Map map =xhpcInspectionMapper.getInspectionById(stationId,inspectionId,type); return AjaxResult.success(map); + } @Override public AjaxResult addInspection(HttpServletRequest request, XhpcInspection xhpcInspection) { LoginUser loginUser = tokenService.getLoginUser(request); + + XhpcInspection xhpcInspection1 = xhpcInspectionMapper.getXhpcInspectionById(xhpcInspection.getInspectionId()); + if(xhpcInspection1 !=null && xhpcInspection1.getType()==7){ + //所有type!=7相同场站和时间,没有巡检的变成已巡检 + xhpcInspectionMapper.updateXhpcInspectionType(xhpcInspection1.getChargingStationId(),xhpcInspection1.getDataTime()); + } xhpcInspection.setUserId(loginUser.getUserid()); xhpcInspectionMapper.updateInspection(xhpcInspection); return AjaxResult.success(); @@ -161,50 +221,20 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService { Long logUserId = SecurityUtils.getUserId(); SysUser sysUser = loginUser.getSysUser(); List> mapList =new ArrayList<>(); + System.out.println("======111================"); if(tenantId !=null && !"".equals(tenantId)){ - if(UserTypeUtil.SYS_USER_TYPE_FOUR.equals(sysUser.getUserType())){ - if(chargingStationId==null){ - //运维管理人员 - mapList= xhpcInspectionMapper.getChargingStationEmptyOrder(3,logUserId,tenantId,startTime,endTime); - }else { - //运营商看自己的场站 - mapList= xhpcInspectionMapper.getTerminalEmptyOrder(chargingStationId,3,logUserId,tenantId,startTime,endTime); + if(sysUser.getUserId() !=UserTypeUtil.USER_ID){ + Long logOperatorId = sysUser.getOperatorId(); + if ("01".equals(sysUser.getUserType())) { + mapList= xhpcInspectionMapper.getChargingStationEmptyOrder(1,logOperatorId,tenantId,startTime,endTime); + }else{ + System.out.println("======222================"); + mapList= xhpcInspectionMapper.getChargingStationEmptyOrder(2,logUserId,tenantId,startTime,endTime); } }else{ - if(chargingStationId==null){ - if(sysUser.getUserId() !=UserTypeUtil.USER_ID){ - Long logOperatorId = sysUser.getOperatorId(); - if ("01".equals(sysUser.getUserType())) { - //运营商看自己的场站 - mapList= xhpcInspectionMapper.getChargingStationEmptyOrder(1,logOperatorId,tenantId,startTime,endTime); - }else{ - //查询赋值的场站 - mapList= xhpcInspectionMapper.getChargingStationEmptyOrder(2,logUserId,tenantId,startTime,endTime); - } - }else{ - //全部桩 - mapList= xhpcInspectionMapper.getChargingStationEmptyOrder(0,null,tenantId,startTime,endTime); - } - }else{ - //单个场站空订单率 - if(sysUser.getUserId() !=UserTypeUtil.USER_ID){ - Long logOperatorId = sysUser.getOperatorId(); - if ("01".equals(sysUser.getUserType())) { - //运营商看自己的场站 - mapList= xhpcInspectionMapper.getTerminalEmptyOrder(chargingStationId,1,logOperatorId,tenantId,startTime,endTime); - }else{ - //查询赋值的场站 - mapList= xhpcInspectionMapper.getTerminalEmptyOrder(chargingStationId,2,logUserId,tenantId,startTime,endTime); - } - }else{ - //全部桩 - mapList= xhpcInspectionMapper.getTerminalEmptyOrder(chargingStationId,0,null,tenantId,startTime,endTime); - } - } - + mapList= xhpcInspectionMapper.getChargingStationEmptyOrder(0,null,tenantId,startTime,endTime); } } - //桩的状态 for (int j = 0; j < mapList.size(); j++) { Map objectMap = mapList.get(j); @@ -242,6 +272,26 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService { objectMap.put("offline", offline); objectMap.put("fault", fault); objectMap.put("unknown", unknown); + + if(tenantId !=null && !"".equals(tenantId)){ + if(sysUser.getUserId() !=UserTypeUtil.USER_ID){ + Long logOperatorId = sysUser.getOperatorId(); + if ("01".equals(sysUser.getUserType())) { + String today = DateUtil.today(); + Map todayOrderMap = xhpcInspectionMapper.getChargingStationOrder(today,1,logOperatorId,tenantId,stationId); + objectMap.putAll(todayOrderMap); + }else{ + System.out.println("======3333================"); + String today = DateUtil.today(); + Map todayOrderMap = xhpcInspectionMapper.getChargingStationOrder(today,2,logOperatorId,tenantId,stationId); + objectMap.putAll(todayOrderMap); + } + }else{ + String today = DateUtil.today(); + Map todayOrderMap = xhpcInspectionMapper.getChargingStationOrder(today,0,null,tenantId,stationId); + objectMap.putAll(todayOrderMap); + } + } } return mapList; } @@ -255,67 +305,232 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService { } @Override - public Map getDataBoard() { + public Map getDataBoard(HttpServletRequest request) { + + + LoginUser loginUser = tokenService.getLoginUser(request); Map map1 = new HashMap<>(); - //场站总数量 - int stationSum = xhpcInspectionMapper.stationSum(); - map1.put("stationSum",stationSum); - String today = DateUtil.today(); - Integer abnormalStation = xhpcInspectionMapper.abnormalStation(today); - if(abnormalStation==null){ + if(loginUser==null){ + map1.put("stationSum",0); map1.put("abnormalStation",0); - }else{ - map1.put("abnormalStation",abnormalStation); - } - - int todayOrder = xhpcInspectionMapper.todayOrder(today); - map1.put("todayOrder",todayOrder); - - int emptyOrderRate = xhpcInspectionMapper.emptyOrderRate(today); - if(emptyOrderRate==0){ + map1.put("todayOrder",0); map1.put("emptyOrderRate",0); - }else{ - double result = (double) todayOrder / emptyOrderRate; - String formatted = String.format("%.2f", result); - map1.put("emptyOrderRate",formatted); + map1.put("completionRate",0); + map1.put("onlineRate","0%"); + System.out.println("======4444================"); + return map1; } - String completionRate = xhpcInspectionMapper.completionRate(today); - map1.put("completionRate",completionRate); + String tenantId = loginUser.getTenantId(); + Long logUserId = SecurityUtils.getUserId(); + SysUser sysUser = loginUser.getSysUser(); + if(tenantId !=null && !"".equals(tenantId)){ + //单个场站空订单率 + if(sysUser.getUserId() !=UserTypeUtil.USER_ID){ + Long logOperatorId = sysUser.getOperatorId(); + if ("01".equals(sysUser.getUserType())) { + //运营商看自己的场站 + int stationSum = xhpcInspectionMapper.stationSum(1,logOperatorId,tenantId); + map1.put("stationSum",stationSum); - List> mapList = xhpcInspectionMapper.getChargingStationList(); - int normal=0; - for (int j = 0; j < mapList.size(); j++) { - Map objectMap = mapList.get(j); - Long stationId = Long.valueOf(objectMap.get("stationId").toString()); - List> list = xhpcInspectionMapper.getWXXhpcTerminalMassage(stationId); - if (list != null && list.size() > 0) { - for (int i = 0; i < list.size(); i++) { - Map map = list.get(i); - //终端状态用 redis数据 - if(map.get("serialNumber") !=null){ - Map cacheMap =redisService.getCacheMap("gun:"+map.get("serialNumber").toString()); - if(!cacheMap.isEmpty()){ - if ("离线".equals(cacheMap.get("status").toString())){ - }else if("故障".equals(cacheMap.get("status").toString())){ - }else if("空闲".equals(cacheMap.get("status").toString())){ - normal++; - }else{ - normal++; - } + String today = DateUtil.today(); + Integer abnormalStation = xhpcInspectionMapper.abnormalStation(today,1,logOperatorId,tenantId); + if(abnormalStation==null){ + map1.put("abnormalStation",0); }else{ - + map1.put("abnormalStation",abnormalStation); } + Map todayOrderMap = xhpcInspectionMapper.todayOrder(today,1,logOperatorId,tenantId); + + int todayOrder = Integer.valueOf(todayOrderMap.get("todayOrder").toString()); + map1.put("todayOrder",todayOrder); + map1.put("actPowerPrice",new BigDecimal(todayOrderMap.get("actPowerPrice").toString())); + map1.put("actServicePrice",new BigDecimal(todayOrderMap.get("actServicePrice").toString())); + map1.put("actTotalPrice",new BigDecimal(todayOrderMap.get("actTotalPrice").toString())); + map1.put("totalPower",new BigDecimal(todayOrderMap.get("totalPower").toString())); + int emptyOrderRate = xhpcInspectionMapper.emptyOrderRate(today,1,logOperatorId,tenantId); + if(emptyOrderRate==0){ + map1.put("emptyOrderRate",0); + }else{ + double result = (double) todayOrder / emptyOrderRate; + String formatted = String.format("%.2f", result); + map1.put("emptyOrderRate",formatted); + } + String completionRate = xhpcInspectionMapper.completionRate(today,1,logOperatorId,tenantId); + map1.put("completionRate",completionRate); + + List> mapList = xhpcInspectionMapper.getChargingStationList(1,logOperatorId,tenantId); + int normal=0; + for (int j = 0; j < mapList.size(); j++) { + Map objectMap = mapList.get(j); + Long stationId = Long.valueOf(objectMap.get("stationId").toString()); + List> list = xhpcInspectionMapper.getWXXhpcTerminalMassage(stationId); + if (list != null && list.size() > 0) { + for (int i = 0; i < list.size(); i++) { + Map map = list.get(i); + //终端状态用 redis数据 + if(map.get("serialNumber") !=null){ + Map cacheMap =redisService.getCacheMap("gun:"+map.get("serialNumber").toString()); + if(!cacheMap.isEmpty()){ + if ("离线".equals(cacheMap.get("status").toString())){ + }else if("故障".equals(cacheMap.get("status").toString())){ + }else if("空闲".equals(cacheMap.get("status").toString())){ + normal++; + }else{ + normal++; + } + }else{ + + } + }else{ + } + } + } + } + + BigDecimal bigDecimal = xhpcInspectionMapper.onlineRate(normal,1,logOperatorId,tenantId); + map1.put("onlineRate",bigDecimal+"%"); }else{ + System.out.println("======5555================"); + //场站总数量 + int stationSum = xhpcInspectionMapper.stationSum(2,logUserId,tenantId); + map1.put("stationSum",stationSum); + String today = DateUtil.today(); + Integer abnormalStation = xhpcInspectionMapper.abnormalStation(today,2,logOperatorId,tenantId); + if(abnormalStation==null){ + map1.put("abnormalStation",0); + }else{ + map1.put("abnormalStation",abnormalStation); + } + Map todayOrderMap = xhpcInspectionMapper.todayOrder(today,2,logOperatorId,tenantId); + int todayOrder = Integer.valueOf(todayOrderMap.get("todayOrder").toString()); + map1.put("todayOrder",todayOrder); + map1.put("actPowerPrice",new BigDecimal(todayOrderMap.get("actPowerPrice").toString())); + map1.put("actServicePrice",new BigDecimal(todayOrderMap.get("actServicePrice").toString())); + map1.put("actTotalPrice",new BigDecimal(todayOrderMap.get("actTotalPrice").toString())); + map1.put("totalPower",new BigDecimal(todayOrderMap.get("totalPower").toString())); + + int emptyOrderRate = xhpcInspectionMapper.emptyOrderRate(today,2,logOperatorId,tenantId); + if(emptyOrderRate==0){ + map1.put("emptyOrderRate",0); + }else{ + double result = (double) todayOrder / emptyOrderRate; + String formatted = String.format("%.2f", result); + map1.put("emptyOrderRate",formatted); + } + String completionRate = xhpcInspectionMapper.completionRate(today,2,logOperatorId,tenantId); + map1.put("completionRate",completionRate); + + List> mapList = xhpcInspectionMapper.getChargingStationList(2,logOperatorId,tenantId); + int normal=0; + for (int j = 0; j < mapList.size(); j++) { + Map objectMap = mapList.get(j); + Long stationId = Long.valueOf(objectMap.get("stationId").toString()); + List> list = xhpcInspectionMapper.getWXXhpcTerminalMassage(stationId); + if (list != null && list.size() > 0) { + for (int i = 0; i < list.size(); i++) { + Map map = list.get(i); + //终端状态用 redis数据 + if(map.get("serialNumber") !=null){ + Map cacheMap =redisService.getCacheMap("gun:"+map.get("serialNumber").toString()); + if(!cacheMap.isEmpty()){ + if ("离线".equals(cacheMap.get("status").toString())){ + }else if("故障".equals(cacheMap.get("status").toString())){ + }else if("空闲".equals(cacheMap.get("status").toString())){ + normal++; + }else{ + normal++; + } + }else{ + + } + }else{ + } + } + } + } + + BigDecimal bigDecimal = xhpcInspectionMapper.onlineRate(normal,2,logOperatorId,tenantId); + map1.put("onlineRate",bigDecimal+"%"); + } + }else{ + //全部桩 + int stationSum = xhpcInspectionMapper.stationSum(0,null,tenantId); + map1.put("stationSum",stationSum); + String today = DateUtil.today(); + Integer abnormalStation = xhpcInspectionMapper.abnormalStation(today,0,null,tenantId); + if(abnormalStation==null){ + map1.put("abnormalStation",0); + }else{ + map1.put("abnormalStation",abnormalStation); + } + Map todayOrderMap = xhpcInspectionMapper.todayOrder(today,0,null,tenantId); + int todayOrder = Integer.valueOf(todayOrderMap.get("todayOrder").toString()); + map1.put("todayOrder",todayOrder); + map1.put("actPowerPrice",new BigDecimal(todayOrderMap.get("actPowerPrice").toString())); + map1.put("actServicePrice",new BigDecimal(todayOrderMap.get("actServicePrice").toString())); + map1.put("actTotalPrice",new BigDecimal(todayOrderMap.get("actTotalPrice").toString())); + map1.put("totalPower",new BigDecimal(todayOrderMap.get("totalPower").toString())); + + int emptyOrderRate = xhpcInspectionMapper.emptyOrderRate(today,0,null,tenantId); + if(emptyOrderRate==0){ + map1.put("emptyOrderRate",0); + }else{ + double result = (double) todayOrder / emptyOrderRate; + String formatted = String.format("%.2f", result); + map1.put("emptyOrderRate",formatted); + } + String completionRate = xhpcInspectionMapper.completionRate(today,0,null,tenantId); + map1.put("completionRate",completionRate); + + List> mapList = xhpcInspectionMapper.getChargingStationList(0,null,tenantId); + int normal=0; + for (int j = 0; j < mapList.size(); j++) { + Map objectMap = mapList.get(j); + Long stationId = Long.valueOf(objectMap.get("stationId").toString()); + List> list = xhpcInspectionMapper.getWXXhpcTerminalMassage(stationId); + if (list != null && list.size() > 0) { + for (int i = 0; i < list.size(); i++) { + Map map = list.get(i); + //终端状态用 redis数据 + if(map.get("serialNumber") !=null){ + Map cacheMap =redisService.getCacheMap("gun:"+map.get("serialNumber").toString()); + if(!cacheMap.isEmpty()){ + if ("离线".equals(cacheMap.get("status").toString())){ + }else if("故障".equals(cacheMap.get("status").toString())){ + }else if("空闲".equals(cacheMap.get("status").toString())){ + normal++; + }else{ + normal++; + } + }else{ + + } + }else{ + } + } + } + } + + BigDecimal bigDecimal = xhpcInspectionMapper.onlineRate(normal,0,null,tenantId); + map1.put("onlineRate",bigDecimal+"%"); } - } } - - BigDecimal bigDecimal = xhpcInspectionMapper.onlineRate(normal); - map1.put("onlineRate",bigDecimal+"%"); - - return map1; } + + BigDecimal toBigDecimal(Object obj) { + if (obj == null) return BigDecimal.ZERO; + String str = obj.toString().trim(); + if (str.isEmpty() || "null".equalsIgnoreCase(str)) return BigDecimal.ZERO; + // 去除千位分隔符(逗号) + str = str.replace(",", ""); + return new BigDecimal(str); + } + public static void main(String[] args) { + String today = DateUtil.today(); + System.out.println("-------"+today); + + } } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPlaceholderOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPlaceholderOrderServiceImpl.java index 5696434f..5634aaee 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPlaceholderOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPlaceholderOrderServiceImpl.java @@ -43,6 +43,9 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.ZoneId; +import java.time.temporal.ChronoUnit; import java.util.*; import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS; @@ -88,9 +91,21 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp //删除占位费时间段收费表 // xhpcPlaceholderOrderMapper.deleteByPlaceholderOrderIdInt(xhpcPlaceholderOrder.getPlaceholderOrderId()); //结算订单,查询该时间段价格 - DateTime startTime = DateUtil.parse(DateUtil.format(xhpcPlaceholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss"); + String startTimeYu = DateUtil.format(xhpcPlaceholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss"); + DateTime startTime = DateUtil.parse(startTimeYu,"yyyy-MM-dd HH:mm:ss"); DateTime endTime = DateUtil.parse(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss"); - //endTime = DateUtil.parse("2025-07-05 11:02:24","yyyy-MM-dd HH:mm:ss"); + + //查看是否有历史订单,历史订单为空,不收取占位费 + int count = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderTotalPrice(serialNumber, 2); + if(count==0){ + endTime = startTime; + }else{ + //查看下一单的时间是否超过30分钟 + int result = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderNextOrderTime(xhpcPlaceholderOrder.getHistoryOrderId(), xhpcPlaceholderOrder.getTerminalId(), startTimeYu); + if(result==0){ + endTime = startTime; + } + } String start = DateUtil.formatTime(startTime); String end = DateUtil.formatTime(endTime); DateTime parse = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"), "yyyy-MM-dd"); @@ -422,6 +437,360 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp } } + @Override + public void getReturnGunRecord(String serialNumber, String startTimeYu, String endTimeYu) { + + //查询订单 + XhpcPlaceholderOrder xhpcPlaceholderOrder = xhpcPlaceholderOrderMapper.getXhpcPlaceholderOrderSerialNumber(serialNumber); + int xhpcChargeOrderStatus = xhpcPlaceholderOrderMapper.getXhpcChargeOrderStatus(serialNumber); + + if(xhpcPlaceholderOrder !=null && xhpcChargeOrderStatus==1){ + { + if (xhpcPlaceholderOrder.getType() == 0 ) { + //结算订单,查询该时间段价格 + DateTime startTime = DateUtil.parse(startTimeYu,"yyyy-MM-dd HH:mm:ss"); + DateTime endTime = DateUtil.parse(endTimeYu,"yyyy-MM-dd HH:mm:ss"); + Boolean noMoney =true; + //查看是否有历史订单,历史订单为空,不收取占位费 + int count = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderTotalPrice(serialNumber, 2); + if(count>0){ + int number = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderTotalPrice(serialNumber, 1); + if(number==0){ + endTime = startTime; + noMoney =false; + } + } + if(noMoney){ + //查看下一单的时间是否超过30分钟 + int result = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderNextOrderTime(xhpcPlaceholderOrder.getHistoryOrderId(), xhpcPlaceholderOrder.getTerminalId(), startTimeYu); + if(result==0){ + endTime = startTime; + } + } + String start = DateUtil.formatTime(startTime); + String end = DateUtil.formatTime(endTime); + DateTime parse = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"), "yyyy-MM-dd"); + DateTime parse1 = DateUtil.parse(DateUtil.format(endTime, "yyyy-MM-dd"), "yyyy-MM-dd"); + long betweenDay = DateUtil.between(parse,parse1, DateUnit.DAY); + long between = DateUtil.between(endTime, startTime, DateUnit.MINUTE); + xhpcPlaceholderOrder.setEndTime(endTime); + xhpcPlaceholderOrder.setTotalTimeSpan((int) between); + BigDecimal totalMoney = new BigDecimal("0.0"); + int freeTime = (int) xhpcPlaceholderOrder.getFreeTime(); + if (freeTime - between > 0) { + between = 0L; + } else { + between = between - freeTime; + if (betweenDay > 0) { + for (int m = 0; m <= betweenDay; m++) { + if(m==0){ + List xhpcPlaceholderTimeOne = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime(start, "23:59:59", xhpcPlaceholderOrder.getPlaceholderId()); + for (int i = 0; i < xhpcPlaceholderTimeOne.size(); i++) { + XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i); + BigDecimal price = xhpcPlaceholderTime.getPrice(); + String pattern = "HH:mm:ss"; + Long startOne = DateUtil.parse(start, pattern).getTime(); + Long endOne = DateUtil.parse("23:59:59", pattern).getTime(); + + String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern); + String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern); + + Long time1 = DateUtil.parse(format1, pattern).getTime(); + Long time2 = DateUtil.parse(format2, pattern).getTime(); + XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto(); + if (startOne < time1) { + startOne = time1; + placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime()); + }else{ + placeholderTimeOrderDto.setStartTime(DateUtil.parse(start, pattern)); + } + if (endOne > time2) { + endOne = time2; + placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime()); + }else{ + placeholderTimeOrderDto.setEndTime(DateUtil.parse("23:59:59", pattern)); + } + long betweOne = (endOne - startOne) / 60000; + int i1 = (int) (betweOne); + + if (freeTime - i1 > 0) { + freeTime = freeTime - i1; + i1 = 0; + } else { + i1 = i1 - freeTime; + freeTime = 0; + } + BigDecimal multiply = new BigDecimal(i1).multiply(price); + totalMoney = totalMoney.add(multiply); + + placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId()); + placeholderTimeOrderDto.setPrice(price); + placeholderTimeOrderDto.setTotalMoney(multiply); + placeholderTimeOrderDto.setTotalTimeSpan(i1); + xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto); + + } + }else if(m>0 && m xhpcPlaceholderTimeOne = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime("00:00:00", "23:59:59", xhpcPlaceholderOrder.getPlaceholderId()); + for (int i = 0; i < xhpcPlaceholderTimeOne.size(); i++) { + XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i); + BigDecimal price = xhpcPlaceholderTime.getPrice(); + String pattern = "HH:mm:ss"; + Long startOne = DateUtil.parse("00:00:00", pattern).getTime(); + Long endOne = DateUtil.parse("23:59:59", pattern).getTime(); + + String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern); + String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern); + + Long time1 = DateUtil.parse(format1, pattern).getTime(); + Long time2 = DateUtil.parse(format2, pattern).getTime(); + XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto(); + if (startOne < time1) { + startOne = time1; + placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime()); + }else{ + placeholderTimeOrderDto.setStartTime(DateUtil.parse("00:00:00", pattern)); + } + if (endOne > time2) { + endOne = time2; + placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime()); + }else{ + placeholderTimeOrderDto.setEndTime(DateUtil.parse("23:59:59", pattern)); + } + long betweOne = (endOne - startOne) / 60000; + int i1 = (int) (betweOne); + + if (freeTime - i1 > 0) { + freeTime = freeTime - i1; + i1 = 0; + } else { + i1 = i1 - freeTime; + freeTime = 0; + } + + BigDecimal multiply = new BigDecimal(i1).multiply(price); + totalMoney = totalMoney.add(multiply); + + placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId()); + placeholderTimeOrderDto.setPrice(price); + placeholderTimeOrderDto.setTotalMoney(multiply); + placeholderTimeOrderDto.setTotalTimeSpan(i1); + xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto); + + } + }else{ + List xhpcPlaceholderTimeTwo = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime("00:00:00", end, xhpcPlaceholderOrder.getPlaceholderId()); + for (int i = 0; i < xhpcPlaceholderTimeTwo.size(); i++) { + XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeTwo.get(i); + BigDecimal price = xhpcPlaceholderTime.getPrice(); + String pattern = "HH:mm:ss"; + Long startOne = DateUtil.parse("00:00:00", pattern).getTime(); + Long endOne = DateUtil.parse(end, pattern).getTime(); + + String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern); + String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern); + + Long time1 = DateUtil.parse(format1, pattern).getTime(); + Long time2 = DateUtil.parse(format2, pattern).getTime(); + + XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto(); + if (startOne < time1) { + startOne = time1; + placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime()); + }else{ + placeholderTimeOrderDto.setStartTime(DateUtil.parse("00:00:00", pattern)); + } + if (endOne > time2) { + endOne = time2; + placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime()); + }else{ + placeholderTimeOrderDto.setEndTime(DateUtil.parse(end, pattern)); + } + long betweOne = (endOne - startOne) / 60000; + int i1 = (int) (betweOne); + if (freeTime - i1 > 0) { + freeTime = freeTime - i1; + i1 = 0; + } else { + i1 = i1 - freeTime; + freeTime = 0; + } + BigDecimal multiply = new BigDecimal(i1).multiply(price); + totalMoney = totalMoney.add(multiply); + + + placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId()); + placeholderTimeOrderDto.setPrice(price); + placeholderTimeOrderDto.setTotalMoney(multiply); + placeholderTimeOrderDto.setTotalTimeSpan(i1); + xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto); + } + } + } + }else { + List xhpcPlaceholderTimeOne = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime(start, end, xhpcPlaceholderOrder.getPlaceholderId()); + for (int i = 0; i < xhpcPlaceholderTimeOne.size(); i++) { + XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i); + BigDecimal price = xhpcPlaceholderTime.getPrice(); + String pattern = "HH:mm:ss"; + Long startOne = DateUtil.parse(start, pattern).getTime(); + Long endOne = DateUtil.parse(end, pattern).getTime(); + + String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern); + String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern); + + Long time1 = DateUtil.parse(format1, pattern).getTime(); + Long time2 = DateUtil.parse(format2, pattern).getTime(); + + XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto(); + if (startOne < time1) { + startOne = time1; + placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime()); + }else{ + placeholderTimeOrderDto.setStartTime(DateUtil.parse(start, pattern)); + } + if (endOne > time2) { + endOne = time2; + placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime()); + }else{ + placeholderTimeOrderDto.setEndTime(DateUtil.parse(end, pattern)); + } + long betweOne = (endOne - startOne) / 60000; + int i1 = (int) (betweOne); + + if (freeTime - i1 > 0) { + freeTime = freeTime - i1; + i1 = 0; + } else { + i1 = i1 - freeTime; + freeTime = 0; + } + BigDecimal multiply = new BigDecimal(i1).multiply(price); + totalMoney = totalMoney.add(multiply); + + placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId()); + placeholderTimeOrderDto.setPrice(price); + placeholderTimeOrderDto.setTotalMoney(multiply); + placeholderTimeOrderDto.setTotalTimeSpan(i1); + xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto); + } + } + } + + if(totalMoney.compareTo(new BigDecimal(50)) == 1){ + totalMoney = new BigDecimal(50); + } + xhpcPlaceholderOrder.setTotalMoney(totalMoney); + if (new BigDecimal(0).compareTo(new BigDecimal(between)) == -1) { + xhpcPlaceholderOrder.setOvertimePrice(totalMoney.divide(new BigDecimal(between), 2, BigDecimal.ROUND_HALF_UP)); + } else { + xhpcPlaceholderOrder.setOvertimePrice(new BigDecimal("0.0")); + } + + String orderKey = "notificationPlaceholderOrderInfo:" + xhpcPlaceholderOrder.getSerialNumber(); + Map cacheOrder = new HashMap<>(); + cacheOrder.put("OvertimeBillCode", xhpcPlaceholderOrder.getPlaceholderOrderNumber()); + cacheOrder.put("StartChargeSeq", xhpcPlaceholderOrder.getInternetSerialNumber()); + cacheOrder.put("OvertimeBillStatus", 3); + cacheOrder.put("ConnectorId", xhpcPlaceholderOrder.getTerminalNumber()); + cacheOrder.put("BillEquipment", 1); + cacheOrder.put("StartTime", DateUtil.format(xhpcPlaceholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss")); + cacheOrder.put("EndTime", DateUtil.format(xhpcPlaceholderOrder.getEndTime(), "yyyy-MM-dd HH:mm:ss")); + cacheOrder.put("TotalTimeSpan", xhpcPlaceholderOrder.getTotalTimeSpan()); + cacheOrder.put("OvertimePrice", xhpcPlaceholderOrder.getOvertimePrice()); + cacheOrder.put("TotalMoney", xhpcPlaceholderOrder.getTotalMoney()); + + Map overtimeDetails = new HashMap<>(); + overtimeDetails.put("DetailStartTime", DateUtil.format(xhpcPlaceholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss")); + overtimeDetails.put("DetailEndTime", DateUtil.format(xhpcPlaceholderOrder.getEndTime(), "yyyy-MM-dd HH:mm:ss")); + overtimeDetails.put("DetailMoney", xhpcPlaceholderOrder.getTotalMoney()); + overtimeDetails.put("OvertimePrice", xhpcPlaceholderOrder.getOvertimePrice()); + cacheOrder.put("OvertimeDetails", overtimeDetails); + REDIS.setCacheMap(orderKey, cacheOrder); + xhpcPlaceholderOrder.setType(1); + + if(xhpcPlaceholderOrder.getSource() !=1){ + Long userId = xhpcPlaceholderOrder.getUserId(); + Integer source = xhpcPlaceholderOrder.getSource(); + String tenantId = xhpcPlaceholderOrder.getTenantId(); + + if(0 == xhpcPlaceholderOrder.getSource()){ + xhpcPlaceholderOrder.setChargingMode("C端用户"); + }else if(2 == xhpcPlaceholderOrder.getSource()){ + xhpcPlaceholderOrder.setChargingMode("社区用户"); + }else{ + xhpcPlaceholderOrder.setChargingMode("B端用户"); + } + BigDecimal totalMoney1 = xhpcPlaceholderOrder.getTotalMoney(); + xhpcPlaceholderOrder.setStatus(3); + if(totalMoney1.compareTo(new BigDecimal(0))>0){ + String key ="placeholderOrder:" +source+ tenantId+userId; + int number =0; + if(redisService.getCacheObject(key) !=null){ + String numberYu = redisService.getCacheObject(key).toString(); + int numbers =Integer.parseInt(numberYu); + numbers++; + number=numbers; + redisService.setCacheObject(key, numbers); + }else{ + redisService.setCacheObject(key, 1); + number=1; + } + R user = userTypeService.getUser(null, userId, source, null, tenantId); + if(number>3){ + if(user !=null && user.getData() !=null ){ + Map userMessage = (Map)user.getData(); + String phone =userMessage.get("phone").toString(); + BigDecimal balance1 =new BigDecimal(userMessage.get("balance").toString()); + BigDecimal subtract = balance1.subtract(totalMoney1); + + int i = xhpcChargeOrderService.updateUserBalance(userId, subtract,source,tenantId); + if(i==0){ + //扣钱失败 + System.out.println("<<<<<<<<<<<<<<<<扣钱失败>>>>userId>>>>>>>>>>>>>"+userId+">>subtract>>>>>>>>"+subtract+">>balance1>>>>>>>>"+balance1+">>source>>>>>>>>"+source); + }else{ + //添加流水 + xhpcChargeOrderService.addUserAccountStatement(userId,totalMoney1, subtract, xhpcPlaceholderOrder.getPlaceholderOrderId(), 7, new Date(),source); + } + HashMap paramMap = new HashMap<>(); + paramMap.put("time", xhpcPlaceholderOrder.getTotalTimeSpan()+""); + paramMap.put("sumMoney",totalMoney1.toString()); + paramMap.put("phone", phone); + paramMap.put("content", "尊敬的用户你好,你的爱车已停止充电"+xhpcPlaceholderOrder.getTotalTimeSpan()+"分钟,前30分钟免费,平台收取本次设备占用费:"+totalMoney1+"元,占位费费用将从余额扣除,占位费明细请查询翔桦充电小程序我的历史订单,充电结束请及时挪车。"); + smsService.sendNotice(paramMap); + //平台用户直接余额扣钱 + xhpcPlaceholderOrder.setActPrice(xhpcPlaceholderOrder.getTotalMoney()); + xhpcPlaceholderOrder.setActStatus(1); + } + }else{ + //发送短信 + //平台用户直接余额扣钱 + if(user !=null && user.getData() !=null ){ + Map userMessage = (Map)user.getData(); + String phone =userMessage.get("phone").toString(); + HashMap paramMap = new HashMap<>(); + paramMap.put("time", xhpcPlaceholderOrder.getTotalTimeSpan()+""); + paramMap.put("sumMoney",totalMoney1.toString()); + paramMap.put("number", number+""); + paramMap.put("phone", phone); + paramMap.put("content", "尊敬的用户,你的爱车已停止充电"+xhpcPlaceholderOrder.getTotalTimeSpan()+"分钟,前30分钟免费,平台收取本次设备占用费:"+totalMoney1+"元,占位费费用将从余额扣除,占位费明细请查询翔桦充电小程序我的历史订单,试运行期间前三次免费,当前免费次数为"+number+",充电结束请及时挪车。"); + smsService.sendNotice(paramMap); + + } + xhpcPlaceholderOrder.setActPrice(new BigDecimal(0)); + xhpcPlaceholderOrder.setActStatus(1); + } + }else{ + xhpcPlaceholderOrder.setActPrice(new BigDecimal(0)); + xhpcPlaceholderOrder.setActStatus(1); + } + } + xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder); + } + } + } + } + @Override public List> getListPage(String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type, String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult) { Integer number = 0; @@ -850,10 +1219,25 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp String serialNumber = map.get("serialNumber").toString(); Long placeholderOrderId = Long.parseLong(map.get("placeholderOrderId").toString()); if(source==0){ - //查询最后拔枪的时间 - Map mapTime = xhpcPlaceholderOrderMapper.getXhpcPlaceholderOrderType(serialNumber, serialNumber.substring(0, 16)); - if (mapTime!=null && mapTime.get("createTime") !=null){ - getExamine(placeholderOrderId,new BigDecimal(0),map.get("startTime").toString(),mapTime.get("createTime").toString()); + //查询历史订单是否为0 + int count = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderTotalPrice(serialNumber, 2); + if(count==0){ + getExamine(placeholderOrderId,new BigDecimal(0),map.get("startTime").toString(),map.get("startTime").toString()); + }else{ + String startTime = map.get("startTime").toString(); + Long historyOrderId =Long.valueOf(map.get("historyOrderId").toString()); + Long terminalId =Long.valueOf(map.get("terminalId").toString()); + //查看下一单的时间是否超过30分钟 + int result = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderNextOrderTime(historyOrderId, terminalId, startTime); + if(result==0){ + getExamine(placeholderOrderId,new BigDecimal(0),map.get("startTime").toString(),map.get("startTime").toString()); + }else{ + //查询最后拔枪的时间 + Map mapTime = xhpcPlaceholderOrderMapper.getXhpcPlaceholderOrderType(serialNumber, serialNumber.substring(0, 16)); + if (mapTime!=null && mapTime.get("createTime") !=null){ + getExamine(placeholderOrderId,new BigDecimal(0),map.get("startTime").toString(),mapTime.get("createTime").toString()); + } + } } }else if(source==1){ String internetSerialNumber = map.get("internetSerialNumber").toString(); @@ -868,10 +1252,24 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp xhpcPlaceholderOrder.setType(0); xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder); }else{ - //查询最后拔枪的时间 - Map mapTime = xhpcPlaceholderOrderMapper.getXhpcPlaceholderOrderType(serialNumber, serialNumber.substring(0, 16)); - if (mapTime!=null && mapTime.get("createTime") !=null){ - getExamine(placeholderOrderId,new BigDecimal(0),map.get("startTime").toString(),mapTime.get("createTime").toString()); + int count = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderTotalPrice(serialNumber, 2); + if(count==0){ + getExamine(placeholderOrderId,new BigDecimal(0),map.get("startTime").toString(),map.get("startTime").toString()); + }else{ + String startTime = map.get("startTime").toString(); + Long historyOrderId =Long.valueOf(map.get("historyOrderId").toString()); + Long terminalId =Long.valueOf(map.get("terminalId").toString()); + //查看下一单的时间是否超过30分钟 + int result = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderNextOrderTime(historyOrderId, terminalId, startTime); + if(result==0){ + getExamine(placeholderOrderId,new BigDecimal(0),map.get("startTime").toString(),map.get("startTime").toString()); + }else { + //查询最后拔枪的时间 + Map mapTime = xhpcPlaceholderOrderMapper.getXhpcPlaceholderOrderType(serialNumber, serialNumber.substring(0, 16)); + if (mapTime != null && mapTime.get("createTime") != null) { + getExamine(placeholderOrderId, new BigDecimal(0), map.get("startTime").toString(), mapTime.get("createTime").toString()); + } + } } } } @@ -1522,6 +1920,19 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp if(placeholderOrder.getAppealStatus() !=0){ return R.fail("该占位费订单已申述过"); } + try{ + Date createTime = placeholderOrder.getCreateTime(); + LocalDate targetDate = createTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + + LocalDate currentDate = LocalDate.now(); + long days = ChronoUnit.DAYS.between(targetDate, currentDate); + if(days>14){ + return R.fail("该占位费订单已超过14天不能申述,请联系客服"); + } + }catch (Exception e){ + + } + XhpcPlaceholderOrder xhpcPlaceholderOrder = new XhpcPlaceholderOrder(); xhpcPlaceholderOrder.setPlaceholderOrderId(placeholderOrderId); xhpcPlaceholderOrder.setAppealUserResult(appealUserResult); @@ -1793,5 +2204,8 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp } public static void main(String[] args) { System.out.println("MA25CNM38251212065315246240".substring(0,9)); + + + } } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java index e1567a37..82cc993f 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java @@ -1625,7 +1625,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe //查询该场站是否有占位费 Map xhpcPlaceholderMap = xhpcRealTimeOrderMapper.getXhpcPlaceholder(xhpcHistoryOrder.getChargingStationId()); System.out.println("===============生成占位费订单============================="); - if(xhpcPlaceholderMap !=null){ + if(xhpcPlaceholderMap !=null && xhpcHistoryOrder.getUserId() !=3){ //占位订单生成 XhpcPlaceholderOrder placeholderOrder = new XhpcPlaceholderOrder(); diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml index 33b15c64..c35e9871 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -918,11 +918,11 @@ ho.act_price as actPrice, ho.total_power as chargingDegree, co.charging_time as chargingTime, - xpo.start_time as placeholderStartTime, - xpo.end_time as placeholderEndTime, - xpo.total_time_span as placeholderTotalTimeSpen, - xpo.total_money as placeholderTotalMoney, - xpo.type as placeholderType, +-- xpo.start_time as placeholderStartTime, +-- xpo.end_time as placeholderEndTime, +-- xpo.total_time_span as placeholderTotalTimeSpen, +-- xpo.total_money as placeholderTotalMoney, +-- xpo.type as placeholderType, case when ho.parking_voucher=1 then '否' else '是' end as 'barrierGateRecordName' @@ -930,7 +930,7 @@ LEFT JOIN xhpc_charging_station as cs on cs.charging_station_id = ho.charging_station_id LEFT JOIN xhpc_terminal as te on te.terminal_id = ho.terminal_id left join xhpc_charge_order as co on co.charge_order_id =ho.charge_order_id - left join xhpc_placeholder_order as xpo on ho.history_order_id = xpo.history_order_id +-- left join xhpc_placeholder_order as xpo on ho.history_order_id = xpo.history_order_id where ho.status=0 and ho.del_flag=0 and ho.user_id =#{userId} and ho.tenant_id =#{tenantId} @@ -1879,4 +1879,88 @@ where history_order_id=#{historyOrderId} and del_flag=0 order by create_time asc + + + diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcInspectionMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcInspectionMapper.xml index d7354609..84a52535 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcInspectionMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcInspectionMapper.xml @@ -20,28 +20,75 @@ - + + + @@ -61,7 +108,7 @@ from xhpc_charging_pile xcp left join xhpc_charging_station as xcs on xcs.charging_station_id = xcp.charging_station_id left join xhpc_terminal xt on xt.charging_pile_id = xcp.charging_pile_id - where xcs.del_flag=0 and xcp.del_flag=0 + where xcs.del_flag=0 and xcp.del_flag=0 and xcp.charging_station_id=#{chargingStationId} GROUP BY xcp.charging_pile_id @@ -116,7 +163,7 @@ maintenance_record, - + data_time, @@ -172,8 +219,8 @@ #{maintenanceRecord}, - - #{dataIime}, + + #{dataTime}, #{errorName}, @@ -199,9 +246,12 @@ t.fault_img as faultImg, t.fault_description as faultDescription, t.maintenance_record as maintenanceRecord, - t.error_name as errorName + t.error_name as errorName, + t.remark as remark from xhpc_inspection t - where t.charging_station_id=#{stationId} and t.del_flag=0 and t.inspection_id =#{id} and t.type =#{type} + where t.charging_station_id=#{stationId} and t.del_flag=0 + and t.inspection_id =#{id} + and t.type =#{type} @@ -367,16 +417,42 @@ - + select + IFNULL(count(*), 0) as todayOrder, + IFNULL(sum(act_power_price), 0) as actPowerPrice, + IFNULL(sum(act_service_price), 0) as actServicePrice, + IFNULL(sum(act_service_price + act_power_price), 0) as actTotalPrice, + IFNULL(sum(total_power), 0) as totalPower + from xhpc_history_order + where DATE_FORMAT(end_time, '%Y-%m-%d') = #{time} + and tenant_id = #{tenantId} + + and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id = #{logOperatorId}) + + + and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id = #{logOperatorId}) + @@ -396,11 +479,25 @@ ROUND( (SUM(CASE WHEN status != 0 THEN 1 ELSE 0 END) * 100.0) / COUNT(*),2),'%' ) as completion_rate FROM xhpc_inspection - WHERE data_time = #{time}; + WHERE data_time = #{time} + and tenant_id =#{tenantId} + + and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId}) + + + and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId}) + + + + + + + + + + update xhpc_inspection set status =1 where charging_station_id=#{chargingStationId} and data_time=#{time} and type!=7 and status=0 + diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcPlaceholderOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcPlaceholderOrderMapper.xml index 44bb3395..7c44666b 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcPlaceholderOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcPlaceholderOrderMapper.xml @@ -270,6 +270,20 @@ select * from xhpc_placeholder_order where serial_number =#{serialNumber} and del_flag =0 and type =0 + + + + + @@ -510,12 +524,18 @@ and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = hio.user_id where hio.source=3 and xcup.account LIKE concat('%',#{phone}, '%')) - - and co.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId}) - - - and co.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) + + and ( + ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_app_user as xau on xau.app_user_id = hio.user_id where hio.source=0 and xau.phone LIKE concat('%',#{phone}, '%')) + + or ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_internet_user as xiu on xiu.internet_user_id = hio.user_id where hio.source=1 and xiu.phone LIKE concat('%',#{phone}, '%')) + + or ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = hio.user_id where hio.source=2 and xcp.account LIKE concat('%',#{phone}, '%')) + + or ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = hio.user_id where hio.source=3 and xcup.account LIKE concat('%',#{phone}, '%')) + ) + and ho.user_id=#{personnelId} @@ -913,7 +933,7 @@ - update xhpc_placeholder_order set type=2 where TIMESTAMPDIFF(MINUTE, IFNULL(start_time, NOW()), NOW()) > 360 and (status=1 or status=2) and type =0 + update xhpc_placeholder_order set type=2 where TIMESTAMPDIFF(MINUTE, IFNULL(start_time, NOW()), NOW()) > 720 and (status=1 or status=2) and type =0 select - DATE(ss.create_time) AS createTime, - ifnull(SUM(CASE WHEN ss.charging_mode = 1 THEN total_money ELSE 0 END,0) AS "kudaiDianMoney", + ifnull(SUM(CASE WHEN ss.charging_mode = 1 THEN total_money ELSE 0 END),0) AS "kudaiDianMoney", ifnull(SUM(CASE WHEN ss.charging_mode = 2 THEN total_money ELSE 0 END),0) AS "henDaMoney", ifnull(SUM(CASE WHEN ss.charging_mode = 3 THEN total_money ELSE 0 END),0) AS "xinDianTuMoney", ifnull(sum(CASE WHEN ss.charging_mode = 1 THEN refund_money ELSE 0 END),0) "kudaiDianRefundMoney", @@ -1044,6 +1063,7 @@ ifnull(SUM(CASE WHEN ss.charging_mode NOT IN (1, 2, 3, 4, 7) THEN act_price ELSE 0 END),0) AS "actPrice", ifnull(SUM(CASE WHEN ss.charging_mode NOT IN (1, 2, 3, 4, 7) THEN appeal_recharge_money ELSE 0 END),0) AS "appealRechargeMoney", ifnull(SUM(CASE WHEN ss.charging_mode NOT IN (1, 2, 3, 4, 7) THEN appeal_refund_money ELSE 0 END),0) AS "appealRefundMoney" + DATE(ss.create_time ,'%Y-%m-%d') AS createTime, from xhpc_placeholder_order ss left join xhpc_charging_station cs on cs.charging_station_id = ss.charging_station_id left join xhpc_operator xo on cs.operator_id = xo.operator_id @@ -1157,8 +1177,8 @@ ho.appeal_user_result as appealUserResult, ho.appeal_time as appealTime, CASE - WHEN ho.create_time > DATE_SUB(NOW(), INTERVAL 14 DAY) THEN 1 - ELSE 0 + WHEN ho.create_time > DATE_SUB(NOW(), INTERVAL 14 DAY) THEN 0 + ELSE 1 END AS canAppeal, ho.appeal_process_time as appealProcessTime from xhpc_placeholder_order ho @@ -1305,13 +1325,17 @@ @@ -1331,4 +1355,33 @@ ) ORDER BY `device_message_id` ASC LIMIT 1 + + + + diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml index 9c431523..20c8e37b 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml @@ -1439,6 +1439,7 @@ xcs.`name` name, IFNULL(us.totalOrder,0) totalOrder, IFNULL(us.emptyorder,0) emptyorder, + xcs.charging_station_id as chargingStationId, concat(IFNULL(us.emptyOrderRate,0),'%') emptyOrderRate from xhpc_charging_station xcs LEFT JOIN( @@ -1497,8 +1498,10 @@