运维桩定期检查、空订单率统计
This commit is contained in:
parent
ed835cb583
commit
580541a621
@ -27,12 +27,8 @@
|
||||
xpe.direct_number as directNumber,
|
||||
xpe.communication_number as communicationNumber,
|
||||
xpe.status as status,
|
||||
<if test="chargingPileIds !=null and chargingPileIds !=''">
|
||||
(SELECT concat(replace(group_concat(name),',','号桩,'),'号桩') FROM xhpc_charging_pile where find_in_set(charging_pile_id,#{chargingPileIds})) as chargingPileName
|
||||
</if>
|
||||
<if test="chargingPileIds==null">
|
||||
concat('--') as chargingPileName
|
||||
</if>
|
||||
(SELECT concat(replace(group_concat(name),',','号桩,'),'号桩') FROM xhpc_charging_pile where find_in_set(charging_pile_id,xpe.charging_pile_ids)) as chargingPileName
|
||||
|
||||
from xhpc_pile_edition as xpe
|
||||
left join xhpc_charging_station xcs on xpe.charging_station_id = xcs.charging_station_id
|
||||
where xpe.del_flag=0
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
package com.xhpc.order.controller;
|
||||
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.order.domain.XhpcPileRegularInspect;
|
||||
import com.xhpc.order.service.IXhpcPileRegularInspectService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/pileRegularInspect")
|
||||
@Api(value = "桩定期检查接口", tags = "桩定期检查接口")
|
||||
public class XhpcPileRegularInspectController extends BaseController {
|
||||
@Resource
|
||||
IXhpcPileRegularInspectService xhpcPileRegularInspectService;
|
||||
|
||||
/**
|
||||
* 查询桩定期检查接口
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getMessage")
|
||||
public AjaxResult getMessage()
|
||||
{
|
||||
return xhpcPileRegularInspectService.getPileRegularInspectTenantId();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/addPileRegularInspect")
|
||||
public AjaxResult addPileRegularInspect(XhpcPileRegularInspect xhpcPileRegularInspect)
|
||||
{
|
||||
return xhpcPileRegularInspectService.addPileRegularInspect(xhpcPileRegularInspect);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -406,4 +406,15 @@ public class XhpcStatisticsController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------运维统计------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* 空订单统计
|
||||
*/
|
||||
@GetMapping("/getEmptyOrder")
|
||||
public AjaxResult getEmptyOrder(Long chargingStationId,@RequestParam(value = "startTime")String startTime,@RequestParam(value = "endTime")String endTime)
|
||||
{
|
||||
return AjaxResult.success(xhpcStatisticsService.getEmptyOrder(chargingStationId,startTime,endTime));
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,11 +6,9 @@ import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import com.xhpc.order.api.XhpcChargeOrderController;
|
||||
import com.xhpc.order.service.IXhpcChargeOrderService;
|
||||
import com.xhpc.order.service.IXhpcStopChargingOrderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
package com.xhpc.order.domain;
|
||||
|
||||
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 桩定期检查
|
||||
*
|
||||
* @author yuyang
|
||||
* @date 2021/8/4 9:41
|
||||
*/
|
||||
@Data
|
||||
public class XhpcPileRegularInspect extends BaseEntity {
|
||||
|
||||
private Long pileRegularInspectId;
|
||||
|
||||
/**
|
||||
* 版本号检查时间
|
||||
*/
|
||||
private String versionNumberTime;
|
||||
|
||||
/**
|
||||
* 校时校价时间
|
||||
*/
|
||||
private String timingPriceTime;
|
||||
|
||||
/**
|
||||
* 费率时间
|
||||
*/
|
||||
private String rateTime;
|
||||
|
||||
/**
|
||||
* 定期抄发给管理员时间
|
||||
*/
|
||||
private String copyingAdministratorTime;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
private Integer delFlag;
|
||||
|
||||
private Integer status;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.xhpc.order.mapper;
|
||||
|
||||
import com.xhpc.order.domain.XhpcPileRegularInspect;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface XhpcPileRegularInspectMapper {
|
||||
|
||||
Map<String,Object> getPileRegularInspectTenantId(@Param("tenantId")String tenantId);
|
||||
|
||||
int addPileRegularInspect(XhpcPileRegularInspect xhpcPileRegularInspect);
|
||||
|
||||
int updatePileRegularInspect(XhpcPileRegularInspect xhpcPileRegularInspect);
|
||||
}
|
||||
@ -216,5 +216,10 @@ public interface XhpcStatisticsServiceMapper {
|
||||
|
||||
int getDateOrderCountNUmber(@Param("type") Integer type,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId,@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
package com.xhpc.order.service;
|
||||
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.order.domain.XhpcPileRegularInspect;
|
||||
|
||||
public interface IXhpcPileRegularInspectService {
|
||||
|
||||
|
||||
AjaxResult getPileRegularInspectTenantId();
|
||||
|
||||
AjaxResult addPileRegularInspect(XhpcPileRegularInspect xhpcPileRegularInspect);
|
||||
}
|
||||
@ -302,4 +302,9 @@ public interface IXhpcStatisticsService {
|
||||
*/
|
||||
Map<String, Object> getDateOrder(Integer state,Long operatorId,Long chargingStationId,Long chargingPileId,Integer type,String startTime,String endTime);
|
||||
|
||||
/**
|
||||
* 空订单统计
|
||||
*/
|
||||
List<Map<String, Object>> getEmptyOrder(Long chargingStationId,String startTime,String endTime);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,66 @@
|
||||
package com.xhpc.order.service.impl;
|
||||
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.service.BaseService;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.order.domain.XhpcPileRegularInspect;
|
||||
import com.xhpc.order.mapper.XhpcPileRegularInspectMapper;
|
||||
import com.xhpc.order.service.IXhpcPileRegularInspectService;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class XhpcPileRegularInspectServiceImpl extends BaseService implements IXhpcPileRegularInspectService {
|
||||
|
||||
@Resource
|
||||
private TokenService tokenService;
|
||||
@Resource
|
||||
private XhpcPileRegularInspectMapper xhpcPileRegularInspectMapper;
|
||||
|
||||
@Override
|
||||
public AjaxResult getPileRegularInspectTenantId() {
|
||||
try {
|
||||
LoginUser loginUser = tokenService.getLoginUser();
|
||||
String tenantId =loginUser.getTenantId();
|
||||
if(tenantId==null || "".equals(tenantId)){
|
||||
return AjaxResult.error(500, "请重新登录");
|
||||
}
|
||||
Map<String, Object> map = xhpcPileRegularInspectMapper.getPileRegularInspectTenantId(tenantId);
|
||||
return AjaxResult.success(map);
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(500, "请重新登录");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult addPileRegularInspect(XhpcPileRegularInspect xhpcPileRegularInspect) {
|
||||
|
||||
LoginUser loginUser = tokenService.getLoginUser();
|
||||
String tenantId =loginUser.getTenantId();
|
||||
if(tenantId==null || "".equals(tenantId)){
|
||||
return AjaxResult.error(500, "请重新登录");
|
||||
}
|
||||
if(xhpcPileRegularInspect.getPileRegularInspectId()!=null){
|
||||
|
||||
Map<String, Object> map = xhpcPileRegularInspectMapper.getPileRegularInspectTenantId(tenantId);
|
||||
if(map !=null){
|
||||
return AjaxResult.error(500, "请重新登录!");
|
||||
}
|
||||
xhpcPileRegularInspect.setTenantId(tenantId);
|
||||
int i = xhpcPileRegularInspectMapper.addPileRegularInspect(xhpcPileRegularInspect);
|
||||
if(i>0){
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error(500, "请重新登录");
|
||||
}else{
|
||||
int i = xhpcPileRegularInspectMapper.updatePileRegularInspect(xhpcPileRegularInspect);
|
||||
if(i>0){
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error(500, "请重新登录");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1316,7 +1316,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
try {
|
||||
int startSoc = Integer.parseInt(xhpcHistoryOrder.getStartSoc());
|
||||
int endSoc = Integer.parseInt(xhpcHistoryOrder.getEndSoc());
|
||||
if(!"40".equals(xhpcHistoryOrder.getStopReasonEvcs()) || startSoc>95 || endSoc>95){
|
||||
if((!"40".equals(xhpcHistoryOrder.getStopReasonEvcs()) &&!"41".equals(xhpcHistoryOrder.getStopReasonEvcs())&&!"6E".equals(xhpcHistoryOrder.getStopReasonEvcs()))|| (startSoc>95 || endSoc>95)){
|
||||
XhpcWorkHistoryOrderDto xhpcWorkHistoryOrderDto =new XhpcWorkHistoryOrderDto();
|
||||
BeanUtils.copyProperties(xhpcHistoryOrder,xhpcWorkHistoryOrderDto);
|
||||
String nameByCode = StopReasonEnum.getNameByCode(xhpcHistoryOrder.getStopReasonEvcs());
|
||||
|
||||
@ -1250,6 +1250,55 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getEmptyOrder(Long chargingStationId,String startTime,String endTime) {
|
||||
//判断登录用户是系统用户还是运维人员
|
||||
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(chargingStationId==null){
|
||||
if(sysUser.getUserId() !=UserTypeUtil.USER_ID){
|
||||
Long logOperatorId = sysUser.getOperatorId();
|
||||
if ("01".equals(sysUser.getUserType())) {
|
||||
//运营商看自己的场站
|
||||
map= xhpcStatisticsServiceMapper.getChargingStationEmptyOrder(1,logOperatorId,tenantId,startTime,endTime);
|
||||
}else{
|
||||
//查询赋值的场站
|
||||
map= xhpcStatisticsServiceMapper.getChargingStationEmptyOrder(2,logUserId,tenantId,startTime,endTime);
|
||||
}
|
||||
}else{
|
||||
//全部桩
|
||||
map= xhpcStatisticsServiceMapper.getChargingStationEmptyOrder(0,null,tenantId,startTime,endTime);
|
||||
}
|
||||
}else{
|
||||
//单个场站空订单率
|
||||
if(sysUser.getUserId() !=UserTypeUtil.USER_ID){
|
||||
Long logOperatorId = sysUser.getOperatorId();
|
||||
if ("01".equals(sysUser.getUserType())) {
|
||||
//运营商看自己的场站
|
||||
map= xhpcStatisticsServiceMapper.getTerminalEmptyOrder(chargingStationId,1,logOperatorId,tenantId,startTime,endTime);
|
||||
}else{
|
||||
//查询赋值的场站
|
||||
map= xhpcStatisticsServiceMapper.getTerminalEmptyOrder(chargingStationId,2,logUserId,tenantId,startTime,endTime);
|
||||
}
|
||||
}else{
|
||||
//全部桩
|
||||
map= xhpcStatisticsServiceMapper.getTerminalEmptyOrder(chargingStationId,0,null,tenantId,startTime,endTime);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
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);
|
||||
// int dateOrderNUmber = xhpcStatisticsServiceMapper.getDateOrderCountNUmber(type, status, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, conditionBeginOfDay, conditionEndOfDay);
|
||||
|
||||
@ -1424,4 +1424,77 @@
|
||||
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getChargingStationEmptyOrder" resultType="map">
|
||||
SELECT
|
||||
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),"%") orders
|
||||
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
|
||||
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.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>
|
||||
GROUP BY xh.charging_station_id
|
||||
</select>
|
||||
|
||||
<select id="getTerminalEmptyOrder" resultType="map">
|
||||
SELECT
|
||||
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),"%") orders
|
||||
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.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)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
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user