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 3c471849..2ab931a3 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 @@ -93,13 +93,13 @@ public class XhpcChargingStationController extends BaseController { //@PreAuthorize(hasPermi = "system:station:remove") //@Log(title = "电站", businessType = BusinessType.DELETE) @DeleteMapping("/{chargingStationIds}") - public AjaxResult remove(@PathVariable Long[] chargingStationIds) + public AjaxResult remove(@PathVariable Long chargingStationIds) { - return toAjax(xhpcChargingStationService.updateXhpcChargingStationByIds(chargingStationIds)); + return toAjax(xhpcChargingStationService.updateXhpcChargingStationById(chargingStationIds)); } /** - * 状态(0正常 1停用) + * 状态(启用 1停用) */ //@PreAuthorize(hasPermi = "system:station:remove") //@Log(title = "电站", businessType = BusinessType.DELETE) @@ -151,7 +151,7 @@ public class XhpcChargingStationController extends BaseController { /** * 场站详情接口 * @param chargingStationId - * @param type 1详情使用 2编辑使用 + * @param type 1编辑使用 2详情使用 * @return */ @GetMapping(value = "/getXhpcChargingStationMessage") 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 ab6f929c..6ef1f27c 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 @@ -1,5 +1,6 @@ package com.xhpc.charging.station.mapper; +import com.xhpc.common.api.dto.ChargingPileDto; import com.xhpc.common.domain.XhpcChargingStation; import com.xhpc.common.domain.XhpcRate; import com.xhpc.common.domain.XhpcRateModel; @@ -8,6 +9,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; +import java.util.Set; /** * 电站Mapper接口 @@ -66,9 +68,9 @@ public interface XhpcChargingStationMapper { int updateXhpcChargingStationByIds(Long[] chargingStationIds); /** - * 状态(0正常 1停用) + * 状态(0启用 1停用) * - * @param status 0正常 1停用 + * @param status 0启用 1停用 * @return 结果 */ void status(@Param("status") Integer status,@Param("chargingStationId")Long chargingStationId); @@ -209,4 +211,11 @@ public interface XhpcChargingStationMapper { */ int updateXhpcRateTime(@Param("chargingStationId")Long chargingStationId); + /** + * 根据场站id获取桩编号 + * @param chargingStationId + * @return + */ + Set getXchargingPileList(@Param("chargingStationId")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 fc3c79b7..d968a057 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 @@ -65,9 +65,9 @@ public interface IXhpcChargingStationService { int updateXhpcChargingStationById(Long chargingStationId); /** - * 状态(0正常 1停用) + * 状态(0启用 1停用) * - * @param status 0正常 1停用 + * @param status 0启用 1停用 * @param chargingStationId 场站id * @return 结果 */ @@ -156,4 +156,11 @@ public interface IXhpcChargingStationService { * @return */ AjaxResult updateXhpcRateTime(XhpcChargingStationDto xhpcChargingStationDto); + + /** + * 上传桩编号和删除编号 + * @param status 0启用 1停用 + * @param chargingStationId 场站id + */ + void extracted(Integer status, Long chargingStationId); } 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 def26981..74be454e 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 @@ -1,6 +1,8 @@ package com.xhpc.charging.station.service; import cn.hutool.core.date.DateUtil; +import com.xhpc.common.api.PowerPileService; +import com.xhpc.common.api.dto.ChargingPileDto; import com.xhpc.common.core.utils.DateUtils; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.domain.XhpcChargingStation; @@ -11,8 +13,10 @@ import com.xhpc.common.api.dto.XhpcChargingStationDto; import com.xhpc.common.api.dto.XhpcRateDto; import com.xhpc.common.api.dto.XhpcRateTimeDto; import com.xhpc.charging.station.mapper.XhpcChargingStationMapper; +import org.checkerframework.checker.units.qual.A; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.annotation.Version; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -35,6 +39,8 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi private IXhpcRateTimeService xhpcRateTimeService; @Autowired private IXhpcTerminalService xhpcTerminalService; + @Autowired + private PowerPileService powerPileService; /** * 查询电站 @@ -126,7 +132,11 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi @Override public int updateXhpcChargingStationById(Long chargingStationId) { - return xhpcChargingStationMapper.updateXhpcChargingStationById(chargingStationId); + int i = xhpcChargingStationMapper.updateXhpcChargingStationById(chargingStationId); + if (i>0) { + extracted(1,chargingStationId); + } + return i; } /** @@ -140,11 +150,14 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi public int status(Integer status,Long chargingStationId) { if(status !=null && (status ==0 || status==1)){ xhpcChargingStationMapper.status(status,chargingStationId); + extracted(status, chargingStationId); return 1; } return 0; } + + /** * APP端、小程序是否可见 * @@ -364,7 +377,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi /** * 场站详情接口 * @param chargingStationId - * @param type 1详情使用 2编辑使用 + * @param type 1编辑使用 2详情使用 * @return */ @Override @@ -691,23 +704,37 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi public static XhpcRateTimeDto [] bubbleSort(XhpcRateTimeDto [] args){ //冒泡排序算法 for(int i=0;iDateUtil.parse(end).getTime()){ XhpcRateTimeDto temp=args[i]; - args[i]=args[j]; - args[j]=temp; - } } } return args; } + /** + * 0 添加 1删除 + * @param status + * @param chargingStationId + */ + @Override + public void extracted(Integer status, Long chargingStationId) { + Set set = xhpcChargingStationMapper.getXchargingPileList(chargingStationId); + if(set !=null && set.size()>0){ + if (status ==0) { + //添加场站下面的所有桩 + powerPileService.addPileWhitelist(chargingStationId,set); + }else{ + //删除场站下面的所有桩 + powerPileService.deletePileWhitelist(chargingStationId,set); + } + } + } } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTerminalServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTerminalServiceImpl.java index a907455c..ed067d2c 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTerminalServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTerminalServiceImpl.java @@ -81,12 +81,13 @@ public class XhpcTerminalServiceImpl implements IXhpcTerminalService{ @Override public AjaxResult getWXpNumMessage(String pNum) { - //获取枪的状态 - Map map = xhpcTerminalMapper.getWXpNumMessage(pNum); if(map ==null || map.get("chargingStationId")==null){ return AjaxResult.error(1007,"无效的终端编码"); } + //获取桩的状态 + + Long chargingStationId = Long.parseLong(map.get("chargingStationId").toString()); //HH:mm:ss String tiem = DateUtil.formatTime(new Date()); 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 0e1009ab..cf7e1ee2 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 @@ -725,4 +725,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update xhpc_rate_time set del_flag =1 where charging_station_id = #{chargingStationId} and del_flag =0 + +