From d175cc15fe7326fd1084df62f12def4e6f3db8f5 Mon Sep 17 00:00:00 2001 From: yuyang Date: Sat, 7 May 2022 18:22:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A0=A1=E6=97=B6=E6=A0=A1?= =?UTF-8?q?=E4=BB=B7=EF=BC=8C=E5=A2=9E=E5=8A=A0=E7=A7=9F=E6=88=B7=E3=80=81?= =?UTF-8?q?=E8=BF=90=E8=90=A5=E5=95=86=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/XhpcDataBigScreenServiceImpl.java | 14 +++-- .../mapper/XhpcChargingStationMapper.xml | 17 +++--- .../XhpcChargingPileController.java | 39 +++++++++++++- .../XhpcChargingStationController.java | 4 +- .../controller/XhpcDownCodeController.java | 4 +- .../XhpcTimingChargingModelController.java | 6 +-- .../mapper/XhpcChargingPileMapper.java | 2 +- .../mapper/XhpcChargingStationMapper.java | 2 +- .../station/mapper/XhpcDownCodeMapper.java | 2 +- .../mapper/XhpcTimingChargingModelMapper.java | 2 +- .../service/IXhpcChargingPileService.java | 2 +- .../service/IXhpcChargingStationService.java | 2 +- .../station/service/IXhpcDownCodeService.java | 2 +- .../IXhpcTimingChargingModelService.java | 2 +- .../service/XhpcChargingPileServiceImpl.java | 36 +++++++++---- .../XhpcChargingStationServiceImpl.java | 44 +++++++-------- .../service/XhpcDownCodeServiceImpl.java | 10 ++-- .../XhpcTimingChargingModelServiceImpl.java | 26 +++++++-- .../mapper/XhpcChargingPileMapper.xml | 7 ++- .../mapper/XhpcChargingStationMapper.xml | 10 +++- .../resources/mapper/XhpcDownCodeMapper.xml | 9 +++- .../mapper/XhpcTimingChargingModelMapper.xml | 9 ++++ .../XhpcHistoryOrderController.java | 10 ++-- .../XhpcRealTimeOrderController.java | 4 +- .../controller/XhpcStatisticsController.java | 36 +++++-------- .../order/mapper/XhpcHistoryOrderMapper.java | 2 +- .../order/mapper/XhpcRealTimeOrderMapper.java | 2 +- .../mapper/XhpcStatisticsServiceMapper.java | 2 +- .../service/IXhpcHistoryOrderService.java | 4 +- .../service/IXhpcRealTimeOrderService.java | 2 +- .../order/service/IXhpcStatisticsService.java | 6 +-- .../impl/XhpcHistoryOrderServiceImpl.java | 18 +++---- .../impl/XhpcRealTimeOrderServiceImpl.java | 40 +++++++------- .../impl/XhpcStatisticsServiceImpl.java | 53 +++++++++++-------- .../mapper/XhpcHistoryOrderMapper.xml | 9 ++++ .../mapper/XhpcRealTimeOrderMapper.xml | 9 ++++ .../resources/mapper/XhpcStatisticsMapper.xml | 15 ++++-- 37 files changed, 291 insertions(+), 172 deletions(-) diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcDataBigScreenServiceImpl.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcDataBigScreenServiceImpl.java index 4a9f549b..ca528b52 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcDataBigScreenServiceImpl.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcDataBigScreenServiceImpl.java @@ -469,10 +469,11 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService { private R> getMapR(List chargingStationIdList,List tenantIdList, Map map) { List terminal = xhpcChargingStationMapper.getTerminal(chargingStationIdList, tenantIdList); - + int total =terminal.size();//离线 int offLine =0;//离线 int fault =0;//故障 int freeTime =0;//空闲 + int insertGun =0;//插枪 int charge =0;//充电 int unknown =0;//未知 if(terminal !=null && terminal.size()>0){ @@ -485,9 +486,12 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService { }else if(cacheMap.containsKey("status") && "故障".equals(cacheMap.get("status").toString())){ fault++; - }else if(cacheMap.containsKey("status") && - "空闲".equals(cacheMap.get("status").toString())){ - freeTime++; + }else if("空闲".equals(cacheMap.get("status").toString())){ + if("是".equals(cacheMap.get("vehicleGunStatus").toString())){ + insertGun++; + }else{ + freeTime++; + } }else{ charge++; } @@ -501,6 +505,8 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService { map.put("freeTime",freeTime); map.put("charge",charge); map.put("unknown",unknown); + map.put("total",total); + map.put("insertGun",insertGun); return R.ok(map); } diff --git a/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcChargingStationMapper.xml b/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcChargingStationMapper.xml index 2f7fed3d..f3c03f25 100644 --- a/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcChargingStationMapper.xml +++ b/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcChargingStationMapper.xml @@ -491,9 +491,11 @@ \ No newline at end of file diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java index 18aa2d28..eb41f876 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java @@ -1,6 +1,8 @@ package com.xhpc.charging.station.controller; import com.xhpc.charging.station.service.IXhpcChargingPileService; +import com.xhpc.common.api.PowerPileService; +import com.xhpc.common.core.domain.R; import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.utils.poi.ExcelUtil; import com.xhpc.common.core.web.controller.BaseController; @@ -9,10 +11,12 @@ import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.domain.XhpcChargingPile; import com.xhpc.common.log.annotation.Log; import com.xhpc.common.log.enums.BusinessType; +import com.xhpc.common.redis.service.RedisService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.List; import java.util.Map; @@ -27,6 +31,10 @@ public class XhpcChargingPileController extends BaseController { @Autowired private IXhpcChargingPileService xhpcChargingPileService; + @Autowired + private PowerPileService powerPileService; + @Autowired + RedisService redisService; /** * 桩列表 @@ -37,8 +45,8 @@ public class XhpcChargingPileController extends BaseController { * @return */ @GetMapping("/list") - public TableDataInfo list(HttpServletRequest request,String name, Integer type, String serialNumber, Long chargingStationId) { - List> list = xhpcChargingPileService.selectXhpcChargingPileList(request,name, type, serialNumber, chargingStationId); + public TableDataInfo list(HttpServletRequest request,String tenantId,Long operatorId,String name, Integer type, String serialNumber, Long chargingStationId) { + List> list = xhpcChargingPileService.selectXhpcChargingPileList(request,tenantId,operatorId,name, type, serialNumber, chargingStationId); return getDataTable(list); } @@ -142,4 +150,31 @@ public class XhpcChargingPileController extends BaseController { return xhpcChargingPileService.generateQrCode(chargingStationId, pileId); } + + //下发校时校价 + @GetMapping("/configRmReply") + public AjaxResult configRmReply(String serialNumber) { + + if(serialNumber==null || "".equals(serialNumber)){ + return AjaxResult.error("桩号为空"); + } + R r = powerPileService.configTimeNRateModel(serialNumber); + if(r.getCode() !=200){ + return AjaxResult.error("下发校时校价失败,请重新下发"); + } + return AjaxResult.success("下发校时校价成功"); + } + + @GetMapping("/configRmReplyMessage") + public AjaxResult configRmReplyMessage(String serialNumber) { + if(serialNumber==null || "".equals(serialNumber)){ + return AjaxResult.error("桩号为空"); + } + String configRateReply = redisService.getCacheObject("pile:" + serialNumber + ".configRateReply"); + if(configRateReply==null || "".equals(configRateReply)){ + return AjaxResult.success("未下发"); + } + return AjaxResult.success(configRateReply); + } + } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java index 43be0506..72109d74 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java @@ -70,8 +70,8 @@ public class XhpcChargingStationController extends BaseController { */ //@PreAuthorize(hasPermi = "system:station:list") @GetMapping("/list") - public TableDataInfo list(HttpServletRequest request,String name, String operatorName) { - List> list = xhpcChargingStationService.selectXhpcChargingStationList(request,name, operatorName); + public TableDataInfo list(HttpServletRequest request,String tenantId,Long operatorId,Long chargingStationId,String name, String operatorName) { + List> list = xhpcChargingStationService.selectXhpcChargingStationList(request,tenantId,operatorId,chargingStationId,name, operatorName); return getDataTable(list); } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcDownCodeController.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcDownCodeController.java index 2ae0a286..27124316 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcDownCodeController.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcDownCodeController.java @@ -26,8 +26,8 @@ public class XhpcDownCodeController extends BaseController { private Environment environment; @GetMapping(value = "/listStations") - public TableDataInfo listStations(String stationName){ - return getDataTable(iXhpcDownCodeService.listStations(stationName)); + public TableDataInfo listStations(String tenantId,Long operatorId,Long chargingStationId,String stationName){ + return getDataTable(iXhpcDownCodeService.listStations(tenantId,operatorId,chargingStationId,stationName)); } @GetMapping(value = "/listPiles") diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcTimingChargingModelController.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcTimingChargingModelController.java index cdc7075a..90ca343e 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcTimingChargingModelController.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcTimingChargingModelController.java @@ -36,9 +36,9 @@ public class XhpcTimingChargingModelController extends BaseController { * @return */ @GetMapping("/list") - public TableDataInfo list(HttpServletRequest request, String reason, Integer status, String startTime, String endTime, Long chargingStationId) { - - List> list = xhpcTimingChargingModelService.list(request,reason, status, startTime,endTime, chargingStationId); + public TableDataInfo list(HttpServletRequest request,String tenantId,Long operatorId, String reason, Integer status, String startTime, String endTime, Long chargingStationId) { + startPage(); + List> list = xhpcTimingChargingModelService.list(request,tenantId,operatorId,reason, status, startTime,endTime, chargingStationId); return getDataTable(list); } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java index f830bc02..cdb2bbbe 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java @@ -21,7 +21,7 @@ public interface XhpcChargingPileMapper { * @param name 桩名称 * @return */ - List> selectXhpcChargingPileList(@Param("name") String name, @Param("type") Integer type, @Param("serialNumber") String serialNumber, @Param("chargingStationId") Long chargingStationId,@Param("operatorId")Long operatorId,@Param("number")Integer number,@Param("tenantId") String tenantId); + List> selectXhpcChargingPileList(@Param("operatorId")Long operatorId,@Param("name") String name, @Param("type") Integer type, @Param("serialNumber") String serialNumber, @Param("chargingStationId") Long chargingStationId,@Param("logOperatorId")Long logOperatorId,@Param("number")Integer number,@Param("tenantId") String tenantId); int getCountXhpcChargingPile(@Param("chargingStationId") Long chargingStationId,@Param("tenantId") String tenantId); diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java index 15131238..a7ab2f73 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java @@ -43,7 +43,7 @@ public interface XhpcChargingStationMapper { * @param operatorName 运营商名称 * @return 电站集合 */ - List> selectXhpcChargingStationList(@Param("name") String name, @Param("operatorName") String operatorName,@Param("operatorId")Long operatorId,@Param("type")Integer type,@Param("tenantId")String tenantId); + List> selectXhpcChargingStationList(@Param("operatorId")Long operatorId,@Param("chargingStationId")Long chargingStationId,@Param("name") String name, @Param("operatorName") String operatorName,@Param("logOperatorId")Long logOperatorId,@Param("type")Integer type,@Param("tenantId")String tenantId); /** * 新增电站 diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcDownCodeMapper.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcDownCodeMapper.java index 1bac48e1..1e363f3f 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcDownCodeMapper.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcDownCodeMapper.java @@ -14,7 +14,7 @@ import java.util.Map; @Mapper public interface XhpcDownCodeMapper { - List> selectStationsBy(@Param(value = "stationName") String stationName,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId") String tenantId); + List> selectStationsBy(@Param(value = "operatorId")Long operatorId,@Param(value = "chargingStationId")Long chargingStationId,@Param(value = "stationName") String stationName,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId") String tenantId); List> selectPilesBy(@Param(value = "stationId") Long stationId); diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcTimingChargingModelMapper.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcTimingChargingModelMapper.java index f805cbca..2eb5a1cc 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcTimingChargingModelMapper.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcTimingChargingModelMapper.java @@ -12,7 +12,7 @@ import java.util.Map; */ public interface XhpcTimingChargingModelMapper { - List> list(@Param("reason")String reason,@Param("status") Integer status,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("chargingStationId") Long chargingStationId,@Param("tenantId")String tenantId); + List> list(@Param("operatorId")Long operatorId,@Param("reason")String reason,@Param("status") Integer status,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("chargingStationId") Long chargingStationId,@Param("logOperatorId")Long logOperatorId,@Param("type")Integer type,@Param("tenantId")String tenantId); int insertXhpcTimingChargingModel(XhpcTimingChargingModel xhpcTimingChargingModel); diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingPileService.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingPileService.java index d967b7b0..55c3a066 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingPileService.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingPileService.java @@ -21,7 +21,7 @@ public interface IXhpcChargingPileService { * @param name 桩名称 * @return */ - List> selectXhpcChargingPileList(HttpServletRequest request,String name, Integer type, String serialNumber, Long chargingStationId); + List> selectXhpcChargingPileList(HttpServletRequest request,String tenantId,Long operatorId,String name, Integer type, String serialNumber, Long chargingStationId); /** diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingStationService.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingStationService.java index 38cd4e2c..603d7604 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingStationService.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingStationService.java @@ -54,7 +54,7 @@ public interface IXhpcChargingStationService { * @param operatorName 运营商名称 * @return 电站集合 */ - List> selectXhpcChargingStationList(HttpServletRequest request, String name, String operatorName); + List> selectXhpcChargingStationList(HttpServletRequest request,String tenantId,Long operatorId,Long chargingStationId, String name, String operatorName); /** * 新增电站 diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcDownCodeService.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcDownCodeService.java index a56c42aa..326cbf83 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcDownCodeService.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcDownCodeService.java @@ -10,7 +10,7 @@ import java.util.Map; */ public interface IXhpcDownCodeService { - List> listStations(String stationName); + List> listStations(String tenantId,Long operatorId,Long chargingStationId,String stationName); List> listPiles(Long stationId); diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcTimingChargingModelService.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcTimingChargingModelService.java index 2225c47f..7a2e842d 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcTimingChargingModelService.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcTimingChargingModelService.java @@ -15,7 +15,7 @@ import java.util.Map; */ public interface IXhpcTimingChargingModelService { - List> list(HttpServletRequest request, String reason, Integer status, String startTime, String endTime, Long chargingStationId); + List> list(HttpServletRequest request,String tenantId,Long operatorId, String reason, Integer status, String startTime, String endTime, Long chargingStationId); R addXhpcTimingChargingModel(HttpServletRequest request, XhpcTimingChargingModelDto xhpcTimingChargingModelDto); diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java index a3be522d..85354fb4 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java @@ -24,6 +24,7 @@ import com.xhpc.common.domain.XhpcTerminal; import com.xhpc.common.enums.ConnectorTypeEnum; import com.xhpc.common.enums.PileEquipmentTypeEnum; import com.xhpc.common.enums.PowerTypeEnum; +import com.xhpc.common.redis.service.RedisService; import com.xhpc.common.security.service.TokenService; import com.xhpc.common.util.LogUserUtils; import com.xhpc.system.api.domain.SysUser; @@ -57,7 +58,6 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha private XhpcTerminalMapper xhpcTerminalMapper; @Autowired private PowerPileService powerPileService; - @Autowired private Environment environment; @Autowired @@ -65,11 +65,11 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha @Autowired private IXhpcChargingStationService xhpcChargingStationService; @Autowired - private LogUserUtils logUserUtils; - @Autowired private TokenService tokenService; @Autowired private TenantService tenantService; + @Autowired + RedisService redisService; //字母集合 private static Map letterMap; @@ -94,30 +94,44 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha * @return */ @Override - public List> selectXhpcChargingPileList(HttpServletRequest request, String name, Integer type, String serialNumber, Long chargingStationId) { + public List> selectXhpcChargingPileList(HttpServletRequest request,String tenantId,Long operatorId, String name, Integer type, String serialNumber, Long chargingStationId) { + LoginUser loginUser = tokenService.getLoginUser(); //获取登陆用户 - Long userId = SecurityUtils.getUserId(); + Long userId = loginUser.getUserid(); //桩的统计、该时段金额 List> list =new ArrayList<>(); - LoginUser logUser = logUserUtils.getLogUser(request); - String tenantId = logUser.getTenantId(); + if(userId !=1) { Map landUser = xhpcChargingStationService.getLandUser(userId); if(landUser !=null){ if(landUser.get("userType") !=null){ startPage(); if("01".equals(landUser.get("userType").toString())){ - Long operatorId = Long.valueOf(landUser.get("operatorId").toString()); - list= xhpcChargingPileMapper.selectXhpcChargingPileList(name, type, serialNumber, chargingStationId,operatorId,1,tenantId); + Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); + list= xhpcChargingPileMapper.selectXhpcChargingPileList(operatorId,name, type, serialNumber, chargingStationId,logOperatorId,1,tenantId); }else{ - list= xhpcChargingPileMapper.selectXhpcChargingPileList(name, type, serialNumber, chargingStationId,userId,2,tenantId); + list= xhpcChargingPileMapper.selectXhpcChargingPileList(operatorId,name, type, serialNumber, chargingStationId,userId,2,tenantId); } } } }else{ startPage(); - list= xhpcChargingPileMapper.selectXhpcChargingPileList(name, type, serialNumber, chargingStationId,userId,0,tenantId); + list= xhpcChargingPileMapper.selectXhpcChargingPileList(operatorId,name, type, serialNumber, chargingStationId,userId,0,tenantId); + } + + if(list !=null && list.size()>0){ + for (Map map: list ) { + if(map.get("serialNumber") !=null){ + String serialNumberMap =map.get("serialNumber").toString(); + String configRateReply = redisService.getCacheObject("pile:" + serialNumberMap + ".configRateReply"); + if(configRateReply==null || "".equals(configRateReply)){ + map.put("configRmReply","未下发"); + }else{ + map.put("configRmReply",configRateReply); + } + } + } } return list; } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java index f8b5152c..be6cc4dd 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java @@ -17,7 +17,10 @@ import com.xhpc.common.core.web.service.BaseService; import com.xhpc.common.data.redis.CacheRateModel; import com.xhpc.common.domain.*; import com.xhpc.common.redis.service.RedisService; +import com.xhpc.common.security.service.TokenService; import com.xhpc.common.util.LogUserUtils; +import com.xhpc.common.util.UserTypeUtil; +import com.xhpc.system.api.domain.SysUser; import com.xhpc.system.api.model.LoginUser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,6 +59,8 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc private LogUserUtils logUserUtils; @Autowired private TenantService tenantService; + @Autowired + private TokenService tokenService; @Autowired private XhpcChargingStationPushStatusMapper xhpcChargingStationPushStatusMapper; @@ -153,36 +158,31 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc * @return 电站 */ @Override - public List> selectXhpcChargingStationList(HttpServletRequest request, String name, String operatorName) { + public List> selectXhpcChargingStationList(HttpServletRequest request,String tenantId,Long operatorId,Long chargingStationId, String name, String operatorName) { //获取登陆用户 - Long userId = SecurityUtils.getUserId(); + LoginUser loginUser = tokenService.getLoginUser(request); + SysUser sysUser = loginUser.getSysUser(); + Long sysUserId = sysUser.getUserId(); //桩的统计、该时段金额 List> list =new ArrayList<>(); - LoginUser logUser = logUserUtils.getLogUser(request); - String tenantId = logUser.getSysUser().getTenantId(); - if(userId !=1) { - Map landUser = xhpcChargingStationMapper.getLandUser(userId); - if(landUser !=null){ - if(landUser.get("userType") !=null){ - startPage(); - if("01".equals(landUser.get("userType").toString())){ - Long operatorId = Long.valueOf(landUser.get("operatorId").toString()); - //运营商看自己的场站 - list = xhpcChargingStationMapper.selectXhpcChargingStationList(name, operatorName,operatorId,1,tenantId); - }else{ - //查询赋值的场站 - list = xhpcChargingStationMapper.selectXhpcChargingStationList(name, operatorName,userId,2,tenantId); - } - } + + if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ + if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ + Long logOperatorId = sysUser.getOperatorId(); + //运营商看自己的场站 + list = xhpcChargingStationMapper.selectXhpcChargingStationList(operatorId,chargingStationId,name,operatorName,logOperatorId,1,tenantId); + }else{ + //查询赋值的场站 + list = xhpcChargingStationMapper.selectXhpcChargingStationList(operatorId,chargingStationId,name,operatorName,sysUserId,2,tenantId); } }else{ startPage(); - list = xhpcChargingStationMapper.selectXhpcChargingStationList(name, operatorName,userId,0,tenantId); + list = xhpcChargingStationMapper.selectXhpcChargingStationList(operatorId,chargingStationId,name, operatorName,sysUserId,0,tenantId); } for (int i = 0; i < list.size(); i++) { Map map = list.get(i); - Long chargingStationId = Long.valueOf(map.get("chargingStationId").toString()); + Long chargingStationIdMap = Long.valueOf(map.get("chargingStationId").toString()); //获取该时段电费 //HH:mm:ss String tiem = DateUtil.formatTime(new Date()); @@ -191,11 +191,11 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc map.put("url",imgIds[0]); } - Map xhpcRateTime = xhpcRateTimeService.getXhpcRateTime(tiem, chargingStationId); + Map xhpcRateTime = xhpcRateTimeService.getXhpcRateTime(tiem, chargingStationIdMap); if (xhpcRateTime != null) { map.putAll(xhpcRateTime); } - map =getTerminalStatusSum(map, chargingStationId,0); + map =getTerminalStatusSum(map, chargingStationIdMap,0); } return list; } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcDownCodeServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcDownCodeServiceImpl.java index 7677c1c0..f024f9d8 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcDownCodeServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcDownCodeServiceImpl.java @@ -43,25 +43,25 @@ public class XhpcDownCodeServiceImpl extends BaseService implements IXhpcDownCod private static final Logger logger = LoggerFactory.getLogger(XhpcDownCodeServiceImpl.class); @Override - public List> listStations(String stationName) { + public List> listStations(String tenantId,Long operatorId,Long chargingStationId,String stationName) { LoginUser loginUser = tokenService.getLoginUser(); List> list =new ArrayList<>(); SysUser sysUser = loginUser.getSysUser(); - String tenantId = loginUser.getTenantId(); + Long sysUserId = sysUser.getUserId(); if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ startPage(); if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ Long logOperatorId = sysUser.getOperatorId(); //运营商看自己的场站 - list = xhpcDownCodeMapper.selectStationsBy(stationName,1,logOperatorId,loginUser.getTenantId()); + list = xhpcDownCodeMapper.selectStationsBy(operatorId,chargingStationId,stationName,1,logOperatorId,tenantId); }else{ //查询赋值的场站 - list = xhpcDownCodeMapper.selectStationsBy(stationName,2,sysUserId,loginUser.getTenantId()); + list = xhpcDownCodeMapper.selectStationsBy(operatorId,chargingStationId,stationName,2,sysUserId,tenantId); } }else{ startPage(); - list = xhpcDownCodeMapper.selectStationsBy(stationName,0,sysUserId,loginUser.getTenantId()); + list = xhpcDownCodeMapper.selectStationsBy(operatorId,chargingStationId,stationName,0,sysUserId,tenantId); } return list; } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTimingChargingModelServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTimingChargingModelServiceImpl.java index 7ed2d205..2375599b 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTimingChargingModelServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTimingChargingModelServiceImpl.java @@ -8,10 +8,14 @@ import com.xhpc.common.api.dto.XhpcRateDto; import com.xhpc.common.api.dto.XhpcRateTimeDto; import com.xhpc.common.api.dto.XhpcTimingChargingModelDto; import com.xhpc.common.core.domain.R; +import com.xhpc.common.core.utils.SecurityUtils; +import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.service.BaseService; import com.xhpc.common.data.redis.CacheRateModel; import com.xhpc.common.domain.*; import com.xhpc.common.security.service.TokenService; +import com.xhpc.common.util.UserTypeUtil; +import com.xhpc.system.api.domain.SysUser; import com.xhpc.system.api.model.LoginUser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,14 +55,26 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I private static final Logger logger = LoggerFactory.getLogger(XhpcTimingChargingModelServiceImpl.class); @Override - public List> list(HttpServletRequest request, String reason, Integer status, String startTime, String endTime, Long chargingStationId) { + public List> list(HttpServletRequest request,String tenantId,Long operatorId, String reason, Integer status, String startTime, String endTime, Long chargingStationId) { LoginUser loginUser = tokenService.getLoginUser(request); - if(loginUser !=null){ - startPage(); - return xhpcTimingChargingModelMapper.list(reason,status,startTime,endTime,chargingStationId,loginUser.getTenantId()); + SysUser sysUser = loginUser.getSysUser(); + + Long sysUserId = sysUser.getUserId(); + + if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ + if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ + Long logOperatorId = sysUser.getOperatorId(); + //运营商看自己的场站 + return xhpcTimingChargingModelMapper.list(operatorId,reason,status,startTime,endTime,chargingStationId,logOperatorId, 1,tenantId); + }else{ + //查询赋值的场站 + return xhpcTimingChargingModelMapper.list(operatorId,reason,status,startTime,endTime,chargingStationId,sysUserId, 1,tenantId); + } + }else{ + return xhpcTimingChargingModelMapper.list(operatorId,reason,status,startTime,endTime,chargingStationId,sysUserId, 1,tenantId); } - return new ArrayList<>(); + } @Override diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingPileMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingPileMapper.xml index 67158d89..06ab095e 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingPileMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingPileMapper.xml @@ -94,6 +94,9 @@ and cp.name like CONCAT('%',#{name},'%') + + and st.operator_id =#{operatorId} + and cp.type=#{type} @@ -104,10 +107,10 @@ and cp.charging_station_id=#{chargingStationId} - and cp.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{operatorId}) + and cp.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId}) - and cp.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{operatorId}) + and cp.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId}) and cp.tenant_id=#{tenantId} diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml index 086f60dd..f5f7cfc8 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml @@ -82,11 +82,17 @@ and ope.name like CONCAT('%',#{operatorName},'%') + + and cs.operator_id = #{operatorId} + + + and cs.charging_station_id = #{chargingStationId} + - and cs.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{operatorId}) + and cs.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId}) - and cs.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{operatorId}) + and cs.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId}) and cs.tenant_id=#{tenantId} diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcDownCodeMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcDownCodeMapper.xml index cc053231..6860229d 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcDownCodeMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcDownCodeMapper.xml @@ -9,9 +9,14 @@ xo.name as operatorName, count(xt.terminal_id) as number from xhpc_charging_station as xcs left join xhpc_operator as xo on xcs.operator_id = xo.operator_id - left join xhpc_terminal as xt - on xcs.charging_station_id = xt.charging_station_id + left join xhpc_terminal as xt on xcs.charging_station_id = xt.charging_station_id where xo.del_flag = 0 and xt.del_flag = 0 + + and xcs.operator_id =#{operatorId} + + + and xcs.charging_station_id =#{chargingStationId} + and xcs.name like concat('%',#{stationName},'%') diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcTimingChargingModelMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcTimingChargingModelMapper.xml index 7e235dd5..3679916f 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcTimingChargingModelMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcTimingChargingModelMapper.xml @@ -92,6 +92,9 @@ from xhpc_timing_charging_model as tcm left join xhpc_charging_station as cs on cs.charging_station_id = tcm.charging_station_id where tcm.del_flag =0 + + and cs.operator_id = #{operatorId} + and tcm.charging_station_id = #{chargingStationId} @@ -110,6 +113,12 @@ and tcm.tenant_id =#{tenantId} + + and cs.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId}) + + + and cs.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId}) + order by tcm.status asc, tcm.create_time desc diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java index 6f64f066..8e15dc6e 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java @@ -72,11 +72,11 @@ public class XhpcHistoryOrderController extends BaseController { * @return */ @GetMapping("/getListPage") - public TableDataInfo getListPage(String phone,String transactionNumber,@RequestParam("status")Integer status,String chargingStationName,Long operatorId,Integer source,String beginStartTime,String beginEndTime,@RequestParam("userId") Long userId, Integer type, + public TableDataInfo getListPage(String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String phone,String transactionNumber,@RequestParam("status")Integer status,String chargingStationName,Long operatorId,Integer source,String beginStartTime,String beginEndTime,@RequestParam("userId") Long userId, Integer type, String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId, Integer confirmResult) { - List> listPage = xhpcHistoryOrderService.getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult); + List> listPage = xhpcHistoryOrderService.getListPage(tenantId,chargingStationId,chargingPileId,terminalId,phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult); return getDataTable(listPage); } @@ -98,6 +98,10 @@ public class XhpcHistoryOrderController extends BaseController { */ @PostMapping("/export") public void getExport(HttpServletResponse response, + String tenantId, + Long chargingStationId, + Long chargingPileId, + Long terminalId, String phone, String transactionNumber, @RequestParam("status")Integer status, @@ -120,7 +124,7 @@ public class XhpcHistoryOrderController extends BaseController { Long personnelId, Integer confirmResult) throws IOException { - xhpcHistoryOrderService.export(response, phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult); + xhpcHistoryOrderService.export(response,tenantId,chargingStationId,chargingPileId,terminalId, phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcRealTimeOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcRealTimeOrderController.java index 1d8fed32..e31ad3b6 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcRealTimeOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcRealTimeOrderController.java @@ -47,10 +47,10 @@ public class XhpcRealTimeOrderController extends BaseController { * @return */ @GetMapping("/list") - public TableDataInfo list(String phone,String transactionNumber,Integer source,String chargingStationName,String terminalName,Long operatorId,String startTime,String endTime,@RequestParam("status") Integer status,@RequestParam("userId") Long userId,@RequestParam("type") Integer type, + public TableDataInfo list(String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String phone,String transactionNumber,Integer source,String chargingStationName,String terminalName,Long operatorId,String startTime,String endTime,Integer status,Long userId, Integer type, String affiliationOrganization,String plateNum,Integer internetId,String internetSerialNumber) { - List> list = xhpcRealTimeOrderService.list(phone, transactionNumber, source, chargingStationName,terminalName, operatorId, startTime, endTime,status,userId,type,affiliationOrganization,plateNum,internetId,internetSerialNumber); + List> list = xhpcRealTimeOrderService.list(tenantId,chargingStationId,chargingPileId,terminalId,phone, transactionNumber, source, chargingStationName,terminalName, operatorId, startTime, endTime,status,userId,type,affiliationOrganization,plateNum,internetId,internetSerialNumber); return getDataTable(list); } 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 35bdccfa..c61265a1 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 @@ -147,21 +147,17 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getChargingStationList") - public AjaxResult getChargingStationList(HttpServletRequest request,Long operatorId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) + public AjaxResult getChargingStationList(HttpServletRequest request,String tenantId,Long operatorId,Long userId,Integer type) { - if (type == null || type==3) { - return AjaxResult.success(); - } - return xhpcStatisticsService.getChargingStationList(request,operatorId, userId, type); + + return xhpcStatisticsService.getChargingStationList(request,tenantId,operatorId, userId, type); } @GetMapping("/getChargingPileList") - public AjaxResult getChargingPileList(HttpServletRequest request,Long chargingStationId,Long operatorId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) + public AjaxResult getChargingPileList(HttpServletRequest request,String tenantId,Long chargingStationId,Long operatorId, Long userId,Integer type) { - if (type == null || type==3) { - return AjaxResult.success(); - } - return xhpcStatisticsService.getChargingPileList(request,chargingStationId,operatorId, userId, type); + + return xhpcStatisticsService.getChargingPileList(request,tenantId,chargingStationId,operatorId, userId, type); } @@ -173,11 +169,8 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getOperatorList") - public AjaxResult getOperatorList(HttpServletRequest request,Long operatorId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type,String tenantId) + public AjaxResult getOperatorList(HttpServletRequest request,Long operatorId, Long userId,Integer type,String tenantId) { - if (type == null || type==3) { - return AjaxResult.success(); - } return xhpcStatisticsService.getOperatorList(request,operatorId, userId, type,tenantId); } @@ -200,11 +193,8 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getInternetUserIList") - public AjaxResult getInternetUserIList(HttpServletRequest request,Long internetUserId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) + public AjaxResult getInternetUserIList(HttpServletRequest request,Long internetUserId, Long userId,Integer type) { - if (type == null || type==2) { - return AjaxResult.success(); - } return xhpcStatisticsService.getInternetUserIList(request,internetUserId, userId, type); } @@ -216,11 +206,9 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getTerminalList") - public AjaxResult getTerminalList(HttpServletRequest request,Long chargingStationId, @RequestParam("userId") Long userId, @RequestParam("type") Integer type) { - if (type == null || type == 3) { - return AjaxResult.success(); - } - return xhpcStatisticsService.getTerminalList(request,chargingStationId, userId, type); + public AjaxResult getTerminalList(HttpServletRequest request,String tenantId,Long operatorId,Long chargingStationId,Long chargingPileId,Long userId, Integer type) { + + return xhpcStatisticsService.getTerminalList(request,tenantId,operatorId,chargingStationId,chargingPileId, userId, type); } /** @@ -230,7 +218,7 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getSourceList") - public AjaxResult getSourceList(HttpServletRequest request,@RequestParam("userId") Long userId, @RequestParam("type") Integer type) { + public AjaxResult getSourceList(HttpServletRequest request, Long userId, Integer type) { return xhpcStatisticsService.getSourceList(request,userId, type); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java index 4ccda87c..e2339228 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java @@ -76,7 +76,7 @@ public interface XhpcHistoryOrderMapper { * 历史订单记录(PC) * @return */ - List> getListPage(@Param("phone")String phone,@Param("transactionNumber")String transactionNumber,@Param("status")Integer status,@Param("chargingStationName")String chargingStationName,@Param("operatorId")Long operatorId,@Param("source")Integer source,@Param("beginStartTime")String beginStartTime,@Param("beginEndTime")String beginEndTime,@Param("userId")Long userId,@Param("type")Integer type,@Param("number")Integer number,@Param("affiliationOrganization")String affiliationOrganization,@Param("evcsOrderNo")String evcsOrderNo,@Param("plateNum")String plateNum,@Param("internetId")Integer internetId,@Param("internetSerialNumber")String internetSerialNumber,@Param("terminalName")String terminalName,@Param("vinCode")String vinCode,@Param("overStartTime")String overStartTime,@Param("overEndTime")String overEndTime,@Param("personnelId")Long personnelId,@Param("confirmResult")Integer confirmResult,@Param("tenantId")String tenantId,@Param("isNotNull")Integer isNotNull); + List> getListPage(@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("terminalId")Long terminalId,@Param("phone")String phone,@Param("transactionNumber")String transactionNumber,@Param("status")Integer status,@Param("chargingStationName")String chargingStationName,@Param("operatorId")Long operatorId,@Param("source")Integer source,@Param("beginStartTime")String beginStartTime,@Param("beginEndTime")String beginEndTime,@Param("userId")Long userId,@Param("type")Integer type,@Param("number")Integer number,@Param("affiliationOrganization")String affiliationOrganization,@Param("evcsOrderNo")String evcsOrderNo,@Param("plateNum")String plateNum,@Param("internetId")Integer internetId,@Param("internetSerialNumber")String internetSerialNumber,@Param("terminalName")String terminalName,@Param("vinCode")String vinCode,@Param("overStartTime")String overStartTime,@Param("overEndTime")String overEndTime,@Param("personnelId")Long personnelId,@Param("confirmResult")Integer confirmResult,@Param("tenantId")String tenantId,@Param("isNotNull")Integer isNotNull); /** * 获取费率时段 diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java index dd01e244..28026d6d 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java @@ -62,7 +62,7 @@ public interface XhpcRealTimeOrderMapper { * @param number 0 都没有 1 phone 有 2 用户类型有 3 都有 * @return */ - List> list(@Param("phone") String phone,@Param("transactionNumber") String transactionNumber,@Param("source") Integer source,@Param("chargingStationName") String chargingStationName,@Param("terminalName")String terminalName,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("number") Integer number,@Param("status")Integer status,@Param("userId")Long userId,@Param("type")Integer type, + List> list(@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("terminalId")Long terminalId,@Param("phone") String phone,@Param("transactionNumber") String transactionNumber,@Param("source") Integer source,@Param("chargingStationName") String chargingStationName,@Param("terminalName")String terminalName,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("number") Integer number,@Param("status")Integer status,@Param("userId")Long userId,@Param("type")Integer type, @Param("affiliationOrganization")String affiliationOrganization,@Param("plateNum")String plateNum,@Param("internetId")Integer internetId,@Param("internetSerialNumber")String internetSerialNumber,@Param("tenantId")String tenantId); /** 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 6e881192..46c291d4 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 @@ -134,7 +134,7 @@ public interface XhpcStatisticsServiceMapper { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getTerminalList(@Param("chargingStationId")Long chargingStationId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId); + List> getTerminalList(@Param("operatorId")Long operatorId,@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId); /** * 机构统计 diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java index e36afbf9..890e23fd 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java @@ -56,14 +56,14 @@ public interface IXhpcHistoryOrderService { * 历史订单记录(PC) * @return */ - List> getListPage(String phone,String transactionNumber,Integer status,String chargingStationName,Long operatorId,Integer source,String beginStartTime,String beginEndTime,Long userId,Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId,Integer confirmResult); + List> getListPage(String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String phone,String transactionNumber,Integer status,String chargingStationName,Long operatorId,Integer source,String beginStartTime,String beginEndTime,Long userId,Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId,Integer confirmResult); /** * 历史订单记录导出(PC) * @return */ - void export(HttpServletResponse response, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId,Integer confirmResult) throws IOException; + void export(HttpServletResponse response,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId,Integer confirmResult) throws IOException; /** diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcRealTimeOrderService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcRealTimeOrderService.java index 0639a628..67a6644c 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcRealTimeOrderService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcRealTimeOrderService.java @@ -31,7 +31,7 @@ public interface IXhpcRealTimeOrderService { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> list(String phone,String transactionNumber,Integer source,String chargingStationName,String terminalName,Long operatorId,String startTime,String endTime,Integer status,Long userId,Integer type,String affiliationOrganization,String plateNum,Integer internetId,String internetSerialNumber); + List> list(String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId,String phone,String transactionNumber,Integer source,String chargingStationName,String terminalName,Long operatorId,String startTime,String endTime,Integer status,Long userId,Integer type,String affiliationOrganization,String plateNum,Integer internetId,String internetSerialNumber); /** * 实时订单详情接口(PC端) 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 37f3a906..18bdbc9d 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 @@ -106,7 +106,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - AjaxResult getChargingStationList(HttpServletRequest request,Long operatorId,Long userId,Integer type); + AjaxResult getChargingStationList(HttpServletRequest request,String tenantId,Long operatorId,Long userId,Integer type); /** * 电桩列表 @@ -115,7 +115,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - AjaxResult getChargingPileList(HttpServletRequest request,Long chargingStationId,Long operatorId,Long userId,Integer type); + AjaxResult getChargingPileList(HttpServletRequest request,String tenantId,Long chargingStationId,Long operatorId,Long userId,Integer type); /** * 运营商列表 @@ -146,7 +146,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - AjaxResult getTerminalList(HttpServletRequest request,Long chargingStationId,Long userId,Integer type); + AjaxResult getTerminalList(HttpServletRequest request,String tenantId,Long operatorId,Long chargingStationId,Long chargingPileId,Long userId,Integer type); /** * 订单来源列表 diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java index 0d02f256..b12a72a8 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java @@ -216,7 +216,7 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis } @Override - public List> getListPage(String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId,Integer confirmResult) { + public List> getListPage(String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId,Integer confirmResult) { Integer number = 0; //电话和用户类型都不为null number =3 @@ -233,7 +233,6 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis //获取登陆用户 Long logUserId = SecurityUtils.getUserId(); LoginUser loginUser = tokenService.getLoginUser(); - String tenantId = loginUser.getTenantId(); //桩的统计、该时段金额 List> list = new ArrayList<>(); if (userId != UserTypeUtil.USER_ID) { @@ -244,24 +243,24 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis if (UserTypeUtil.SYS_USER_TYPE_ONE.equals(landUser.get("userType").toString())) { Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); //运营商看自己的场站 - list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult,tenantId,0); + list = xhpcHistoryOrderMapper.getListPage(chargingStationId,chargingPileId,terminalId,phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult,tenantId,0); } else { //查询赋值的场站 - list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 2, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult,tenantId,0); + list = xhpcHistoryOrderMapper.getListPage(chargingStationId,chargingPileId,terminalId,phone, transactionNumber, 2, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult,tenantId,0); } } } } else { startPage(); - list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult,tenantId,0); + list = xhpcHistoryOrderMapper.getListPage(chargingStationId,chargingPileId,terminalId,phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult,tenantId,0); } return list; } @Override - public void export(HttpServletResponse response, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId,Integer confirmResult) throws IOException { + public void export(HttpServletResponse response,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId,Integer confirmResult) throws IOException { Integer number = 0; //电话和用户类型都不为null number =3 @@ -278,7 +277,6 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis //获取登陆用户 Long logUserId = SecurityUtils.getUserId(); LoginUser loginUser = tokenService.getLoginUser(); - String tenantId = loginUser.getTenantId(); //桩的统计、该时段金额 List> list = new ArrayList<>(); @@ -289,15 +287,15 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis if (UserTypeUtil.SYS_USER_TYPE_ONE.equals(landUser.get("userType").toString())) { Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); //运营商看自己的场站 - list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult,tenantId,1); + list = xhpcHistoryOrderMapper.getListPage(chargingStationId,chargingPileId,terminalId,phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult,tenantId,1); } else { //查询赋值的场站 - list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 2, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult,tenantId,1); + list = xhpcHistoryOrderMapper.getListPage(chargingStationId,chargingPileId,terminalId,phone, transactionNumber, 2, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult,tenantId,1); } } } } else { - list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult,tenantId,1); + list = xhpcHistoryOrderMapper.getListPage(chargingStationId,chargingPileId,terminalId,phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult,tenantId,1); } // 通过工具类创建writer,默认创建xls格式 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 22cec6eb..09da0db8 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 @@ -25,6 +25,7 @@ import com.xhpc.order.mapper.XhpcRealTimeOrderMapper; import com.xhpc.order.service.IXhpcChargeOrderService; import com.xhpc.order.service.IXhpcHistoryOrderService; import com.xhpc.order.service.IXhpcRealTimeOrderService; +import com.xhpc.system.api.domain.SysUser; import com.xhpc.system.api.model.LoginUser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -80,11 +81,8 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe @Override - public List> list(String phone, String transactionNumber, Integer source, String chargingStationName, String terminalName, Long operatorId, String startTime, String endTime,Integer status,Long userId,Integer type,String affiliationOrganization,String plateNum,Integer internetId,String internetSerialNumber) { + public List> list(String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId,String phone, String transactionNumber, Integer source, String chargingStationName, String terminalName, Long operatorId, String startTime, String endTime,Integer status,Long userId,Integer type,String affiliationOrganization,String plateNum,Integer internetId,String internetSerialNumber) { - - //获取登陆用户 - Long logUserId = SecurityUtils.getUserId(); //桩的统计、该时段金额 List> list =new ArrayList<>(); @@ -102,25 +100,21 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe return new ArrayList<>(); } LoginUser loginUser = tokenService.getLoginUser(); - String tenantId = loginUser.getTenantId(); - if(logUserId !=1) { - Map landUser = xhpcHistoryOrderService.getLandUser(logUserId); - if(landUser !=null){ - startPage(); - if(landUser.get("userType") !=null){ - if("01".equals(landUser.get("userType").toString())){ - Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); - //运营商看自己的场站 - list = xhpcRealTimeOrderMapper.list(phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,number,status,logOperatorId,1,affiliationOrganization,plateNum,internetId,internetSerialNumber,tenantId); - }else{ - //查询赋值的场站 - list = xhpcRealTimeOrderMapper.list(phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,number,status,logUserId,2,affiliationOrganization,plateNum,internetId,internetSerialNumber,tenantId); - } - } + SysUser sysUser = loginUser.getSysUser(); + Long logUserId = loginUser.getUserid(); + if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())) { + startPage(); + if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ + Long logOperatorId = sysUser.getOperatorId(); + //运营商看自己的场站 + list = xhpcRealTimeOrderMapper.list(chargingStationId,chargingPileId,terminalId,phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,number,status,logOperatorId,1,affiliationOrganization,plateNum,internetId,internetSerialNumber,tenantId); + }else{ + //查询赋值的场站 + list = xhpcRealTimeOrderMapper.list(chargingStationId,chargingPileId,terminalId,phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,number,status,logUserId,2,affiliationOrganization,plateNum,internetId,internetSerialNumber,tenantId); } }else{ startPage(); - list = xhpcRealTimeOrderMapper.list(phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,number,status,logUserId,0,affiliationOrganization,plateNum,internetId,internetSerialNumber,tenantId); + list = xhpcRealTimeOrderMapper.list(chargingStationId,chargingPileId,terminalId,phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,number,status,logUserId,0,affiliationOrganization,plateNum,internetId,internetSerialNumber,tenantId); } return list; @@ -182,7 +176,9 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe Map message = xhpcRealTimeOrderMapper.getMessage(realTimeOrderId); try{ if(message ==null || message.get("chargeOrderId") ==null){ - return AjaxResult.success(new HashMap<>()); + message.put("powerPriceTotal",0); + message.put("servicePriceTotal",0); + return message; } //获取开始充电时间、结束时间、计费模型、充电度数、已充金额 XhpcChargeOrder chargeOrder = xhpcChargeOrderService.getChargingOrderId(Long.parseLong(message.get("chargeOrderId").toString())); @@ -242,7 +238,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe if(startRealTimeOrder ==null){ message.put("powerPriceTotal",0); message.put("servicePriceTotal",0); - return AjaxResult.success(message); + return message; } XhpcRealTimeOrder endRealTimeOrder = xhpcRealTimeOrderMapper.getChargingOrderId(chargeOrder.getChargeOrderId(), 2); 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 f7ba7789..38b6d05f 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 @@ -286,14 +286,27 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati return xhpcStatisticsServiceMapper.getInternetUserIntervalPage(internetIds, internetUserId, startTime, endTime, type,sysUserId,tenantId); } + /** + * 终端统计 + * + * @param request + * @param chargingStationId 电站id + * @param terminalId 终端di + * @param operatorId 运营商id + * @param startTime 订单开始时间 + * @param endTime 订单结束时间 + * @param userId 用户id + * @param type 1 平台 2 运营商 3流量方 + * @return + */ @Override - public List> getTerminalIntervalPage(HttpServletRequest request,String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { + public List> getTerminalIntervalPage(HttpServletRequest request, String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { //获取登陆用户 LoginUser loginUser = tokenService.getLoginUser(request); List> list =new ArrayList<>(); SysUser sysUser = loginUser.getSysUser(); - String tenantId = loginUser.getTenantId(); Long sysUserId = sysUser.getUserId(); + String tenantId = loginUser.getTenantId(); if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ startPage(); if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ @@ -313,24 +326,24 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati return list; } + @Override - public AjaxResult getChargingStationList(HttpServletRequest request,Long operatorId, Long userId, Integer type) { + public AjaxResult getChargingStationList(HttpServletRequest request,String tenantId,Long operatorId, Long userId, Integer type) { LoginUser loginUser = tokenService.getLoginUser(request); SysUser sysUser = loginUser.getSysUser(); - String tenantId = loginUser.getTenantId(); Long sysUserId = sysUser.getUserId(); //获取登陆用户 if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ Long logOperatorId = sysUser.getOperatorId(); //运营商看自己的场站 - return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, logOperatorId, 1,null)); + return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, logOperatorId, 1,tenantId)); }else{ //查询赋值的场站 - return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, sysUserId, 2,null)); + return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, sysUserId, 2,tenantId)); } }else{ - return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, sysUserId, 0,null)); + return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, sysUserId, 0,tenantId)); } } @@ -345,23 +358,22 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati * @return */ @Override - public AjaxResult getChargingPileList(HttpServletRequest request, Long chargingStationId, Long operatorId, Long userId, Integer type) { + public AjaxResult getChargingPileList(HttpServletRequest request,String tenantId, Long chargingStationId, Long operatorId, Long userId, Integer type) { LoginUser loginUser = tokenService.getLoginUser(request); SysUser sysUser = loginUser.getSysUser(); - String tenantId = loginUser.getTenantId(); Long sysUserId = sysUser.getUserId(); //获取登陆用户 if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ Long logOperatorId = sysUser.getOperatorId(); //运营商看自己的场站 - return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingPileList(chargingStationId,operatorId, logOperatorId, 1,null)); + return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingPileList(chargingStationId,operatorId, logOperatorId, 1,tenantId)); }else{ //查询赋值的场站 - return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingPileList(chargingStationId,operatorId, sysUserId, 2,null)); + return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingPileList(chargingStationId,operatorId, sysUserId, 2,tenantId)); } }else{ - return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingPileList(chargingStationId,operatorId, sysUserId, 0,null)); + return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingPileList(chargingStationId,operatorId, sysUserId, 0,tenantId)); } } @@ -375,21 +387,21 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ Long logOperatorId = sysUser.getOperatorId(); //运营商看自己的场站 - if(tenantId !=null && "".equals(tenantId)){ + if(tenantId !=null && !"".equals(tenantId)){ return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, logOperatorId, 1,tenantId)); }else{ return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, logOperatorId, 1,null)); } }else{ //查询赋值的场站 - if(tenantId !=null && "".equals(tenantId)){ + if(tenantId !=null && !"".equals(tenantId)){ return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, sysUserId, 2,tenantId)); }else{ return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, sysUserId, 2,null)); } } }else{ - if(tenantId !=null && "".equals(tenantId)){ + if(tenantId !=null && !"".equals(tenantId)){ return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, sysUserId, 0,tenantId)); }else{ return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, sysUserId, 0,null)); @@ -427,23 +439,22 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati } @Override - public AjaxResult getTerminalList(HttpServletRequest request,Long chargingStationId, Long userId, Integer type) { -//获取登陆用户 + public AjaxResult getTerminalList(HttpServletRequest request,String tenantId,Long operatorId,Long chargingStationId,Long chargingPileId, Long userId, Integer type) { + //获取登陆用户 LoginUser loginUser = tokenService.getLoginUser(request); SysUser sysUser = loginUser.getSysUser(); - String tenantId = loginUser.getTenantId(); Long sysUserId = sysUser.getUserId(); if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ Long logOperatorId = sysUser.getOperatorId(); //运营商看自己的场站 - return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, logOperatorId, 1,null)); + return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(operatorId,chargingStationId,chargingPileId, logOperatorId, 1,tenantId)); }else{ //查询赋值的场站 - return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, sysUserId, 2,null)); + return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(operatorId,chargingStationId,chargingPileId, sysUserId, 2,tenantId)); } }else{ - return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, sysUserId, 0,null)); + return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(operatorId,chargingStationId,chargingPileId, sysUserId, 0,tenantId)); } } diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml index 657f8b23..cf14511c 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -718,6 +718,15 @@ ) ut on ut.history_order_id = ho.history_order_id where ho.status =0 and ho.del_flag=0 + + and ho.charging_station_id=#{chargingStationId} + + + and ho.terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId} and del_flag=0) + + + and ho.terminal_id=#{terminalId} + and ho.confirm_Result =#{confirmResult} diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml index 281ff964..a4f8902a 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml @@ -441,6 +441,15 @@ and co.source =1 and inu.internet_user_id=#{internetId} + + and co.charging_station_id=#{chargingStationId} + + + and co.terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id =#{chargingPileId} and del_flag =0) + + + and co.terminal_id=#{terminalId} + and co.source =1 and inu.name like concat('%', #{internetSerialNumber}, '%') 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 32248ea7..e0179858 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml @@ -382,7 +382,7 @@ name as stationName, charging_station_id as chargingStationId from xhpc_charging_station - where 1=1 + where del_flag =0 and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId}) @@ -403,7 +403,7 @@ cp.charging_pile_id as chargingPileId from xhpc_charging_pile as cp left join xhpc_charging_station cs on cs.charging_station_id = cp.charging_station_id - where 1=1 + where cp.del_flag =0 and cp.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId}) @@ -424,7 +424,7 @@ operator_id as operatorId, name as operatorName from xhpc_operator - where 1=1 + where del_flag =0 and operator_id in (select operator_id from xhpc_charging_station where operator_id=#{userId}) @@ -442,7 +442,7 @@ xt.tenant_name as tenantName from xhpc_operator as xo join xhpc_tenant as xt on xt.tenant_id = xo.tenant_id - where 1=1 + where xt.is_deleted =0 and xo.del_flag =0 and xo.operator_id=#{userId} @@ -473,9 +473,16 @@ name as terminalName from xhpc_terminal where del_flag =0 + and charging_station_id=#{chargingStationId} + + and charging_pile_id=#{chargingPileId} + + + and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{operatorId}) + and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})