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 aff49d82..f37a2aa3 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 @@ -9,6 +9,7 @@ import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.PreAuthorize; import com.xhpc.charging.station.domain.XhpcChargingStation; import com.xhpc.charging.station.service.IXhpcChargingStationService; +import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -97,4 +98,44 @@ public class XhpcChargingStationController extends BaseController { { return toAjax(xhpcChargingStationService.updateXhpcChargingStationByIds(chargingStationIds)); } + + /** + * 状态(0正常 1停用) + */ + //@PreAuthorize(hasPermi = "system:station:remove") + //@Log(title = "电站", businessType = BusinessType.DELETE) + @PostMapping("/status") + public AjaxResult status(@Param("status")Integer status,@Param("chargingStationId")Long chargingStationId) + { + return toAjax(xhpcChargingStationService.status(status,chargingStationId)); + } + + /** + * APP端、小程序是否可见 + * @param type 0可见 1不可见 + * @param clientVisible 值 + * @param chargingStationId 场站id + * @return 结果 + */ + //@PreAuthorize(hasPermi = "system:station:remove") + //@Log(title = "电站", businessType = BusinessType.DELETE) + @PostMapping("/clientVisible") + public AjaxResult status(@Param("type")Integer type,@Param("clientVisible")String clientVisible,@Param("chargingStationId")Long chargingStationId) + { + return toAjax(xhpcChargingStationService.clientVisible(type,clientVisible,chargingStationId)); + } + + + /** + * 合作的电站 + */ + //@PreAuthorize(hasPermi = "system:station:remove") + //@Log(title = "电站", businessType = BusinessType.DELETE) + @GetMapping(value = "/stationInternetBlackList") + public AjaxResult stationInternetBlackList(@Param("chargingStationId") Long chargingStationId) + { + return AjaxResult.success(xhpcChargingStationService.stationInternetBlackList(chargingStationId)); + } + + } 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 3f2285bc..aad58189 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 @@ -61,4 +61,30 @@ public interface XhpcChargingStationMapper { * @return 结果 */ int updateXhpcChargingStationByIds(Long[] chargingStationIds); + + /** + * 状态(0正常 1停用) + * + * @param status 0正常 1停用 + * @return 结果 + */ + void status(@Param("status") Integer status,@Param("chargingStationId")Long chargingStationId); + + + /** + * APP端、小程序是否可见 + * + * @param clientVisible app可见值 + * @param chargingStationId 场站id + * @return 结果 + */ + void clientVisible(@Param("clientVisible") String clientVisible,@Param("chargingStationId")Long chargingStationId); + + /** + * 合作的电站 + * + * @param chargingStationId 电站ID + * @return 电站 + */ + List> stationInternetBlackList(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 43a8cf67..5ec9b9ed 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 @@ -24,7 +24,8 @@ public interface IXhpcChargingStationService { /** * 查询电站列表 * - * @param xhpcChargingStation 电站 + * @param name 电站名称 + * @param operatorName 运营商名称 * @return 电站集合 */ public List> selectXhpcChargingStationList(String name,String operatorName); @@ -60,4 +61,31 @@ public interface IXhpcChargingStationService { * @return 结果 */ public int updateXhpcChargingStationById(Long chargingStationId); + + /** + * 状态(0正常 1停用) + * + * @param status 0正常 1停用 + * @param chargingStationId 场站id + * @return 结果 + */ + public int status(Integer status,Long chargingStationId); + + /** + * APP端、小程序是否可见 + * + * @param type 0可见 1不可见 + * @param clientVisible 值 + * @param chargingStationId 场站id + * @return 结果 + */ + public int clientVisible(Integer type,String clientVisible,Long chargingStationId); + + /** + * 合作的电站 + * + * @param chargingStationId 电站ID + * @return 电站 + */ + public List> stationInternetBlackList(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 51cb98ae..d0e9ea65 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 @@ -7,9 +7,7 @@ import com.xhpc.charging.station.mapper.XhpcChargingStationMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 电站Service业务层处理 @@ -42,7 +40,8 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi /** * 查询电站列表 * - * @param xhpcChargingStation 电站 + * @param name 电站名称 + * @param operatorName 运营商名称 * @return 电站 */ @Override @@ -118,4 +117,63 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi { return xhpcChargingStationMapper.updateXhpcChargingStationById(chargingStationId); } + + /** + * 状态(0正常 1停用) + * + * @param status 0正常 1停用 + * @param chargingStationId 场站id + * @return 结果 + */ + @Override + public int status(Integer status,Long chargingStationId) { + if(status !=null && (status ==0 || status==1)){ + xhpcChargingStationMapper.status(status,chargingStationId); + return 1; + } + return 0; + } + + /** + * APP端、小程序是否可见 + * + * @param type 0可见 1不可见 + * @param clientVisible 值 + * @param chargingStationId 场站id + * @return 结果 + */ + @Override + public int clientVisible(Integer type, String clientVisible, Long chargingStationId) { + + //判断状态 + if(type !=null && (type ==0 || type==1)){ + //获取场站数据 + XhpcChargingStation xhpcChargingStation = xhpcChargingStationMapper.selectXhpcChargingStationById(chargingStationId); + String clientVisibleValue = xhpcChargingStation.getClientVisible(); + if(clientVisibleValue ==null || clientVisibleValue ==""){ + if(type ==0){ + xhpcChargingStationMapper.clientVisible(clientVisible,chargingStationId); + } + }else{ + //去掉重复的值 + String[] split = clientVisibleValue.split(","); + Set set= new HashSet<>(Arrays.asList(split)); + if(type ==0){ + set.add(clientVisible); + }else{ + set.remove(clientVisible); + } + String str = String.join(",", set); + xhpcChargingStationMapper.clientVisible(str,chargingStationId); + } + return 1; + } + return 0; + } + + @Override + public List> stationInternetBlackList(Long chargingStationId) { + return xhpcChargingStationMapper.stationInternetBlackList(chargingStationId); + } + } 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 b9e9e967..0d5e8da8 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 @@ -154,4 +154,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{chargingStationId} + + + update xhpc_charging_station set status =#{status} where charging_station_id = #{chargingStationId} and del_flag =0 + + + + update xhpc_charging_station set client_visible =#{clientVisible} where charging_station_id = #{chargingStationId} and del_flag =0 + + + \ No newline at end of file