上传和删除桩的编号
This commit is contained in:
parent
db1e7397cb
commit
72bbf297e4
@ -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")
|
||||
|
||||
@ -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<String> getXchargingPileList(@Param("chargingStationId")Long chargingStationId);
|
||||
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;i<args.length-1;i++){
|
||||
|
||||
for(int j=i+1;j<args.length;j++){
|
||||
String start = args[i].getEndTime();
|
||||
String end = args[j].getStartTime();
|
||||
if(DateUtil.parse(start).getTime()>DateUtil.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<String> set = xhpcChargingStationMapper.getXchargingPileList(chargingStationId);
|
||||
if(set !=null && set.size()>0){
|
||||
if (status ==0) {
|
||||
//添加场站下面的所有桩
|
||||
powerPileService.addPileWhitelist(chargingStationId,set);
|
||||
}else{
|
||||
//删除场站下面的所有桩
|
||||
powerPileService.deletePileWhitelist(chargingStationId,set);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -81,12 +81,13 @@ public class XhpcTerminalServiceImpl implements IXhpcTerminalService{
|
||||
@Override
|
||||
public AjaxResult getWXpNumMessage(String pNum) {
|
||||
|
||||
//获取枪的状态
|
||||
|
||||
Map<String, Object> 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());
|
||||
|
||||
@ -725,4 +725,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<update id="updateXhpcRateTime">
|
||||
update xhpc_rate_time set del_flag =1 where charging_station_id = #{chargingStationId} and del_flag =0
|
||||
</update>
|
||||
|
||||
<select id="getXchargingPileList" resultType="Set">
|
||||
select
|
||||
serial_number as pileNo
|
||||
from xhpc_charging_pile
|
||||
where charging_station_id=#{chargingStationId} and del_flag =0 and status =0
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user