From 788bd23b090e9a825fa79b46b38f33419cec2c17 Mon Sep 17 00:00:00 2001 From: yuyang Date: Thu, 8 Sep 2022 16:40:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E7=BB=B4=E7=BB=9F=E8=AE=A1=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E7=BB=9F=E8=AE=A1=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/XhpcStatisticsController.java | 9 +++ .../mapper/XhpcStatisticsServiceMapper.java | 7 +- .../order/service/IXhpcStatisticsService.java | 5 ++ .../impl/XhpcStatisticsServiceImpl.java | 47 ++++++++++++++ .../resources/mapper/XhpcStatisticsMapper.xml | 65 ++++++++++++++++++- 5 files changed, 130 insertions(+), 3 deletions(-) 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 1fcb3956..fa820ddb 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 @@ -426,4 +426,13 @@ public class XhpcStatisticsController extends BaseController { public AjaxResult getWorkHistoryOrderList(Long operatorId,Long chargingStationId,Long chargingPileId,Long terminalId,String stopReason,@RequestParam(value = "startTime")String startTime,@RequestParam(value = "endTime")String endTime,Integer type){ return AjaxResult.success(xhpcStatisticsService.getWorkHistoryOrderList(operatorId,chargingStationId,chargingPileId,terminalId,stopReason,startTime,endTime,type)); } + + /** + * 工单类型统计 + * @return + */ + @GetMapping("/getWorkOrderNumber") + public AjaxResult getWorkOrderNumber(){ + return AjaxResult.success(xhpcStatisticsService.getWorkOrderNumber()); + } } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java index 28d637e2..dc2a50e4 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java @@ -220,6 +220,11 @@ public interface XhpcStatisticsServiceMapper { List> getTerminalEmptyOrder(@Param("chargingStationId")Long chargingStationId,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay); - List> getWorkHistoryOrderList(@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId,@Param("chargingPileId") Long chargingPileId,@Param("terminalId")Long terminalId, @Param("stopReason")String stopReason,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay); + + List> getWorkOrderNumber(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId); + + Map getChargeOrderStatusNumber(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId); + + Map getRefundOderStatusNumber(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java index 57c3fa41..10340327 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java @@ -312,4 +312,9 @@ public interface IXhpcStatisticsService { */ List> getWorkHistoryOrderList(Long operatorId,Long chargingStationId,Long chargingPileId,Long terminalId,String stopReason,String startTime,String endTime,Integer type); + /** + * 工单类型统计 + * @return + */ + List> getWorkOrderNumber(); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java index 13d1a696..7972982f 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java @@ -1399,6 +1399,53 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati return map; } + /** + * 工单类型统计 + * + * @return + */ + @Override + public List> getWorkOrderNumber() { + //判断登录用户是系统用户还是运维人员 + LoginUser loginUser = tokenService.getLoginUser(); + String tenantId = loginUser.getTenantId(); + Long logUserId = SecurityUtils.getUserId(); + SysUser sysUser = loginUser.getSysUser(); + List> map =new ArrayList<>(); + if(tenantId !=null && !"".equals(tenantId)){ + if(UserTypeUtil.SYS_USER_TYPE_FOUR.equals(sysUser.getUserType())){ + //运维管理人员 + }else{ + if(sysUser.getUserId() !=UserTypeUtil.USER_ID){ + Long logOperatorId = sysUser.getOperatorId(); + if ("01".equals(sysUser.getUserType())) { + //运营商看自己的场站 + map = xhpcStatisticsServiceMapper.getWorkOrderNumber(1,logOperatorId,tenantId); + //异常订单统计 + map.add(xhpcStatisticsServiceMapper.getChargeOrderStatusNumber(1,logOperatorId,tenantId)); + //退款订单统计 + map.add(xhpcStatisticsServiceMapper.getRefundOderStatusNumber(1,logOperatorId,tenantId)); + }else{ + //查询赋值的场站 + map = xhpcStatisticsServiceMapper.getWorkOrderNumber(2,logUserId,tenantId); + //异常订单统计 + map.add(xhpcStatisticsServiceMapper.getChargeOrderStatusNumber(2,logUserId,tenantId)); + //退款订单统计 + map.add(xhpcStatisticsServiceMapper.getRefundOderStatusNumber(2,logUserId,tenantId)); + } + }else{ + //全部桩 + map = xhpcStatisticsServiceMapper.getWorkOrderNumber(0,null,tenantId); + //异常订单统计 + map.add(xhpcStatisticsServiceMapper.getChargeOrderStatusNumber(0,null,tenantId)); + //退款订单统计 + map.add(xhpcStatisticsServiceMapper.getRefundOderStatusNumber(0,null,tenantId)); + } + } + } + return map; + } + private Map averageOrder(Integer status,Integer type,Long logOperatorId,Long operatorId, Long chargingStationId, Long chargingPileId, String tenantId,String conditionBeginOfDay,String conditionEndOfDay) { List> dateOrder = xhpcStatisticsServiceMapper.getDateOrderCount(type,status,logOperatorId,operatorId,chargingStationId,chargingPileId,tenantId,conditionBeginOfDay,conditionEndOfDay); 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 477ce607..4f7e1013 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml @@ -1430,7 +1430,7 @@ COUNT(xh.history_order_id) totalOrder, xcs.`name` name, IFNULL(ut.empty,0) emptyorder, - concat(format(ifnull(empty/COUNT(xh.history_order_id)*100,0), 2),"%") emptyOrderRate + concat(format(ifnull(empty/COUNT(xh.history_order_id)*100,0), 2),'%') emptyOrderRate FROM `xhpc_history_order` as xh LEFT JOIN xhpc_charging_station xcs on xcs.charging_station_id =xh.charging_station_id LEFT join (SELECT COUNT(xh.history_order_id) empty,xh.charging_station_id @@ -1465,7 +1465,7 @@ COUNT(xh.history_order_id) totalOrder, xt.`name` name, IFNULL(ut.empty,0) emptyorder, - concat(format(ifnull(empty/COUNT(xh.history_order_id)*100,0), 2),"%") emptyOrderRate + concat(format(ifnull(empty/COUNT(xh.history_order_id)*100,0), 2),'%') emptyOrderRate FROM `xhpc_history_order` as xh LEFT JOIN xhpc_charging_station xcs on xcs.charging_station_id =xh.charging_station_id LEFT JOIN xhpc_terminal xt on xt.terminal_id =xh.terminal_id @@ -1543,5 +1543,66 @@ and xwho.tenant_id=#{tenantId} + + and xwho.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId}) + + + and xwho.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId}) + + + + + + + +