运维统计报表统计数量

This commit is contained in:
yuyang 2022-09-08 16:40:04 +08:00
parent 6bb97b1412
commit 788bd23b09
5 changed files with 130 additions and 3 deletions

View File

@ -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());
}
}

View File

@ -220,6 +220,11 @@ public interface XhpcStatisticsServiceMapper {
List<Map<String, Object>> 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<Map<String, Object>> 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<Map<String, Object>> getWorkOrderNumber(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);
Map<String, Object> getChargeOrderStatusNumber(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);
Map<String, Object> getRefundOderStatusNumber(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);
}

View File

@ -312,4 +312,9 @@ public interface IXhpcStatisticsService {
*/
List<Map<String, Object>> getWorkHistoryOrderList(Long operatorId,Long chargingStationId,Long chargingPileId,Long terminalId,String stopReason,String startTime,String endTime,Integer type);
/**
* 工单类型统计
* @return
*/
List<Map<String, Object>> getWorkOrderNumber();
}

View File

@ -1399,6 +1399,53 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
return map;
}
/**
* 工单类型统计
*
* @return
*/
@Override
public List<Map<String, Object>> getWorkOrderNumber() {
//判断登录用户是系统用户还是运维人员
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
Long logUserId = SecurityUtils.getUserId();
SysUser sysUser = loginUser.getSysUser();
List<Map<String, Object>> 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<String, Object> averageOrder(Integer status,Integer type,Long logOperatorId,Long operatorId, Long chargingStationId, Long chargingPileId, String tenantId,String conditionBeginOfDay,String conditionEndOfDay) {
List<Map<String, Object>> dateOrder = xhpcStatisticsServiceMapper.getDateOrderCount(type,status,logOperatorId,operatorId,chargingStationId,chargingPileId,tenantId,conditionBeginOfDay,conditionEndOfDay);

View File

@ -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 @@
<if test="tenantId !=null and '' !=tenantId">
and xwho.tenant_id=#{tenantId}
</if>
<if test="status==1">
and xwho.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and xwho.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
</select>
<select id="getWorkOrderNumber" resultType="map">
select
ifnull(COUNT(xwo.work_order_id), 0) AS number,
xwtd.work_type_id as type,
xwtd.name as name
from xhpc_work_type_dict xwtd
LEFT JOIN xhpc_work_order xwo on xwtd.work_type_id = xwo.type and xwo.STATUS != 2
WHERE
xwtd.work_type_id IN (12, 13, 14, 15, 16, 17)
<if test="status==1">
and xwo.station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and xwo.station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
<if test="tenantId !=null and '' !=tenantId">
and xwo.tenant_id=#{tenantId}
</if>
GROUP BY xwtd.work_type_id
</select>
<select id="getChargeOrderStatusNumber" resultType="map">
select
ifnull(COUNT(charge_order_id), 0) AS number,
concat('20') type,
concat('异常订单问题') name
from xhpc_charge_order where status =2
<if test="status==1">
and station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
<if test="tenantId !=null and '' !=tenantId">
and tenant_id=#{tenantId}
</if>
</select>
<select id="getRefundOderStatusNumber" resultType="map">
select
ifnull(COUNT(refund_order_id), 0) AS number,
concat('30') type,
concat('退款问题') name
from xhpc_refund_order where status =0 and amount &gt; 200
<if test="status==1">
and station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
<if test="tenantId !=null and '' !=tenantId">
and tenant_id=#{tenantId}
</if>
</select>
</mapper>