运维接口
This commit is contained in:
parent
43ee4bf434
commit
0667f26b16
@ -67,33 +67,10 @@ public class XhpcInspectionController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
@GetMapping("/getStationList")
|
@GetMapping("/getStationList")
|
||||||
public AjaxResult getStationList() {
|
public AjaxResult getStationList(HttpServletRequest request) {
|
||||||
//stationName:场站名称 twoDayOrder:订单量 emptyOrderRate:空订单率
|
//stationName:场站名称 twoDayOrder:订单量 emptyOrderRate:空订单率
|
||||||
// normal:正常 offline:离线 fault:故障 "未知": 3
|
// normal:正常 offline:离线 fault:故障 "未知": 3
|
||||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
return AjaxResult.success(xhpcInspectionService.getStationList(request));
|
||||||
|
|
||||||
Map<String, Object> 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<String, Object> 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -18,5 +18,11 @@ public interface XhpcInspectionMapper {
|
|||||||
|
|
||||||
int updateInspection(XhpcInspection xhpcInspection);
|
int updateInspection(XhpcInspection xhpcInspection);
|
||||||
|
|
||||||
|
List<Map<String, Object>> getChargingStationEmptyOrder(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);
|
||||||
|
|
||||||
|
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>> getWXXhpcTerminalMassage(@Param("chargingStationId") Long chargingStationId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,4 +16,8 @@ public interface IXhpcInspectionService {
|
|||||||
AjaxResult getInspectionById(Long stationId, String id);
|
AjaxResult getInspectionById(Long stationId, String id);
|
||||||
|
|
||||||
AjaxResult addInspection(HttpServletRequest request, XhpcInspection xhpcInspection);
|
AjaxResult addInspection(HttpServletRequest request, XhpcInspection xhpcInspection);
|
||||||
|
|
||||||
|
List<Map<String, Object>> getStationList(HttpServletRequest request);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,18 +1,21 @@
|
|||||||
package com.xhpc.order.service.impl;
|
package com.xhpc.order.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.xhpc.common.core.utils.SecurityUtils;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
|
import com.xhpc.common.redis.service.RedisService;
|
||||||
import com.xhpc.common.security.service.TokenService;
|
import com.xhpc.common.security.service.TokenService;
|
||||||
|
import com.xhpc.common.util.UserTypeUtil;
|
||||||
import com.xhpc.order.domain.XhpcInspection;
|
import com.xhpc.order.domain.XhpcInspection;
|
||||||
import com.xhpc.order.mapper.XhpcInspectionMapper;
|
import com.xhpc.order.mapper.XhpcInspectionMapper;
|
||||||
import com.xhpc.order.service.IXhpcInspectionService;
|
import com.xhpc.order.service.IXhpcInspectionService;
|
||||||
|
import com.xhpc.system.api.domain.SysUser;
|
||||||
import com.xhpc.system.api.model.LoginUser;
|
import com.xhpc.system.api.model.LoginUser;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
|
public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
|
||||||
@ -21,7 +24,8 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
|
|||||||
private XhpcInspectionMapper xhpcInspectionMapper;
|
private XhpcInspectionMapper xhpcInspectionMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TokenService tokenService;
|
private TokenService tokenService;
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -37,42 +41,60 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
|
|||||||
|
|
||||||
for (int i = 0; i <mapList.size() ; i++) {
|
for (int i = 0; i <mapList.size() ; i++) {
|
||||||
Map<String, Object> map = mapList.get(i);
|
Map<String, Object> map = mapList.get(i);
|
||||||
Long chargingStationId = Long.getLong(map.get("chargingStationId").toString());
|
String today = DateUtil.today();
|
||||||
|
Long chargingStationId = Long.valueOf(map.get("chargingStationId").toString());
|
||||||
|
Long terminalId = Long.valueOf(map.get("terminalId").toString());
|
||||||
if(i==0){
|
if(i==0){
|
||||||
XhpcInspection xhpcInspection = new XhpcInspection();
|
XhpcInspection xhpcInspection = new XhpcInspection();
|
||||||
xhpcInspection.setName("箱变");
|
xhpcInspection.setName("箱变");
|
||||||
xhpcInspection.setChargingStationId(chargingStationId);
|
xhpcInspection.setChargingStationId(chargingStationId);
|
||||||
|
xhpcInspection.setTerminalId(terminalId);
|
||||||
xhpcInspection.setStatus(0);
|
xhpcInspection.setStatus(0);
|
||||||
xhpcInspection.setType(1);
|
xhpcInspection.setType(1);
|
||||||
|
xhpcInspection.setDataIime(today);
|
||||||
|
xhpcInspection.setCreateTime(new Date());
|
||||||
xhpcInspectionMapper.installInspection(xhpcInspection);
|
xhpcInspectionMapper.installInspection(xhpcInspection);
|
||||||
|
|
||||||
XhpcInspection xhpcInspection1 = new XhpcInspection();
|
XhpcInspection xhpcInspection1 = new XhpcInspection();
|
||||||
xhpcInspection1.setName("监控");
|
xhpcInspection1.setName("监控");
|
||||||
xhpcInspection.setChargingStationId(chargingStationId);
|
xhpcInspection1.setTerminalId(terminalId);
|
||||||
|
xhpcInspection1.setChargingStationId(chargingStationId);
|
||||||
xhpcInspection1.setStatus(0);
|
xhpcInspection1.setStatus(0);
|
||||||
xhpcInspection1.setType(2);
|
xhpcInspection1.setType(2);
|
||||||
|
xhpcInspection1.setDataIime(today);
|
||||||
|
xhpcInspection1.setCreateTime(new Date());
|
||||||
xhpcInspectionMapper.installInspection(xhpcInspection1);
|
xhpcInspectionMapper.installInspection(xhpcInspection1);
|
||||||
|
|
||||||
XhpcInspection xhpcInspection2 = new XhpcInspection();
|
XhpcInspection xhpcInspection2 = new XhpcInspection();
|
||||||
xhpcInspection2.setName("道闸");
|
xhpcInspection2.setName("道闸");
|
||||||
xhpcInspection.setChargingStationId(chargingStationId);
|
xhpcInspection2.setTerminalId(terminalId);
|
||||||
|
xhpcInspection2.setChargingStationId(chargingStationId);
|
||||||
xhpcInspection2.setStatus(0);
|
xhpcInspection2.setStatus(0);
|
||||||
xhpcInspection2.setType(3);
|
xhpcInspection2.setType(3);
|
||||||
|
xhpcInspection2.setDataIime(today);
|
||||||
|
xhpcInspection2.setCreateTime(new Date());
|
||||||
xhpcInspectionMapper.installInspection(xhpcInspection2);
|
xhpcInspectionMapper.installInspection(xhpcInspection2);
|
||||||
|
|
||||||
XhpcInspection xhpcInspection3 = new XhpcInspection();
|
XhpcInspection xhpcInspection3 = new XhpcInspection();
|
||||||
xhpcInspection3.setName("远程连接");
|
xhpcInspection3.setName("远程连接");
|
||||||
xhpcInspection.setChargingStationId(chargingStationId);
|
xhpcInspection3.setTerminalId(terminalId);
|
||||||
|
xhpcInspection3.setChargingStationId(chargingStationId);
|
||||||
xhpcInspection3.setStatus(0);
|
xhpcInspection3.setStatus(0);
|
||||||
xhpcInspection3.setType(4);
|
xhpcInspection3.setType(4);
|
||||||
|
xhpcInspection3.setDataIime(today);
|
||||||
|
xhpcInspection3.setCreateTime(new Date());
|
||||||
xhpcInspectionMapper.installInspection(xhpcInspection3);
|
xhpcInspectionMapper.installInspection(xhpcInspection3);
|
||||||
|
|
||||||
}
|
}
|
||||||
XhpcInspection xhpcInspection = new XhpcInspection();
|
XhpcInspection xhpcInspection = new XhpcInspection();
|
||||||
xhpcInspection.setName(map.get("name").toString());
|
xhpcInspection.setName(map.get("name").toString());
|
||||||
xhpcInspection.setChargingStationId(chargingStationId);
|
xhpcInspection.setChargingStationId(chargingStationId);
|
||||||
int status = Integer.getInteger(map.get("status").toString());
|
xhpcInspection.setTerminalId(terminalId);
|
||||||
if(status==0){
|
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);
|
xhpcInspection.setStatus(0);
|
||||||
}else{
|
}else{
|
||||||
xhpcInspection.setStatus(3);
|
xhpcInspection.setStatus(3);
|
||||||
@ -81,7 +103,7 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
xhpcInspection.setType(0);
|
xhpcInspection.setType(0);
|
||||||
|
xhpcInspection.setDataIime(today);
|
||||||
xhpcInspectionMapper.installInspection(xhpcInspection);
|
xhpcInspectionMapper.installInspection(xhpcInspection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,4 +138,106 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
|
|||||||
xhpcInspectionMapper.updateInspection(xhpcInspection);
|
xhpcInspectionMapper.updateInspection(xhpcInspection);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getStationList(HttpServletRequest request) {
|
||||||
|
|
||||||
|
|
||||||
|
Date startTime1 = DateUtil.beginOfDay(new Date());
|
||||||
|
String startTime = DateUtil.format(startTime1,"yyyy-MM-dd HH:mm:ss");
|
||||||
|
//一天的结束,结果:2017-03-01 23:59:59
|
||||||
|
Date endTime1 = DateUtil.endOfDay(new Date());
|
||||||
|
String endTime = DateUtil.format(endTime1,"yyyy-MM-dd HH:mm:ss");
|
||||||
|
Long chargingStationId =null;
|
||||||
|
//判断登录用户是系统用户还是运维人员
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||||
|
|
||||||
|
String tenantId = loginUser.getTenantId();
|
||||||
|
Long logUserId = SecurityUtils.getUserId();
|
||||||
|
SysUser sysUser = loginUser.getSysUser();
|
||||||
|
List<Map<String, Object>> mapList =new ArrayList<>();
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//桩的状态
|
||||||
|
for (int j = 0; j < mapList.size(); j++) {
|
||||||
|
Map<String, Object> objectMap = mapList.get(j);
|
||||||
|
Long stationId = Long.valueOf(objectMap.get("stationId").toString());
|
||||||
|
List<Map<String, Object>> list = xhpcInspectionMapper.getWXXhpcTerminalMassage(stationId);
|
||||||
|
int normal=0;
|
||||||
|
int offline=0;
|
||||||
|
int fault=0;
|
||||||
|
int unknown=0;
|
||||||
|
if (list != null && list.size() > 0) {
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
Map<String, Object> map = list.get(i);
|
||||||
|
//终端状态用 redis数据
|
||||||
|
if(map.get("serialNumber") !=null){
|
||||||
|
Map<String, Object> cacheMap =redisService.getCacheMap("gun:"+map.get("serialNumber").toString());
|
||||||
|
if(!cacheMap.isEmpty()){
|
||||||
|
if ("离线".equals(cacheMap.get("status").toString())){
|
||||||
|
offline++;
|
||||||
|
}else if("故障".equals(cacheMap.get("status").toString())){
|
||||||
|
fault++;
|
||||||
|
}else if("空闲".equals(cacheMap.get("status").toString())){
|
||||||
|
normal++;
|
||||||
|
}else{
|
||||||
|
normal++;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
unknown++;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
unknown++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
objectMap.put("normal", normal);
|
||||||
|
objectMap.put("offline", offline);
|
||||||
|
objectMap.put("fault", fault);
|
||||||
|
objectMap.put("unknown", unknown);
|
||||||
|
}
|
||||||
|
return mapList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,8 @@
|
|||||||
<select id="getInspectionChargingStation" resultType="map">
|
<select id="getInspectionChargingStation" resultType="map">
|
||||||
select
|
select
|
||||||
concat(xcp.name,"号桩") name,
|
concat(xcp.name,"号桩") name,
|
||||||
xcp.status as status,
|
IFNULL(xcp.status,0) as status,
|
||||||
|
xt.terminal_id as terminalId,
|
||||||
xcs.charging_station_id as chargingStationId,
|
xcs.charging_station_id as chargingStationId,
|
||||||
(
|
(
|
||||||
SELECT xt.prompt
|
SELECT xt.prompt
|
||||||
@ -59,7 +60,7 @@
|
|||||||
left join xhpc_charging_station as xcs on xcs.charging_station_id = xcp.charging_station_id
|
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
|
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
|
||||||
order by inspection_id
|
GROUP BY xcp.charging_pile_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="installInspection">
|
<insert id="installInspection">
|
||||||
@ -218,10 +219,136 @@
|
|||||||
<if test="maintenanceRecord !=null">maintenance_record=#{maintenanceRecord}</if>
|
<if test="maintenanceRecord !=null">maintenance_record=#{maintenanceRecord}</if>
|
||||||
<if test="userId !=null">user_id=#{userId}</if>
|
<if test="userId !=null">user_id=#{userId}</if>
|
||||||
</set>
|
</set>
|
||||||
|
|
||||||
where inspection_id=#{inspectionId}
|
where inspection_id=#{inspectionId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getChargingStationEmptyOrder" resultType="map">
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
xcs.`name` stationName,
|
||||||
|
xcs.charging_station_id as stationId,
|
||||||
|
IFNULL(us.totalOrder,0) twoDayOrder,
|
||||||
|
IFNULL(us.emptyorder,0) emptyorder,
|
||||||
|
concat(IFNULL(us.emptyOrderRate,0),'%') emptyOrderRate
|
||||||
|
from xhpc_charging_station xcs
|
||||||
|
LEFT JOIN(
|
||||||
|
SELECT
|
||||||
|
xcs.charging_station_id,
|
||||||
|
COUNT(xh.history_order_id) totalOrder,
|
||||||
|
xcs.`name` name,
|
||||||
|
IFNULL(ut.empty,0) emptyorder,
|
||||||
|
format(ifnull(empty/COUNT(xh.history_order_id)*100,0), 2) emptyOrderRate
|
||||||
|
FROM xhpc_charging_station xcs
|
||||||
|
LEFT JOIN xhpc_history_order xh on xcs.charging_station_id =xh.charging_station_id
|
||||||
|
LEFT join (SELECT COUNT(xh.history_order_id) empty,xh.charging_station_id
|
||||||
|
FROM `xhpc_history_order` as xh
|
||||||
|
where xh.end_time >=#{beginOfDay} and xh.end_time <= #{endOfDay}
|
||||||
|
and xh.total_price=0
|
||||||
|
and xh.stop_reason_evcs !='40'
|
||||||
|
and xh.stop_reason_evcs !='41'
|
||||||
|
and xh.stop_reason_evcs !='6E'
|
||||||
|
and xh.stop_reason_evcs !='4E'
|
||||||
|
and xh.stop_reason_evcs !='199'
|
||||||
|
and xh.tenant_id =#{tenantId}
|
||||||
|
<if test="status==1">
|
||||||
|
and xh.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
|
||||||
|
</if>
|
||||||
|
<if test="status==2">
|
||||||
|
and xh.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
|
||||||
|
</if>
|
||||||
|
GROUP BY xh.charging_station_id)ut on ut.charging_station_id = xh.charging_station_id
|
||||||
|
where xh.end_time >=#{beginOfDay} and xh.end_time <= #{endOfDay}
|
||||||
|
and xh.tenant_id =#{tenantId}
|
||||||
|
and xh.total_price is not null
|
||||||
|
<if test="status==1">
|
||||||
|
and xh.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
|
||||||
|
</if>
|
||||||
|
<if test="status==2">
|
||||||
|
and xh.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
|
||||||
|
</if>
|
||||||
|
<if test="status==3">
|
||||||
|
and find_in_set (xh.charging_station_id,(select station_ids from xhpc_work_user where work_user_id=#{logOperatorId}))
|
||||||
|
</if>
|
||||||
|
GROUP BY xcs.charging_station_id) us on us.charging_station_id = xcs.charging_station_id
|
||||||
|
where xcs.del_flag =0
|
||||||
|
<if test="status==1">
|
||||||
|
and xcs.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
|
||||||
|
</if>
|
||||||
|
<if test="status==2">
|
||||||
|
and xcs.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
|
||||||
|
</if>
|
||||||
|
<if test="status==3">
|
||||||
|
and find_in_set (xcs.charging_station_id,(select station_ids from xhpc_work_user where work_user_id=#{logOperatorId}))
|
||||||
|
</if>
|
||||||
|
GROUP BY xcs.charging_station_id
|
||||||
|
order by xcs.charging_station_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getTerminalEmptyOrder" resultType="map">
|
||||||
|
SELECT
|
||||||
|
xte.`name` stationName,
|
||||||
|
IFNULL(us.totalOrder,0) twoDayOrder,
|
||||||
|
IFNULL(us.emptyorder,0) emptyorder,
|
||||||
|
xh.charging_station_id as stationId,
|
||||||
|
concat(IFNULL(us.emptyOrderRate,0),'%') emptyOrderRate
|
||||||
|
from xhpc_terminal xte
|
||||||
|
LEFT JOIN(SELECT
|
||||||
|
COUNT(xh.history_order_id) totalOrder,
|
||||||
|
xt.`name` name,
|
||||||
|
IFNULL(ut.empty,0) emptyorder,
|
||||||
|
xh.terminal_id,
|
||||||
|
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
|
||||||
|
LEFT join (SELECT COUNT(xh.history_order_id) empty,xh.terminal_id
|
||||||
|
FROM `xhpc_history_order` as xh
|
||||||
|
where xh.end_time >=#{beginOfDay} and xh.end_time <= #{endOfDay}
|
||||||
|
and xh.total_price=0
|
||||||
|
and xh.stop_reason_evcs !='40'
|
||||||
|
and xh.stop_reason_evcs !='41'
|
||||||
|
and xh.stop_reason_evcs !='6E'
|
||||||
|
and xh.stop_reason_evcs !='4E'
|
||||||
|
and xh.stop_reason_evcs !='199'
|
||||||
|
and xh.charging_station_id =#{chargingStationId}
|
||||||
|
<if test="status==1">
|
||||||
|
and xh.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
|
||||||
|
</if>
|
||||||
|
<if test="status==2">
|
||||||
|
and xh.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
|
||||||
|
</if>
|
||||||
|
<if test="status==3">
|
||||||
|
and find_in_set (xh.charging_station_id,(select station_ids from xhpc_work_user where work_user_id=#{logOperatorId}))
|
||||||
|
</if>
|
||||||
|
GROUP BY xh.terminal_id)ut on ut.terminal_id = xh.terminal_id
|
||||||
|
where xh.end_time >=#{beginOfDay} and xh.end_time <= #{endOfDay}
|
||||||
|
and xh.total_price is not null
|
||||||
|
and xh.charging_station_id =#{chargingStationId}
|
||||||
|
<if test="status==1">
|
||||||
|
and xh.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
|
||||||
|
</if>
|
||||||
|
<if test="status==2">
|
||||||
|
and xh.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
|
||||||
|
</if>
|
||||||
|
GROUP BY xh.terminal_id)us on us.terminal_id = xte.terminal_id
|
||||||
|
where xte.del_flag =0 and xte.charging_station_id = #{chargingStationId}
|
||||||
|
|
||||||
|
GROUP BY xte.terminal_id
|
||||||
|
order by xte.serial_number
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getWXXhpcTerminalMassage" resultType="java.util.Map">
|
||||||
|
select te.name as name,
|
||||||
|
cp.power as power,
|
||||||
|
cp.auxiliary_power_supply as auxiliaryPowerSupply,
|
||||||
|
te.serial_number as serialNumber,
|
||||||
|
cp.input_voltage as inputVoltage
|
||||||
|
from xhpc_terminal as te
|
||||||
|
left join xhpc_charging_pile as cp on cp.charging_pile_id = te.charging_pile_id
|
||||||
|
where te.charging_station_id = #{chargingStationId}
|
||||||
|
and te.status = 0
|
||||||
|
and te.del_flag = 0
|
||||||
|
order by te.serial_number desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user