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 16ec7d7c..f8b5152c 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 @@ -805,16 +805,25 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc } //图片信息 - List imgList = new ArrayList<>(); - if (map.get("imgId") != null && map.get("imgId").toString() != "") { + if (map !=null &&map.get("imgId") != null && map.get("imgId").toString() != "") { String[] split = map.get("imgId").toString().split(","); - imgList = Arrays.asList(split); - List> imgLists = xhpcChargingStationMapper.getImageList(imgList); - map.put("imgIdList", imgLists); + List> mapList =new ArrayList<>(); + for (int j = 0; j > mapList1 =new ArrayList<>(); + Map map13 =new AjaxResult(); + map13.put("imgId",j+1); + map13.put("url",split[j]); + mapList1.add(map13); + mapList.addAll(mapList1); + } + map.put("imgIdList", mapList); } else { map.put("imgIdList", new ArrayList<>()); } + + + //获取该时段电费 //HH:mm:ss String tiem = DateUtil.formatTime(new Date()); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java index 175253aa..8dcfbf6d 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java @@ -291,6 +291,10 @@ public class XhpcPileOrderController extends BaseController { } //获取充电订单 XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getSerialNumberMessage(orderNo); + Integer source = xhpcChargeOrder.getSource(); + String tenantId = xhpcChargeOrder.getTenantId(); + //历史订单 + Long userId = xhpcChargeOrder.getUserId(); Map pushOrder = redisService.getCacheMap("pushOrder:"+orderNo); //判断结算订单是否有回复启动成功 boolean judge =false; @@ -338,6 +342,25 @@ public class XhpcPileOrderController extends BaseController { xhpcRealTimeOrderService.addZeroHistoryOrder(xhpcChargeOrder); logger.info("*********************电量为0订单号>>>>>orderNo:" + orderNo); logger.info("*********************电量为0订单号>>>>>orderNo:" + orderNo); + + Map map = new HashMap<>(); + map.put("code", 500); + map.put("userId", userId); + map.put("type", 2); + map.put("chargingOrderId", xhpcChargeOrder.getChargeOrderId()); + JSONObject json = new JSONObject(map); + + if(!UserTypeUtil.INTERNET_TYPE.equals(source)){ + String message =""; + if(UserTypeUtil.USER_TYPE.equals(source)){ + message=tenantId+UserTypeUtil.USER+userId; + }else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){ + message=tenantId+UserTypeUtil.COMMUNIT+userId; + }else{ + message=tenantId+UserTypeUtil.CUSTOMERS+userId; + } + webSocketService.getMessage(message,json.toString()); + } return R.ok(); } @@ -447,8 +470,7 @@ public class XhpcPileOrderController extends BaseController { xhpcChargeOrder.setType(cacheOrderData.getStopReason()); } }catch (Exception e){} - //历史订单 - Long userId = xhpcChargeOrder.getUserId(); + //生成一条历史订单 xhpcHistoryOrder.setStartTime(startTime); xhpcHistoryOrder.setEndTime(endTime); @@ -458,8 +480,7 @@ public class XhpcPileOrderController extends BaseController { xhpcHistoryOrder.setMeterValueStartEvcs(cacheOrderData.getElectricMeterStart().doubleValue()); xhpcHistoryOrder.setMeterValueEndEvcs(cacheOrderData.getElectricMeterEnd().doubleValue()); Map userMessage =new HashMap<>(); - Integer source = xhpcChargeOrder.getSource(); - String tenantId = xhpcChargeOrder.getTenantId(); + if(!UserTypeUtil.INTERNET_TYPE.equals(source)){ R user = userTypeService.getUser(null, userId, source, null, tenantId); if(user !=null && user.getData() !=null ){ 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 2504471e..cbf54302 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 @@ -3,14 +3,9 @@ package com.xhpc.order.controller; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; -import com.xhpc.common.api.RefundOrderService; -import com.xhpc.common.api.UserTypeService; -import com.xhpc.common.core.domain.R; 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.util.UserTypeUtil; -import com.xhpc.order.domain.XhpcChargeOrder; import com.xhpc.order.domain.XhpcHistoryOrder; import com.xhpc.order.domain.XhpcStatisticsStation; import com.xhpc.order.domain.XhpcStatisticsTimeInterval; @@ -49,8 +44,6 @@ public class XhpcHistoryOrderController extends BaseController { @Autowired private IXhpcChargeOrderService chargeOrderService; - @Autowired - private UserTypeService userTypeService; private static final Logger logger = LoggerFactory.getLogger(XhpcHistoryOrderController.class); @@ -878,7 +871,7 @@ public class XhpcHistoryOrderController extends BaseController { * 24小时异常订单自动结算 */ @GetMapping("/test4") - //@Scheduled(cron = "0 0/5 * * * ?") + @Scheduled(cron = "0 0/5 * * * ?") public void test4(){ //获取异常的订单 24小时之外的异常订单 List> xhpcChargeOrderList= chargeOrderService.getXhpcChargeOrderStatus(2); @@ -925,7 +918,7 @@ public class XhpcHistoryOrderController extends BaseController { * @param */ @GetMapping("/test5") - //@Scheduled(cron = "0 0/5 * * * ?") + @Scheduled(cron = "0 0/5 * * * ?") public void test5(){ logger.info(">>>>>>>>>>>>>>>>>>>>>>>标记异常大于创建4小时,标记为异常>>>>>>>>>>>>>>>>>>>>>"); chargeOrderService.updateStatus(); 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 5c676c24..7e0b7beb 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 @@ -231,9 +231,9 @@ public class XhpcStatisticsController extends BaseController { * @return */ @GetMapping("/getSumSourceList") - public TableDataInfo getSumSourceList(HttpServletRequest request,String startTime, String endTime, String internetUserIds,@RequestParam("userId") Long userId, @RequestParam("type") Integer type, String chargingStationIds) { + public TableDataInfo getSumSourceList(HttpServletRequest request,String startTime, String endTime, String internetUserIds, String chargingStationIds) { startPage(); - List> list = xhpcStatisticsService.getSumSourceList(request,startTime,endTime,internetUserIds,userId, type,chargingStationIds); + List> list = xhpcStatisticsService.getSumSourceList(request,startTime,endTime,internetUserIds,chargingStationIds); return getDataTable(list); } @@ -327,8 +327,8 @@ public class XhpcStatisticsController extends BaseController { * @return */ @PostMapping("/internetUserInterval/export") - public void internetUserIntervalExport(HttpServletRequest request,HttpServletResponse response, String startTime, String endTime,String internetUserIds, @RequestParam("userId") Long userId, @RequestParam("type")Integer type, String chargingStationIds) throws IOException { - xhpcStatisticsService.getSumSourceListExport(request,response, startTime,endTime,internetUserIds,userId,type,chargingStationIds); + public void internetUserIntervalExport(HttpServletRequest request,HttpServletResponse response, String startTime, String endTime,String internetUserIds, String chargingStationIds) throws IOException { + xhpcStatisticsService.getSumSourceListExport(request,response, startTime,endTime,internetUserIds,chargingStationIds); } 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 47f757df..74dab2ad 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 @@ -177,11 +177,9 @@ public interface XhpcStatisticsServiceMapper { int getStatisticsStationHistoryOrderId(@Param("historyOrderId")Long historyOrderId,@Param("type")Integer type); /** * 订单来源列表 - * @param userId 用户id - * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getSumSourceList(@Param("startTime")String startTime, @Param("endTime")String endTime,@Param("sourceIds")List sourceIds, @Param("userId")Long userId, @Param("type")Integer type,@Param("chargingStationIdList")List chargingStationIdList,@Param("tenantId")String tenantId,@Param("tenantId")Long sysUserId,@Param("number")Integer number); + List> getSumSourceList(@Param("startTime")String startTime, @Param("endTime")String endTime,@Param("sourceIds")List sourceIds,@Param("chargingStationIdList")List chargingStationIdList,@Param("tenantId")String tenantId,@Param("sysUserId")Long sysUserId,@Param("number")Integer number); /** * 获取登陆用户信息 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 0480bc52..ee164156 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 @@ -155,11 +155,9 @@ public interface IXhpcStatisticsService { /** * 订单来源列表 - * @param userId 用户id - * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getSumSourceList(HttpServletRequest request,String startTime, String endTime, String sourceIds,Long userId,Integer type, String chargingStationIds); + List> getSumSourceList(HttpServletRequest request,String startTime, String endTime, String sourceIds, String chargingStationIds); /** @@ -266,7 +264,7 @@ public interface IXhpcStatisticsService { * 订单来源统计导出 * @return */ - void getSumSourceListExport(HttpServletRequest request,HttpServletResponse response, String startTime, String endTime, String sourceIds,Long userId,Integer type, String chargingStationIds) throws IOException; + void getSumSourceListExport(HttpServletRequest request,HttpServletResponse response, String startTime, String endTime, String sourceIds,String chargingStationIds) throws IOException; /** 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 8fe99af4..783ff84c 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 @@ -461,7 +461,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe //判断是否有活动 logger.info("<<<<<<<<<<<<<<<判断是否有活动>>>>>>>>>>>>>>>>>"+xhpcChargeOrder.getSerialNumber()); boolean judge =false; - if(source==UserTypeUtil.INTERNET_TYPE && internetSerialNumber!=null){ + if(source==UserTypeUtil.INTERNET_TYPE && internetSerialNumber!=null && xhpcChargeOrder.getStartTime()!=null && xhpcChargeOrder.getEndTime()!=null){ xhpcHistoryOrder.setChargingMode(xhpcChargeOrder.getUserId()+""); xhpcHistoryOrder.setInternetSerialNumber(xhpcChargeOrder.getInternetSerialNumber()); Double totalPower = xhpcHistoryOrder.getTotalPower(); @@ -770,7 +770,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe } } // - if ( !UserTypeUtil.INTERNET_TYPE.equals(source)) { + if ( !UserTypeUtil.INTERNET_TYPE.equals(source) && xhpcChargeOrder.getStartTime()!=null && xhpcChargeOrder.getEndTime()!=null) { //查询是否有活动 List activityDiscountTime = xhpcRealTimeOrderMapper.getActivityDiscountTime(userId, DateUtil.formatDateTime(startTime), source, xhpcChargeOrder.getChargingStationId(), xhpcChargeOrder.getTenantId()); if(activityDiscountTime !=null && activityDiscountTime.size()>0){ 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 58aa2523..3722c361 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 @@ -39,8 +39,6 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati @Resource XhpcStatisticsServiceMapper xhpcStatisticsServiceMapper; @Resource - IXhpcHistoryOrderService xhpcHistoryOrderService; - @Resource TokenService tokenService; @Resource RedisService redisService; @@ -445,7 +443,7 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati } @Override - public List> getSumSourceList(HttpServletRequest request,String startTime, String endTime, String sourceIds, Long userId, Integer type,String chargingStationIds) { + public List> getSumSourceList(HttpServletRequest request,String startTime, String endTime, String sourceIds,String chargingStationIds) { List sourceList =new ArrayList<>(); if(!"".equals(sourceIds) && sourceIds !=null){ sourceList= Arrays.asList(sourceIds.split(",")); @@ -465,14 +463,14 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ Long logOperatorId = sysUser.getOperatorId(); //运营商看自己的场站 - list = xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, sysUserId, type,chargingStationIdList,tenantId,logOperatorId,1); + list = xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList,chargingStationIdList,tenantId,logOperatorId,1); }else{ //查询赋值的场站 - list = xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, sysUserId, type,chargingStationIdList,tenantId,sysUserId,2); + list = xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, chargingStationIdList,tenantId,sysUserId,2); } }else{ startPage(); - list = xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, sysUserId, type,chargingStationIdList,tenantId,sysUserId,0); + list = xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, chargingStationIdList,tenantId,sysUserId,0); } return list; } @@ -857,9 +855,9 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati @Override - public void getSumSourceListExport(HttpServletRequest request,HttpServletResponse response, String startTime, String endTime, String sourceIds,Long userId,Integer type, String chargingStationIds) throws IOException { + public void getSumSourceListExport(HttpServletRequest request,HttpServletResponse response, String startTime, String endTime, String sourceIds, String chargingStationIds) throws IOException { - List> list = getSumSourceList(request,startTime, endTime, sourceIds, userId, type,chargingStationIds); + List> list = getSumSourceList(request,startTime, endTime, sourceIds,chargingStationIds); // 通过工具类创建writer,默认创建xls格式 BigExcelWriter writer = ExcelUtil.getBigWriter("temp_" + System.currentTimeMillis() + ".xlsx"); 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 237edabd..af532b09 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml @@ -1007,10 +1007,10 @@ and ss.tenant_id = #{tenantId} - and ss.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId}) + and ss.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{sysUserId}) - and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) + and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{sysUserId}) and ss.charging_mode is not null group by ss.charging_mode