From 91192d83cd60f1b2c0ce0e16101b2d95552475e5 Mon Sep 17 00:00:00 2001 From: yuyang Date: Tue, 20 Sep 2022 18:17:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE=E5=A4=A7?= =?UTF-8?q?=E5=B1=8F=E5=AE=9E=E6=97=B6=E6=95=B0=E6=8D=AE=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E7=9B=B8=E5=BA=94=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xhpc/card/domain/RealtimeOrder.java | 44 +++++++++ .../com/xhpc/card/domain/RealtimeOrders.java | 50 ---------- .../xhpc/card/mapper/XhpcRateTimeMapper.java | 3 +- .../impl/XhpcDataBigScreenServiceImpl.java | 92 +++++++++++-------- .../resources/mapper/XhpcRateTimeMapper.xml | 15 +-- .../XhpcPileRegularInspectServiceImpl.java | 25 ++++- .../mapper/XhpcPileRegularInspectMapper.xml | 3 +- 7 files changed, 132 insertions(+), 100 deletions(-) create mode 100644 xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/RealtimeOrder.java diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/RealtimeOrder.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/RealtimeOrder.java new file mode 100644 index 00000000..04e7b5e3 --- /dev/null +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/RealtimeOrder.java @@ -0,0 +1,44 @@ +package com.xhpc.card.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +/** + * @author yuyang + * @date 2022/9/20 15:20 + */ +@Data +public class RealtimeOrder { + /** + * 用户类型 + */ + private String userType; + /** + * 开始充电时间 + */ + private String startChargingTime; + /** + * 充电时长 + */ + private String chargingTime; + /** + * 已充电量(度) + */ + private Double chargedElectric; + /** + * 充电金额 + */ + private Double chargingSum; + /** + * 电流 + */ + private Double electricCurrent; + /** + * 电压 + */ + private Double voltage; + /** + * SOC + */ + private String soc; +} diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/RealtimeOrders.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/RealtimeOrders.java index 82661cc9..a11b06c3 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/RealtimeOrders.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/RealtimeOrders.java @@ -25,54 +25,4 @@ public class RealtimeOrders { @JsonProperty("data") private List data; - /** - * RealtimeOrder - */ - @NoArgsConstructor - @Data - public static class RealtimeOrder { - - /** - * 用户类型 - */ - @JsonProperty("userType") - private String userType; - /** - * 开始充电时间 - */ - @JsonProperty("startChargingTime") - private String startChargingTime; - /** - * 充电时长 - */ - @JsonProperty("chargingTime") - private String chargingTime; - /** - * 已充电量(度) - */ - @JsonProperty("chargedElectric") - private Double chargedElectric; - /** - * 充电金额 - */ - @JsonProperty("chargingSum") - private Double chargingSum; - /** - * 电流 - */ - @JsonProperty("electricCurrent") - private Double electricCurrent; - /** - * 电压 - */ - @JsonProperty("voltage") - private Double voltage; - /** - * SOC - */ - @JsonProperty("soc") - private String soc; - - } - } diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/mapper/XhpcRateTimeMapper.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/mapper/XhpcRateTimeMapper.java index 812fa03c..966f39e5 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/mapper/XhpcRateTimeMapper.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/mapper/XhpcRateTimeMapper.java @@ -1,5 +1,6 @@ package com.xhpc.card.mapper; +import com.xhpc.card.domain.RealtimeOrder; import com.xhpc.card.pojo.XhpcRateTime; import org.apache.ibatis.annotations.Param; @@ -28,6 +29,6 @@ public interface XhpcRateTimeMapper { * @date 2022/3/17 14:46 * @since version-1.0 */ - List> selectByTenantIdsAndCharingStationIds(@Param("tenantIdsStr") String tenantIdsStr, @Param("xhpcChargingStationList") ArrayList xhpcChargingStationList); + List selectByTenantIdsAndCharingStationIds(@Param("tenantIdsStr") String tenantIdsStr, @Param("xhpcChargingStationList") ArrayList xhpcChargingStationList, @Param("chargingStationId") Long chargingStationId); } \ No newline at end of file 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 997fcf9a..401917c7 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 @@ -1,14 +1,11 @@ package com.xhpc.card.service.impl; +import com.xhpc.card.domain.*; import com.xhpc.common.constant.ConstantClass; import com.xhpc.common.core.domain.R; import com.xhpc.common.redis.service.RedisService; import com.xhpc.common.util.MyDateUtil; import com.xhpc.common.util.UserTypeUtil; -import com.xhpc.card.domain.CoreParam; -import com.xhpc.card.domain.OrderRatio; -import com.xhpc.card.domain.OrderTrend; -import com.xhpc.card.domain.RealtimeOrders; import com.xhpc.card.mapper.XhpcAppUserMapper; import com.xhpc.card.mapper.XhpcChargingStationMapper; import com.xhpc.card.mapper.XhpcHistoryOrderMapper; @@ -524,18 +521,25 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService { String tenantIdsStr = null; List> xhpcChargingStationList = null; + List realtimeOrderList =new ArrayList<>(); + RealtimeOrders realtimeOrders = new RealtimeOrders(); //judge care param function switch (coreParam.getParamType()) { case 0: tenantIdsStr = coreParam.getTenantIds(); if (!"".equals(tenantIdsStr) && tenantIdsStr != null) { - List> realtimeOrderList = xhpcRateTimeMapper.selectByTenantIdsAndCharingStationIds(tenantIdsStr, null); - return getRealtimeOrders(realtimeOrderList); + realtimeOrderList = xhpcRateTimeMapper.selectByTenantIdsAndCharingStationIds(tenantIdsStr, null,null); } else { - List> realtimeOrderList = xhpcRateTimeMapper.selectByTenantIdsAndCharingStationIds(tenantIdsStr, null); - return getRealtimeOrders(realtimeOrderList); + realtimeOrderList = xhpcRateTimeMapper.selectByTenantIdsAndCharingStationIds(tenantIdsStr, null,null); } - //query charging station infos of whole area + realtimeOrders.setTotalItems(0L); + if (realtimeOrderList.size()==0) { + realtimeOrders.setData(new ArrayList<>()); + return R.ok(realtimeOrders); + } + realtimeOrders.setData(realtimeOrderList); + realtimeOrders.setTotalItems((long) realtimeOrderList.size()); + return R.ok(realtimeOrders); case 1: Integer areaCode = coreParam.getAreaCode(); tenantIdsStr = coreParam.getTenantIds(); @@ -549,30 +553,38 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService { for (Map chargingStation : xhpcChargingStationList) { chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID)); } - List> realtimeOrderList = xhpcRateTimeMapper.selectByTenantIdsAndCharingStationIds(tenantIdsStr, chargingStationIdList); - return getRealtimeOrders(realtimeOrderList); + realtimeOrderList = xhpcRateTimeMapper.selectByTenantIdsAndCharingStationIds(tenantIdsStr, chargingStationIdList,null); } else { xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdsStr, areaCode,number); ArrayList chargingStationIdList = new ArrayList<>(); for (Map chargingStation : xhpcChargingStationList) { chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID)); } - List> realtimeOrderList = xhpcRateTimeMapper.selectByTenantIdsAndCharingStationIds(tenantIdsStr, chargingStationIdList); - return getRealtimeOrders(realtimeOrderList); + realtimeOrderList = xhpcRateTimeMapper.selectByTenantIdsAndCharingStationIds(tenantIdsStr, chargingStationIdList,null); } + realtimeOrders.setTotalItems(0L); + if (realtimeOrderList.size()==0) { + realtimeOrders.setData(new ArrayList<>()); + return R.ok(realtimeOrders); + } + realtimeOrders.setData(realtimeOrderList); + realtimeOrders.setTotalItems((long) realtimeOrderList.size()); + return R.ok(realtimeOrders); case 2: //query location info of special charging station of special tenant tenantIdsStr = coreParam.getTenantIds(); + if (!"".equals(tenantIdsStr) && tenantIdsStr != null) { - String chargingStationIdStr = coreParam.getChargingStationIds(); - long chargingStationId = Long.parseLong(chargingStationIdStr); - xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndChargingStationId(tenantIdsStr, chargingStationId); - ArrayList chargingStationIdList = new ArrayList<>(); - for (Map chargingStation : xhpcChargingStationList) { - chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID)); + long chargingStationId = Long.parseLong(coreParam.getChargingStationIds()); + realtimeOrderList = xhpcRateTimeMapper.selectByTenantIdsAndCharingStationIds(tenantIdsStr,null,chargingStationId); + realtimeOrders.setTotalItems(0L); + if (realtimeOrderList.size()==0) { + realtimeOrders.setData(new ArrayList<>()); + return R.ok(realtimeOrders); } - List> realtimeOrderList = xhpcRateTimeMapper.selectByTenantIdsAndCharingStationIds(tenantIdsStr, chargingStationIdList); - return getRealtimeOrders(realtimeOrderList); + realtimeOrders.setData(realtimeOrderList); + realtimeOrders.setTotalItems((long) realtimeOrderList.size()); + return R.ok(realtimeOrders); } else { return R.fail("传入的参数有误"); } @@ -716,25 +728,25 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService { private R getRealtimeOrders(List> realtimeOrderList) { //init wrapper class object,set default value RealtimeOrders realtimeOrders = new RealtimeOrders(); - ArrayList realtimeOrderWrapperList = new ArrayList<>(); - realtimeOrders.setData(realtimeOrderWrapperList); - realtimeOrders.setTotalItems(0L); - if (realtimeOrderList.isEmpty()) { - return R.ok(realtimeOrders); - } - realtimeOrders.setTotalItems((long) realtimeOrderList.size()); - for (Map realtimeOrderMap : realtimeOrderList) { - RealtimeOrders.RealtimeOrder realtimeOrder = new RealtimeOrders.RealtimeOrder(); - realtimeOrder.setUserType((String) realtimeOrderMap.get("chargingMode")); - realtimeOrder.setStartChargingTime((String) realtimeOrderMap.get("startTime")); - realtimeOrder.setChargingTime((String) realtimeOrderMap.get("chargingTime")); - realtimeOrder.setChargedElectric((Double) realtimeOrderMap.get("chargingDegree")); - realtimeOrder.setChargingSum((Double) realtimeOrderMap.get("amountCharged")); - realtimeOrder.setElectricCurrent((Double) realtimeOrderMap.get("electricCurrent")); - realtimeOrder.setVoltage((Double) realtimeOrderMap.get("voltage")); - realtimeOrder.setSoc((String) realtimeOrderMap.get("soc")); - realtimeOrderWrapperList.add(realtimeOrder); - } +// ArrayList realtimeOrderWrapperList = new ArrayList<>(); +// realtimeOrders.setData(realtimeOrderWrapperList); +// realtimeOrders.setTotalItems(0L); +// if (realtimeOrderList.isEmpty()) { +// return R.ok(realtimeOrders); +// } +// realtimeOrders.setTotalItems((long) realtimeOrderList.size()); +// for (Map realtimeOrderMap : realtimeOrderList) { +// RealtimeOrders.RealtimeOrder realtimeOrder = new RealtimeOrders.RealtimeOrder(); +// realtimeOrder.setUserType((String) realtimeOrderMap.get("chargingMode")); +// realtimeOrder.setStartChargingTime((String) realtimeOrderMap.get("startTime")); +// realtimeOrder.setChargingTime((String) realtimeOrderMap.get("chargingTime")); +// realtimeOrder.setChargedElectric((Double) realtimeOrderMap.get("chargingDegree")); +// realtimeOrder.setChargingSum((Double) realtimeOrderMap.get("amountCharged")); +// realtimeOrder.setElectricCurrent((Double) realtimeOrderMap.get("electricCurrent")); +// realtimeOrder.setVoltage((Double) realtimeOrderMap.get("voltage")); +// realtimeOrder.setSoc((String) realtimeOrderMap.get("soc")); +// realtimeOrderWrapperList.add(realtimeOrder); +// } return R.ok(realtimeOrders); } diff --git a/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcRateTimeMapper.xml b/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcRateTimeMapper.xml index acf29bd4..3d303b19 100644 --- a/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcRateTimeMapper.xml +++ b/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcRateTimeMapper.xml @@ -33,11 +33,11 @@ from xhpc_rate_time where rate_time_id = #{rateTimeId,jdbcType=BIGINT} - select - ifnull(ROUND(ro.charging_degree,2),0) as chargingDegree, - DATE_FORMAT(co.start_time,"%H:%i") as startTime, - ifnull(ro.amount_charged,0) amountCharged, + ifnull(ROUND(ro.charging_degree,2),0) as chargedElectric, + DATE_FORMAT(co.start_time,"%H:%i") as startChargingTime, + ifnull(ro.amount_charged,0) chargingSum, ifnull(ro.electric_current,0) electricCurrent, ro.real_time_order_id as realTimeOrderId, ifnull(ro.voltage,0) as voltage, @@ -54,8 +54,7 @@ "小桔用户" ELSE "C端用户" - END chargingMode - from xhpc_charge_order co + END userType left join xhpc_internet_user as inu on inu.internet_user_id = co.user_id and co.source =1 left join xhpc_app_user as apu on apu.app_user_id = co.user_id and co.source =0 left join xhpc_community_personnel as cop on cop.community_personnel_id = co.user_id and co.source =2 @@ -74,8 +73,12 @@ #{chargingStationId} + + and co.charging_station_id =#{chargingStationId} + order by co.create_time desc + delete from xhpc_rate_time diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPileRegularInspectServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPileRegularInspectServiceImpl.java index 1dda1926..c3010777 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPileRegularInspectServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPileRegularInspectServiceImpl.java @@ -1,7 +1,9 @@ package com.xhpc.order.service.impl; +import com.xhpc.common.api.WorkOrderYuService; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.service.BaseService; +import com.xhpc.common.redis.service.RedisService; import com.xhpc.common.security.service.TokenService; import com.xhpc.order.domain.XhpcPileRegularInspect; import com.xhpc.order.mapper.XhpcPileRegularInspectMapper; @@ -10,8 +12,6 @@ import com.xhpc.system.api.model.LoginUser; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -20,6 +20,11 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX @Resource private TokenService tokenService; + @Resource + private RedisService redisService; + @Resource + private WorkOrderYuService workOrderService; + @Resource private XhpcPileRegularInspectMapper xhpcPileRegularInspectMapper; @@ -131,6 +136,22 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX List> list = xhpcPileRegularInspectMapper.verificationPileRepeat(); for (int i = 0; i map=list.get(i); + String serialNumber = map.get("serialNumber").toString(); + String directNumber = map.get("directNumber").toString(); + String communicationNumber = map.get("communicationNumber").toString(); + Integer type =Integer.parseInt(map.get("type").toString()); + Map cachePile = redisService.getCacheMap("pile:" + serialNumber); + //Long rateModelId = (Long) cachePile.get("rateModelId"); + String firmwareVersion = cachePile.get("firmwareVersion").toString(); + if(type==1){ + if(!directNumber.equals(firmwareVersion)){ + //添加一条工单 + } + }else{ + if(!communicationNumber.equals(firmwareVersion)){ + //添加一条工单 + } + } diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcPileRegularInspectMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcPileRegularInspectMapper.xml index b4d92f57..36c0e073 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcPileRegularInspectMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcPileRegularInspectMapper.xml @@ -130,7 +130,8 @@ xcp.charging_pile_id, xcp.serial_number serialNumber, xpe.direct_number directNumber, - xpe.communication_number communicationNumber + xpe.communication_number communicationNumber, + xcp.type as type FROM xhpc_charging_pile xcp LEFT JOIN xhpc_pile_edition xpe on xpe.charging_station_id = xcp.charging_station_id