From 580541a6216fd1f358d13daff47569f2174a92fc Mon Sep 17 00:00:00 2001 From: yuyang Date: Tue, 6 Sep 2022 16:27:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E7=BB=B4=E6=A1=A9=E5=AE=9A=E6=9C=9F?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E3=80=81=E7=A9=BA=E8=AE=A2=E5=8D=95=E7=8E=87?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/XhpcPileEditionMapper.xml | 8 +- .../XhpcPileRegularInspectController.java | 40 ++++++++++ .../controller/XhpcStatisticsController.java | 11 +++ .../XhpcStopChargingOrderController.java | 2 - .../order/domain/XhpcPileRegularInspect.java | 46 ++++++++++++ .../mapper/XhpcPileRegularInspectMapper.java | 15 ++++ .../mapper/XhpcStatisticsServiceMapper.java | 5 ++ .../IXhpcPileRegularInspectService.java | 12 +++ .../order/service/IXhpcStatisticsService.java | 5 ++ .../XhpcPileRegularInspectServiceImpl.java | 66 +++++++++++++++++ .../impl/XhpcRealTimeOrderServiceImpl.java | 2 +- .../impl/XhpcStatisticsServiceImpl.java | 49 +++++++++++++ .../resources/mapper/XhpcStatisticsMapper.xml | 73 +++++++++++++++++++ 13 files changed, 325 insertions(+), 9 deletions(-) create mode 100644 xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcPileRegularInspectController.java create mode 100644 xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcPileRegularInspect.java create mode 100644 xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcPileRegularInspectMapper.java create mode 100644 xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcPileRegularInspectService.java create mode 100644 xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPileRegularInspectServiceImpl.java diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcPileEditionMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcPileEditionMapper.xml index 36e9b4a0..9388bd67 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcPileEditionMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcPileEditionMapper.xml @@ -27,12 +27,8 @@ xpe.direct_number as directNumber, xpe.communication_number as communicationNumber, xpe.status as status, - - (SELECT concat(replace(group_concat(name),',','号桩,'),'号桩') FROM xhpc_charging_pile where find_in_set(charging_pile_id,#{chargingPileIds})) as chargingPileName - - - concat('--') as chargingPileName - + (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 diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcPileRegularInspectController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcPileRegularInspectController.java new file mode 100644 index 00000000..86b43b09 --- /dev/null +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcPileRegularInspectController.java @@ -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); + } + + +} 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 ef3e43e8..65fb3a45 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 @@ -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)); + } } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStopChargingOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStopChargingOrderController.java index de317551..ffb8c28f 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStopChargingOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStopChargingOrderController.java @@ -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; diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcPileRegularInspect.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcPileRegularInspect.java new file mode 100644 index 00000000..c0540cfe --- /dev/null +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcPileRegularInspect.java @@ -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; +} diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcPileRegularInspectMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcPileRegularInspectMapper.java new file mode 100644 index 00000000..7d1a4f87 --- /dev/null +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcPileRegularInspectMapper.java @@ -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 getPileRegularInspectTenantId(@Param("tenantId")String tenantId); + + int addPileRegularInspect(XhpcPileRegularInspect xhpcPileRegularInspect); + + int updatePileRegularInspect(XhpcPileRegularInspect xhpcPileRegularInspect); +} 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 e70cb1fe..667f8066 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 @@ -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> getChargingStationEmptyOrder(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay); + + 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); + + } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcPileRegularInspectService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcPileRegularInspectService.java new file mode 100644 index 00000000..2aade8e5 --- /dev/null +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcPileRegularInspectService.java @@ -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); +} 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 782379a6..da6a8e31 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 @@ -302,4 +302,9 @@ public interface IXhpcStatisticsService { */ Map getDateOrder(Integer state,Long operatorId,Long chargingStationId,Long chargingPileId,Integer type,String startTime,String endTime); + /** + * 空订单统计 + */ + List> getEmptyOrder(Long chargingStationId,String startTime,String endTime); + } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPileRegularInspectServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPileRegularInspectServiceImpl.java new file mode 100644 index 00000000..34f4c557 --- /dev/null +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPileRegularInspectServiceImpl.java @@ -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 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 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, "请重新登录"); + } + } +} 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 2f7c3a5b..87c83923 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 @@ -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()); 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 eb0149ec..04e456ca 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 @@ -1250,6 +1250,55 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati return new HashMap<>(); } + @Override + public List> 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 =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 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); // int dateOrderNUmber = xhpcStatisticsServiceMapper.getDateOrderCountNUmber(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 94d53f3a..cb297574 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml @@ -1424,4 +1424,77 @@ and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId}) + + + + + +